diff options
author | vogelheim <vogelheim@chromium.org> | 2015-06-23 02:55:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-23 09:55:49 +0000 |
commit | 9ef1576fb4204023cd78584175bf4a375483c498 (patch) | |
tree | 95082b60fb8342f6c7595b7a51938f34540973a9 | |
parent | 2224c6421b1d357d5a909c05842843e50c1b00df (diff) | |
download | chromium_src-9ef1576fb4204023cd78584175bf4a375483c498.zip chromium_src-9ef1576fb4204023cd78584175bf4a375483c498.tar.gz chromium_src-9ef1576fb4204023cd78584175bf4a375483c498.tar.bz2 |
Cleanup: Remove experimental V8 cache strategies that we discarded.
Remaining are only:
- none (all off),
- parse (formerly parse-memory, the pre-M43 default)
- code (formerly heuristics, the new default)
- default (whatever we think is best. We think "code" is best.)
blink companion CL is forthcoming, and will be submitted right afterwards.
BUG=455187,399580
Review URL: https://codereview.chromium.org/1192323002
Cr-Commit-Position: refs/heads/master@{#335652}
-rw-r--r-- | content/browser/service_worker/service_worker_browsertest.cc | 9 | ||||
-rw-r--r-- | content/common/content_switches_internal.cc | 22 | ||||
-rw-r--r-- | content/public/common/web_preferences.cc | 27 | ||||
-rw-r--r-- | content/public/common/web_preferences.h | 12 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 21 | ||||
-rw-r--r-- | content/renderer/service_worker/embedded_worker_dispatcher.cc | 22 | ||||
-rw-r--r-- | content/test/data/service_worker/worker.js | 15 |
7 files changed, 79 insertions, 49 deletions
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 95d3c1a..b229140 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc @@ -362,6 +362,14 @@ class EmbeddedWorkerBrowserTest : public ServiceWorkerBrowserTest, } } + void SetUpCommandLine(base::CommandLine* command_line) override { + ServiceWorkerBrowserTest::SetUpCommandLine(command_line); + + // Code caching requires a bit more infrastructure that we don't care + // about in this test. + command_line->AppendSwitchASCII(switches::kV8CacheOptions, "none"); + } + void StartOnIOThread() { ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); worker_ = wrapper()->context()->embedded_worker_registry()->CreateWorker(); @@ -383,6 +391,7 @@ class EmbeddedWorkerBrowserTest : public ServiceWorkerBrowserTest, pause_mode_ != DONT_PAUSE, base::Bind(&EmbeddedWorkerBrowserTest::StartOnIOThread2, this)); } + void StartOnIOThread2(ServiceWorkerStatusCode status) { last_worker_status_ = worker_->status(); EXPECT_EQ(SERVICE_WORKER_OK, status); diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc index c13396e..76871e4 100644 --- a/content/common/content_switches_internal.cc +++ b/content/common/content_switches_internal.cc @@ -70,28 +70,12 @@ V8CacheOptions GetV8CacheOptions() { command_line.GetSwitchValueASCII(switches::kV8CacheOptions); if (v8_cache_options.empty()) v8_cache_options = base::FieldTrialList::FindFullName("V8CacheOptions"); - if (v8_cache_options == "parse") { + if (v8_cache_options == "none") { + return V8_CACHE_OPTIONS_NONE; + } else if (v8_cache_options == "parse") { return V8_CACHE_OPTIONS_PARSE; } else if (v8_cache_options == "code") { return V8_CACHE_OPTIONS_CODE; - } else if (v8_cache_options == "code-compressed") { - return V8_CACHE_OPTIONS_CODE_COMPRESSED; - } else if (v8_cache_options == "none") { - return V8_CACHE_OPTIONS_NONE; - } else if (v8_cache_options == "parse-memory") { - return V8_CACHE_OPTIONS_PARSE_MEMORY; - } else if (v8_cache_options == "heuristics") { - return V8_CACHE_OPTIONS_HEURISTICS; - } else if (v8_cache_options == "heuristics-mobile") { - return V8_CACHE_OPTIONS_HEURISTICS_MOBILE; - } else if (v8_cache_options == "heuristics-default") { - return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT; - } else if (v8_cache_options == "heuristics-default-mobile") { - return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE; - } else if (v8_cache_options == "recent") { - return V8_CACHE_OPTIONS_RECENT; - } else if (v8_cache_options == "recent-small") { - return V8_CACHE_OPTIONS_RECENT_SMALL; } else { return V8_CACHE_OPTIONS_DEFAULT; } diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc index 480ed69..dce7c52 100644 --- a/content/public/common/web_preferences.cc +++ b/content/public/common/web_preferences.cc @@ -31,33 +31,20 @@ STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_UNIX, STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_ANDROID, WebSettings::EditingBehaviorAndroid); +// This change has both Chrome + blink components. The #if-guard allows us +// to do this in two steps. +#ifdef CLEANUP_V8_CACHE_OPTIONS_GUARD STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_DEFAULT, WebSettings::V8CacheOptionsDefault); +STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_NONE, + WebSettings::V8CacheOptionsNone); STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE, WebSettings::V8CacheOptionsParse); STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE, WebSettings::V8CacheOptionsCode); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE_COMPRESSED, - WebSettings::V8CacheOptionsCodeCompressed); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_NONE, - WebSettings::V8CacheOptionsNone); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE_MEMORY, - WebSettings::V8CacheOptionsParseMemory); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS, - WebSettings::V8CacheOptionsHeuristics); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS_MOBILE, - WebSettings::V8CacheOptionsHeuristicsMobile); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS_DEFAULT, - WebSettings::V8CacheOptionsHeuristicsDefault); -STATIC_ASSERT_MATCHING_ENUMS( - V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE, - WebSettings::V8CacheOptionsHeuristicsDefaultMobile); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_RECENT, - WebSettings::V8CacheOptionsRecent); -STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_RECENT_SMALL, - WebSettings::V8CacheOptionsRecentSmall); STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_LAST, - WebSettings::V8CacheOptionsRecentSmall); + WebSettings::V8CacheOptionsCode); +#endif // CLEANUP_V8_CACHE_OPTIONS_GUARD STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_ALLOWED, WebSettings::ImageAnimationPolicyAllowed); diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h index 444ce51..e8d7d13 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h @@ -36,18 +36,10 @@ enum EditingBehavior { // Cache options for V8. See V8CacheOptions.h for information on the options. enum V8CacheOptions { V8_CACHE_OPTIONS_DEFAULT, + V8_CACHE_OPTIONS_NONE, V8_CACHE_OPTIONS_PARSE, V8_CACHE_OPTIONS_CODE, - V8_CACHE_OPTIONS_CODE_COMPRESSED, - V8_CACHE_OPTIONS_NONE, - V8_CACHE_OPTIONS_PARSE_MEMORY, - V8_CACHE_OPTIONS_HEURISTICS, - V8_CACHE_OPTIONS_HEURISTICS_MOBILE, - V8_CACHE_OPTIONS_HEURISTICS_DEFAULT, - V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE, - V8_CACHE_OPTIONS_RECENT, - V8_CACHE_OPTIONS_RECENT_SMALL, - V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_RECENT_SMALL + V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE }; // ImageAnimationPolicy is used for controlling image animation diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index ed759dc..7fd3cd9 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -1064,8 +1064,29 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, settings->setSelectionIncludesAltImageText(true); +// This change has both Chrome + blink components. The #if-guard allows us +// to do this in two steps. +#ifdef CLEANUP_V8_CACHE_OPTIONS_GUARD + // Proper solution: settings->setV8CacheOptions( static_cast<WebSettings::V8CacheOptions>(prefs.v8_cache_options)); +#else + // Temporary solution, while not all changes are in: + switch (prefs.v8_cache_options) { + case V8_CACHE_OPTIONS_DEFAULT: + settings->setV8CacheOptions(WebSettings::V8CacheOptionsDefault); + break; + case V8_CACHE_OPTIONS_NONE: + settings->setV8CacheOptions(WebSettings::V8CacheOptionsNone); + break; + case V8_CACHE_OPTIONS_PARSE: + settings->setV8CacheOptions(WebSettings::V8CacheOptionsParseMemory); + break; + case V8_CACHE_OPTIONS_CODE: + settings->setV8CacheOptions(WebSettings::V8CacheOptionsHeuristics); + break; + } +#endif // CLEANUP_V8_CACHE_OPTIONS_GUARD settings->setImageAnimationPolicy( static_cast<WebSettings::ImageAnimationPolicy>(prefs.animation_policy)); diff --git a/content/renderer/service_worker/embedded_worker_dispatcher.cc b/content/renderer/service_worker/embedded_worker_dispatcher.cc index 0a5c3fd..de3db08 100644 --- a/content/renderer/service_worker/embedded_worker_dispatcher.cc +++ b/content/renderer/service_worker/embedded_worker_dispatcher.cc @@ -93,8 +93,30 @@ void EmbeddedWorkerDispatcher::OnStartWorker( params.wait_for_debugger ? blink::WebEmbeddedWorkerStartData::WaitForDebugger : blink::WebEmbeddedWorkerStartData::DontWaitForDebugger; + +// This change has both Chrome + blink components. The #if-guard allows us +// to do this in two steps. +#ifdef CLEANUP_V8_CACHE_OPTIONS_GUARD + // Proper solution: start_data.v8CacheOptions = static_cast<blink::WebSettings::V8CacheOptions>(params.v8_cache_options); +#else + // Temporary solution, while not all changes are in: + switch (params.v8_cache_options) { + case V8_CACHE_OPTIONS_DEFAULT: + start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsDefault; + break; + case V8_CACHE_OPTIONS_NONE: + start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsNone; + break; + case V8_CACHE_OPTIONS_PARSE: + start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsParseMemory; + break; + case V8_CACHE_OPTIONS_CODE: + start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsHeuristics; + break; + } +#endif // CLEANUP_V8_CACHE_OPTIONS_GUARD wrapper->worker()->startWorkerContext(start_data); workers_.AddWithID(wrapper.release(), params.embedded_worker_id); diff --git a/content/test/data/service_worker/worker.js b/content/test/data/service_worker/worker.js index 68bb7a8..909b006 100644 --- a/content/test/data/service_worker/worker.js +++ b/content/test/data/service_worker/worker.js @@ -3,3 +3,18 @@ // found in the LICENSE file. this.oninstall = function(event) {}; + +// So sorry about this waste of bytes: +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) +// Filler comment, to trigger code caching heuristic (script > 1K.) + |