Commit e1c3b8bf authored by marja's avatar marja Committed by Commit bot

Script streaming: Add more Finch experiments for streaming policies.

The Blink side already handles these policies; this CL is just plugging them
into Finch.

BUG=

Review URL: https://codereview.chromium.org/697673002

Cr-Commit-Position: refs/heads/master@{#302422}
parent 4933e097
......@@ -473,9 +473,22 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs(const GURL& url) {
}
}
std::string streaming_experiment_group =
base::FieldTrialList::FindFullName("V8ScriptStreaming");
prefs.v8_script_streaming_enabled =
command_line.HasSwitch(switches::kEnableV8ScriptStreaming) ||
base::FieldTrialList::FindFullName("V8ScriptStreaming") == "Enabled";
command_line.HasSwitch(switches::kEnableV8ScriptStreaming);
if (streaming_experiment_group == "Enabled") {
prefs.v8_script_streaming_enabled = true;
prefs.v8_script_streaming_mode = V8_SCRIPT_STREAMING_MODE_ALL;
} else if (streaming_experiment_group == "OnlyAsyncAndDefer") {
prefs.v8_script_streaming_enabled = true;
prefs.v8_script_streaming_mode =
V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER;
} else if (streaming_experiment_group == "AllPlusBlockParserBlocking") {
prefs.v8_script_streaming_enabled = true;
prefs.v8_script_streaming_mode =
V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING;
}
GetContentClient()->browser()->OverrideWebkitPrefs(this, url, &prefs);
return prefs;
......
......@@ -44,6 +44,8 @@ IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition,
IPC_ENUM_TRAITS_MAX_VALUE(net::RequestPriority, net::MAXIMUM_PRIORITY)
IPC_ENUM_TRAITS_MAX_VALUE(content::V8CacheOptions,
content::V8_CACHE_OPTIONS_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(content::V8ScriptStreamingMode,
content::V8_SCRIPT_STREAMING_MODE_LAST)
IPC_STRUCT_TRAITS_BEGIN(blink::WebPoint)
IPC_STRUCT_TRAITS_MEMBER(x)
......@@ -179,6 +181,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
IPC_STRUCT_TRAITS_MEMBER(v8_cache_options)
IPC_STRUCT_TRAITS_MEMBER(v8_script_streaming_enabled)
IPC_STRUCT_TRAITS_MEMBER(v8_script_streaming_mode)
IPC_STRUCT_TRAITS_MEMBER(slimming_paint_enabled)
IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled)
#if defined(OS_ANDROID)
......
......@@ -40,6 +40,18 @@ COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE,
COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_LAST,
WebSettings::V8CacheOptionsCode);
COMPILE_ASSERT_MATCHING_ENUMS(V8_SCRIPT_STREAMING_MODE_ALL,
WebSettings::V8ScriptStreamingModeAll);
COMPILE_ASSERT_MATCHING_ENUMS(
V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER,
WebSettings::V8ScriptStreamingModeOnlyAsyncAndDefer);
COMPILE_ASSERT_MATCHING_ENUMS(
V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING,
WebSettings::V8ScriptStreamingModeAllPlusBlockParsingBlocking);
COMPILE_ASSERT_MATCHING_ENUMS(
V8_SCRIPT_STREAMING_MODE_LAST,
WebSettings::V8ScriptStreamingModeAllPlusBlockParsingBlocking);
WebPreferences::WebPreferences()
: default_font_size(16),
default_fixed_font_size(13),
......@@ -139,6 +151,7 @@ WebPreferences::WebPreferences()
navigate_on_drag_drop(true),
v8_cache_options(V8_CACHE_OPTIONS_OFF),
v8_script_streaming_enabled(false),
v8_script_streaming_mode(V8_SCRIPT_STREAMING_MODE_ALL),
slimming_paint_enabled(false),
cookie_enabled(true),
pepper_accelerated_video_decode_enabled(false)
......
......@@ -39,6 +39,14 @@ enum V8CacheOptions {
V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE
};
enum V8ScriptStreamingMode {
V8_SCRIPT_STREAMING_MODE_ALL,
V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER,
V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING,
V8_SCRIPT_STREAMING_MODE_LAST =
V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING
};
// The ISO 15924 script code for undetermined script aka Common. It's the
// default used on WebKit's side to get/set a font setting when no script is
// specified.
......@@ -145,6 +153,7 @@ struct CONTENT_EXPORT WebPreferences {
bool navigate_on_drag_drop;
V8CacheOptions v8_cache_options;
bool v8_script_streaming_enabled;
V8ScriptStreamingMode v8_script_streaming_mode;
bool slimming_paint_enabled;
// This flags corresponds to a Page's Settings' setCookieEnabled state. It
......
......@@ -1067,6 +1067,9 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
static_cast<WebSettings::V8CacheOptions>(prefs.v8_cache_options));
settings->setV8ScriptStreamingEnabled(prefs.v8_script_streaming_enabled);
settings->setV8ScriptStreamingMode(
static_cast<WebSettings::V8ScriptStreamingMode>(
prefs.v8_script_streaming_mode));
#if defined(OS_ANDROID)
settings->setAllowCustomScrollbarInMainFrame(false);
......
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