diff options
author | vogelheim@chromium.org <vogelheim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 15:08:47 +0000 |
---|---|---|
committer | vogelheim@chromium.org <vogelheim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 15:10:07 +0000 |
commit | 35103c00345f59565607ac0c51595851731d6721 (patch) | |
tree | bc576cfafdec0526e3497127d74e707e09e05d4a /content | |
parent | 27d52baba73a95621ec4b37a15e1dbaeaf768c6d (diff) | |
download | chromium_src-35103c00345f59565607ac0c51595851731d6721.zip chromium_src-35103c00345f59565607ac0c51595851731d6721.tar.gz chromium_src-35103c00345f59565607ac0c51595851731d6721.tar.bz2 |
Implement --v8-cache-options (instead of --enable-preparsed-js-caching)
and send the option value via Preferences to the renderer.
BUG=399580
Review URL: https://codereview.chromium.org/431323003
Cr-Commit-Position: refs/heads/master@{#288969}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 15 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_impl.cc | 12 | ||||
-rw-r--r-- | content/public/common/common_param_traits_macros.h | 3 | ||||
-rw-r--r-- | content/public/common/content_switches.cc | 4 | ||||
-rw-r--r-- | content/public/common/content_switches.h | 2 | ||||
-rw-r--r-- | content/public/common/web_preferences.cc | 10 | ||||
-rw-r--r-- | content/public/common/web_preferences.h | 8 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 3 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 15 |
10 files changed, 39 insertions, 34 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 59ab5b4..13ce2f8 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -986,25 +986,10 @@ void RenderMessageFilter::OnFreeTransportDIB( } #endif -bool RenderMessageFilter::CheckPreparsedJsCachingEnabled() const { - static bool checked = false; - static bool result = false; - if (!checked) { - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - result = command_line.HasSwitch(switches::kEnablePreparsedJsCaching); - checked = true; - } - return result; -} - void RenderMessageFilter::OnCacheableMetadataAvailable( const GURL& url, double expected_response_time, const std::vector<char>& data) { - if (!CheckPreparsedJsCachingEnabled()) - return; - net::HttpCache* cache = request_context_->GetURLRequestContext()-> http_transaction_factory()->GetCache(); DCHECK(cache); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 2ef3f66..9197d0e 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1153,7 +1153,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kEnableOverscrollNotifications, switches::kEnablePinch, switches::kEnablePreciseMemoryInfo, - switches::kEnablePreparsedJsCaching, switches::kEnableRendererMojoChannel, switches::kEnableSeccompFilterSandbox, switches::kEnableSkiaBenchmarking, diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 3ab2edb..5006500 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -469,6 +469,18 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs(const GURL& url) { prefs.spatial_navigation_enabled = command_line.HasSwitch( switches::kEnableSpatialNavigation); + if (command_line.HasSwitch(switches::kV8CacheOptions)) { + const std::string v8_cache_options = + command_line.GetSwitchValueASCII(switches::kV8CacheOptions); + if (v8_cache_options == "parse") { + prefs.v8_cache_options = V8_CACHE_OPTIONS_PARSE; + } else if (v8_cache_options == "code") { + prefs.v8_cache_options = V8_CACHE_OPTIONS_CODE; + } else { + prefs.v8_cache_options = V8_CACHE_OPTIONS_OFF; + } + } + GetContentClient()->browser()->OverrideWebkitPrefs(this, url, &prefs); return prefs; } diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index d4302b2..a5f1a50 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h @@ -42,6 +42,8 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::EditingBehavior, IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition, WINDOW_OPEN_DISPOSITION_LAST) IPC_ENUM_TRAITS_MAX_VALUE(net::RequestPriority, net::MAXIMUM_PRIORITY) +IPC_ENUM_TRAITS_MAX_VALUE(content::V8CacheOptions, + content::V8_CACHE_OPTIONS_LAST) IPC_STRUCT_TRAITS_BEGIN(blink::WebPoint) IPC_STRUCT_TRAITS_MEMBER(x) @@ -176,6 +178,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(cookie_enabled) IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop) IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled) + IPC_STRUCT_TRAITS_MEMBER(v8_cache_options) IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled) #if defined(OS_ANDROID) IPC_STRUCT_TRAITS_MEMBER(text_autosizing_enabled) diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index a46ada7..3dac571 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -422,8 +422,8 @@ const char kEnablePinch[] = "enable-pinch"; // also applys to workers. const char kEnablePreciseMemoryInfo[] = "enable-precise-memory-info"; -// Enable caching of pre-parsed JS script data. See http://crbug.com/32407. -const char kEnablePreparsedJsCaching[] = "enable-preparsed-js-caching"; +// Set options to cache V8 data. (off, preparse data, or code) +const char kV8CacheOptions[] = "v8-cache-options"; // Enables the CSS multicol implementation that uses the regions implementation. const char kEnableRegionBasedColumns[] = diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index be86c29..b75a9fc 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -123,7 +123,6 @@ CONTENT_EXPORT extern const char kDisableOverlayFullscreenVideoSubtitle[]; CONTENT_EXPORT extern const char kEnableOverscrollNotifications[]; CONTENT_EXPORT extern const char kEnablePinch[]; CONTENT_EXPORT extern const char kEnablePreciseMemoryInfo[]; -extern const char kEnablePreparsedJsCaching[]; CONTENT_EXPORT extern const char kEnableRegionBasedColumns[]; CONTENT_EXPORT extern const char kEnableRendererMojoChannel[]; CONTENT_EXPORT extern const char kEnableSandboxLogging[]; @@ -234,6 +233,7 @@ CONTENT_EXPORT extern const char kUtilityProcess[]; extern const char kUtilityProcessAllowedDir[]; CONTENT_EXPORT extern const char kUtilityProcessEnableMDns[]; CONTENT_EXPORT extern const char kUtilityProcessRunningElevated[]; +extern const char kV8CacheOptions[]; CONTENT_EXPORT extern const char kValidateInputEventStream[]; CONTENT_EXPORT extern const char kWaitForDebuggerChildren[]; CONTENT_EXPORT extern const char kZygoteCmdPrefix[]; diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc index f9bd26f..a429396 100644 --- a/content/public/common/web_preferences.cc +++ b/content/public/common/web_preferences.cc @@ -31,6 +31,15 @@ COMPILE_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_UNIX, COMPILE_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_ANDROID, WebSettings::EditingBehaviorAndroid); +COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_OFF, + WebSettings::V8CacheOptionsOff); +COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE, + WebSettings::V8CacheOptionsParse); +COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE, + WebSettings::V8CacheOptionsCode); +COMPILE_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_LAST, + WebSettings::V8CacheOptionsCode); + WebPreferences::WebPreferences() : default_font_size(16), default_fixed_font_size(13), @@ -128,6 +137,7 @@ WebPreferences::WebPreferences() pinch_overlay_scrollbar_thickness(0), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), + v8_cache_options(V8_CACHE_OPTIONS_OFF), cookie_enabled(true), pepper_accelerated_video_decode_enabled(false) #if defined(OS_ANDROID) diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h index 7763755..4499d35 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h @@ -35,6 +35,13 @@ enum EditingBehavior { EDITING_BEHAVIOR_LAST = EDITING_BEHAVIOR_ANDROID }; +enum V8CacheOptions { + V8_CACHE_OPTIONS_OFF, + V8_CACHE_OPTIONS_PARSE, + V8_CACHE_OPTIONS_CODE, + V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE +}; + // 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. @@ -140,6 +147,7 @@ struct CONTENT_EXPORT WebPreferences { int pinch_overlay_scrollbar_thickness; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; + V8CacheOptions v8_cache_options; // This flags corresponds to a Page's Settings' setCookieEnabled state. It // only controls whether or not the "document.cookie" field is properly diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index fe06a72..5231ea7 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -1123,6 +1123,9 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, settings->setSelectionIncludesAltImageText(true); + settings->setV8CacheOptions( + static_cast<WebSettings::V8CacheOptions>(prefs.v8_cache_options)); + #if defined(OS_ANDROID) settings->setAllowCustomScrollbarInMainFrame(false); settings->setTextAutosizingEnabled(prefs.text_autosizing_enabled); diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 3558e34..829277e 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -329,26 +329,11 @@ RendererWebKitPlatformSupportImpl::prescientNetworking() { return GetContentClient()->renderer()->GetPrescientNetworking(); } -bool -RendererWebKitPlatformSupportImpl::CheckPreparsedJsCachingEnabled() const { - static bool checked = false; - static bool result = false; - if (!checked) { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - result = command_line.HasSwitch(switches::kEnablePreparsedJsCaching); - checked = true; - } - return result; -} - void RendererWebKitPlatformSupportImpl::cacheMetadata( const blink::WebURL& url, double response_time, const char* data, size_t size) { - if (!CheckPreparsedJsCachingEnabled()) - return; - // Let the browser know we generated cacheable metadata for this resource. The // browser may cache it and return it on subsequent responses to speed // the processing of this resource. |