diff options
author | asvitkine <asvitkine@chromium.org> | 2015-11-30 16:45:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 00:47:05 +0000 |
commit | 86340191dcd4ad3ab7e6e4c7500ff9a5a8e9c3b0 (patch) | |
tree | 1e49b91bd7d2b26fd067caec6fd7f95fab8fe794 /content/browser/renderer_host/render_process_host_impl.cc | |
parent | eb0c2deca4997bbe976d04a9402b672f34bfce92 (diff) | |
download | chromium_src-86340191dcd4ad3ab7e6e4c7500ff9a5a8e9c3b0.zip chromium_src-86340191dcd4ad3ab7e6e4c7500ff9a5a8e9c3b0.tar.gz chromium_src-86340191dcd4ad3ab7e6e4c7500ff9a5a8e9c3b0.tar.bz2 |
Make FeatureList override state be plumbed to renderer processes.
Previously, the browser copied over verbatim the --enable-features
and --disable-features command-line. However, this wouldn't have
captured overrides as a result of field trials. This change updates
the logic to include those in the list. The new logic will continue
to work for plumbing command-lines as well, since those are also
registered using the override mechanism.
Note: There's still some follow-up work that needs to be done to
plumb the FieldTrial association state (so that a FieldTrial that's
not active will get activated in the renderer if the associated
Feature is queried). But this can be supported in a follow-up CL
that builds on top of this one.
BUG=561077
Review URL: https://codereview.chromium.org/1471693007
Cr-Commit-Position: refs/heads/master@{#362294}
Diffstat (limited to 'content/browser/renderer_host/render_process_host_impl.cc')
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 91e438f..f88d475 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -17,6 +17,7 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/debug/dump_without_crashing.h" +#include "base/feature_list.h" #include "base/files/file.h" #include "base/lazy_instance.h" #include "base/location.h" @@ -433,6 +434,24 @@ std::string UintVectorToString(const std::vector<unsigned>& vector) { return str; } +// Copies kEnableFeatures and kDisableFeatures to the renderer command line. +// Generates them from the FeatureList override state, to take into account +// overrides from FieldTrials. +void CopyEnableDisableFeatureFlagsToRenderer(base::CommandLine* renderer_cmd) { + std::string enabled_features; + std::string disabled_features; + base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, + &disabled_features); + if (!enabled_features.empty()) { + renderer_cmd->AppendSwitchASCII(switches::kEnableFeatures, + enabled_features); + } + if (!disabled_features.empty()) { + renderer_cmd->AppendSwitchASCII(switches::kDisableFeatures, + disabled_features); + } +} + } // namespace RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; @@ -1306,7 +1325,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableDisplayList2dCanvas, switches::kDisableDistanceFieldText, switches::kDisableEncryptedMedia, - switches::kDisableFeatures, switches::kDisableFileSystem, switches::kDisableGestureRequirementForMediaPlayback, switches::kDisableGpuCompositing, @@ -1345,7 +1363,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kEnableDistanceFieldText, switches::kEnableExperimentalCanvasFeatures, switches::kEnableExperimentalWebPlatformFeatures, - switches::kEnableFeatures, switches::kEnableHeapProfiling, switches::kEnableGPUClientLogging, switches::kEnableGpuClientTracing, @@ -1487,6 +1504,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, arraysize(kSwitchNames)); + CopyEnableDisableFeatureFlagsToRenderer(renderer_cmd); + if (browser_cmd.HasSwitch(switches::kTraceStartup) && BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { // Pass kTraceStartup switch to renderer only if startup tracing has not |