Commit 759a1fb4 authored by yucliu's avatar yucliu Committed by Commit Bot

[Chromecast] Feature flag to disable idle socket close

Add new feature flag disable_idle_socket_close_on_memory_pressure. If
the flag is turned on, cast_shell won't close idle sockets when memory
pressure happens.

BUG=786585, internal b/73351220, internal b/73495670
TEST=Lauch cast_shell with enable-features=disable_... and watch logs

Change-Id: I5aa22a20103624c3114bc8de34412a9ace0dfa29
Reviewed-on: https://chromium-review.googlesource.com/922902Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Yuchen Liu <yucliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537161}
parent 16869bea
...@@ -124,6 +124,11 @@ const base::Feature kTripleBuffer720{"enable_triple_buffer_720", ...@@ -124,6 +124,11 @@ const base::Feature kTripleBuffer720{"enable_triple_buffer_720",
// settings and takes precedence over triple-buffer feature). // settings and takes precedence over triple-buffer feature).
const base::Feature kSingleBuffer{"enable_single_buffer", const base::Feature kSingleBuffer{"enable_single_buffer",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Disable idle sockets closing on memory pressure. See
// chromecast/browser/url_request_context_factory.cc for usage.
const base::Feature kDisableIdleSocketsCloseOnMemoryPressure{
"disable_idle_sockets_close_on_memory_pressure",
base::FEATURE_DISABLED_BY_DEFAULT};
// End Chromecast Feature definitions. // End Chromecast Feature definitions.
......
...@@ -25,6 +25,7 @@ extern const base::Feature kAllowUserMediaAccess; ...@@ -25,6 +25,7 @@ extern const base::Feature kAllowUserMediaAccess;
extern const base::Feature kEnableQuic; extern const base::Feature kEnableQuic;
extern const base::Feature kTripleBuffer720; extern const base::Feature kTripleBuffer720;
extern const base::Feature kSingleBuffer; extern const base::Feature kSingleBuffer;
extern const base::Feature kDisableIdleSocketsCloseOnMemoryPressure;
// Below are utilities needed by the Cast receiver to persist feature // Below are utilities needed by the Cast receiver to persist feature
// information. Client code which is simply querying the status of a feature // information. Client code which is simply querying the status of a feature
......
...@@ -335,9 +335,17 @@ void URLRequestContextFactory::PopulateNetworkSessionParams( ...@@ -335,9 +335,17 @@ void URLRequestContextFactory::PopulateNetworkSessionParams(
LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = "
<< session_params->enable_quic; << session_params->enable_quic;
// Do not close idle sockets on memory pressure, otherwise it will open too // Disable idle sockets close on memory pressure, if instructed by DCS. On
// much connections to the server. // memory constrained devices:
session_params->disable_idle_sockets_close_on_memory_pressure = true; // 1. if idle sockets are closed when memory pressure happens, cast_shell will
// close and re-open lots of connections to server.
// 2. if idle sockets are kept alive when memory pressure happens, this may
// cause JS engine gc frequently, leading to JS suspending.
session_params->disable_idle_sockets_close_on_memory_pressure =
base::FeatureList::IsEnabled(kDisableIdleSocketsCloseOnMemoryPressure);
LOG(INFO) << "Set HttpNetworkSessionParams."
<< "disable_idle_sockets_close_on_memory_pressure = "
<< session_params->disable_idle_sockets_close_on_memory_pressure;
} }
net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() {
......
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