Commit 6c0322a3 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

[blink scheduler] Allow aggressive throttling on pages using a WebSocket.

Bug: 1121725
Change-Id: I6ae687a4ed0324d32b76b4ec4d60b7b948245d91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376445Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810696}
parent e586599e
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/util/type_safety/strong_alias.h" #include "base/util/type_safety/strong_alias.h"
...@@ -81,6 +82,17 @@ enum WebSocketOpCode { ...@@ -81,6 +82,17 @@ enum WebSocketOpCode {
kOpCodeBinary = 0x2, kOpCodeBinary = 0x2,
}; };
// When enabled, a page can be aggressively throttled even if it uses a
// WebSocket. Aggressive throttling does not affect the execution of WebSocket
// event handlers, so there is little reason to disable it on pages using a
// WebSocket.
//
// TODO(crbug.com/1121725): Cleanup this feature once field experiments confirm
// that the opt-out can be removed.
const base::Feature kAllowAggressiveThrottlingWithWebSocket{
"AllowAggressiveThrottlingWithWebSocket",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace } // namespace
class WebSocketChannelImpl::BlobLoader final class WebSocketChannelImpl::BlobLoader final
...@@ -205,8 +217,12 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { ...@@ -205,8 +217,12 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) {
if (auto* scheduler = execution_context_->GetScheduler()) { if (auto* scheduler = execution_context_->GetScheduler()) {
feature_handle_for_scheduler_ = scheduler->RegisterFeature( feature_handle_for_scheduler_ = scheduler->RegisterFeature(
SchedulingPolicy::Feature::kWebSocket, SchedulingPolicy::Feature::kWebSocket,
{SchedulingPolicy::DisableAggressiveThrottling(), base::FeatureList::IsEnabled(kAllowAggressiveThrottlingWithWebSocket)
SchedulingPolicy::RecordMetricsForBackForwardCache()}); ? SchedulingPolicy{SchedulingPolicy::
RecordMetricsForBackForwardCache()}
: SchedulingPolicy{
SchedulingPolicy::DisableAggressiveThrottling(),
SchedulingPolicy::RecordMetricsForBackForwardCache()});
} }
if (MixedContentChecker::IsMixedContent( if (MixedContentChecker::IsMixedContent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment