Index: content/browser/browser_child_process_host_impl.cc |
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc |
index 4a2dd39ae2aa357bd2f3664b4e1320470d6c8123..ff59df4c22d71d00702d22d4628c607b1f734b14 100644 |
--- a/content/browser/browser_child_process_host_impl.cc |
+++ b/content/browser/browser_child_process_host_impl.cc |
@@ -8,10 +8,12 @@ |
#include "base/bind.h" |
#include "base/command_line.h" |
#include "base/debug/dump_without_crashing.h" |
+#include "base/feature_list.h" |
#include "base/files/file_path.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/macros.h" |
+#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram.h" |
#include "base/stl_util.h" |
#include "base/strings/string_util.h" |
@@ -176,6 +178,28 @@ void BrowserChildProcessHostImpl::TerminateAll() { |
} |
} |
+// static |
+void BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags( |
+ base::CommandLine* cmd_line) { |
+ std::string enabled_features; |
+ std::string disabled_features; |
+ base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, |
+ &disabled_features); |
+ if (!enabled_features.empty()) |
+ cmd_line->AppendSwitchASCII(switches::kEnableFeatures, enabled_features); |
+ if (!disabled_features.empty()) |
+ cmd_line->AppendSwitchASCII(switches::kDisableFeatures, disabled_features); |
+ |
+ // If we run base::FieldTrials, we want to pass to their state to the |
+ // child process so that it can act in accordance with each state. |
+ std::string field_trial_states; |
+ base::FieldTrialList::AllStatesToString(&field_trial_states); |
+ if (!field_trial_states.empty()) { |
+ cmd_line->AppendSwitchASCII(switches::kForceFieldTrials, |
+ field_trial_states); |
+ } |
+} |
+ |
void BrowserChildProcessHostImpl::Launch( |
SandboxedProcessLauncherDelegate* delegate, |
base::CommandLine* cmd_line, |