revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Samuel Attard <[email protected]>
  3. Date: Tue, 5 Sep 2023 13:22:31 -0700
  4. Subject: Revert "Remove the AllowAggressiveThrottlingWithWebSocket feature."
  5. This reverts commit 615c1810a187840ffeb04096087efff86edb37de.
  6. diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
  7. index 7a885de263f1c84fc676c62caa6c787983e47994..854d57812e99bb4668aa3bbf3f63bdb0219e658d 100644
  8. --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
  9. +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
  10. @@ -104,6 +104,17 @@ enum WebSocketOpCode {
  11. kOpCodeBinary = 0x2,
  12. };
  13. +// When enabled, a page can be aggressively throttled even if it uses a
  14. +// WebSocket. Aggressive throttling does not affect the execution of WebSocket
  15. +// event handlers, so there is little reason to disable it on pages using a
  16. +// WebSocket.
  17. +//
  18. +// TODO(crbug.com/1121725): Cleanup this feature in June 2021, when it becomes
  19. +// enabled by default on Stable.
  20. +BASE_FEATURE(kAllowAggressiveThrottlingWithWebSocket,
  21. + "AllowAggressiveThrottlingWithWebSocket",
  22. + base::FEATURE_ENABLED_BY_DEFAULT);
  23. +
  24. } // namespace
  25. WebSocketChannelImpl::MessageDataDeleter::MessageDataDeleter(
  26. @@ -297,7 +308,10 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) {
  27. // even if the `WebSocketChannel` is closed.
  28. feature_handle_for_scheduler_ = scheduler->RegisterFeature(
  29. SchedulingPolicy::Feature::kWebSocket,
  30. - SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});
  31. + base::FeatureList::IsEnabled(kAllowAggressiveThrottlingWithWebSocket)
  32. + ? SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()}
  33. + : SchedulingPolicy{SchedulingPolicy::DisableAggressiveThrottling(),
  34. + SchedulingPolicy::DisableBackForwardCache()});
  35. scheduler->RegisterStickyFeature(
  36. SchedulingPolicy::Feature::kWebSocketSticky,
  37. SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});