Index: content/app/content_main_runner.cc |
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
index abe4f13051c45db0ac11f31e7ef09b59fe3f618b..8db4acb24a1e9facbd25e63f89a4fdf46faa8ca1 100644 |
--- a/content/app/content_main_runner.cc |
+++ b/content/app/content_main_runner.cc |
@@ -15,15 +15,18 @@ |
#include "base/allocator/allocator_check.h" |
#include "base/allocator/allocator_extension.h" |
#include "base/at_exit.h" |
+#include "base/base_switches.h" |
#include "base/command_line.h" |
#include "base/debug/debugger.h" |
#include "base/debug/stack_trace.h" |
+#include "base/feature_list.h" |
#include "base/files/file_path.h" |
#include "base/i18n/icu_util.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/macros.h" |
#include "base/memory/scoped_vector.h" |
+#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram_base.h" |
#include "base/metrics/statistics_recorder.h" |
#include "base/path_service.h" |
@@ -729,6 +732,33 @@ class ContentMainRunnerImpl : public ContentMainRunner { |
std::string process_type = |
command_line.GetSwitchValueASCII(switches::kProcessType); |
+ // Initialize statistical testing infrastructure. We set the entropy |
+ // provider to NULL to disallow non-browser processes from creating their |
Alexei Svitkine (slow)
2016/04/29 18:06:32
Nit: NULL -> null
and NULL -> nullptr below.
erikchen
2016/04/29 18:34:38
Done.
|
+ // own one-time randomized trials; they should be created in the browser |
+ // process. |
+ base::FieldTrialList field_trial_list(NULL); |
Alexei Svitkine (slow)
2016/04/29 18:06:32
How does this interact with:
https://code.google.
erikchen
2016/04/29 18:34:38
whoops! I had meant to remove that.
|
+ |
+ // TODO(asvitkine): This logic should run for all child processes. |
+ // https://crbug.com/563705. |
+ if (process_type == switches::kGpuProcess || |
+ process_type == switches::kUtilityProcess || |
+ process_type == switches::kPpapiPluginProcess) { |
+ // Ensure any field trials in browser are reflected into the child |
+ // process. |
+ if (command_line.HasSwitch(switches::kForceFieldTrials)) { |
+ bool result = base::FieldTrialList::CreateTrialsFromString( |
+ command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
+ std::set<std::string>()); |
+ DCHECK(result); |
+ } |
+ |
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
+ feature_list->InitializeFromCommandLine( |
+ command_line.GetSwitchValueASCII(switches::kEnableFeatures), |
+ command_line.GetSwitchValueASCII(switches::kDisableFeatures)); |
+ base::FeatureList::SetInstance(std::move(feature_list)); |
+ } |
+ |
base::HistogramBase::EnableActivityReportHistogram(process_type); |
MainFunctionParams main_params(command_line); |