Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: content/app/content_main_runner.cc

Issue 2530573002: Share field trial allocator on zygote-using Linuxes (Closed)
Patch Set: fallback to command line if descriptor not found Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/app/content_main_runner.cc
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 9d92e28e19c5d1133b7af61925cf10f53b04fe4d..135fe21718ec6c733bef117f2384644ead160b7c 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -144,8 +144,20 @@ void InitializeFieldTrialAndFeatureList(
// Ensure any field trials in browser are reflected into the child
// process.
+#if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_MACOSX) && \
+ !defined(OS_ANDROID)
jochen (gone - plz use gerrit) 2016/11/29 15:13:39 e.g. https://cs.chromium.org/chromium/src/content/
lawrencewu 2016/11/29 15:24:51 I wasn't sure if NaCl was POSIX-compliant and if i
+ // On POSIX systems that use the zygote, we get the trials from a shared
+ // memory segment backed by an fd instead of the command line.
+ bool result =
+ base::FieldTrialList::CreateTrialsFromDescriptor(kFieldTrialDescriptor);
+ if (!result) {
+ base::FieldTrialList::CreateTrialsFromCommandLine(
+ command_line, switches::kFieldTrialHandle);
+ }
+#else
base::FieldTrialList::CreateTrialsFromCommandLine(
command_line, switches::kFieldTrialHandle);
+#endif
std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
feature_list->InitializeFromCommandLine(
@@ -478,6 +490,10 @@ class ContentMainRunnerImpl : public ContentMainRunner {
SetupSignalHandlers();
g_fds->Set(kMojoIPCChannel,
kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
+
+ g_fds->Set(
+ kFieldTrialDescriptor,
+ kFieldTrialDescriptor + base::GlobalDescriptors::kBaseDescriptor);
#endif // !OS_ANDROID
#if defined(OS_LINUX) || defined(OS_OPENBSD)
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698