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

Side by Side 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 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 *base::CommandLine::ForCurrentProcess(); 137 *base::CommandLine::ForCurrentProcess();
138 138
139 // Initialize statistical testing infrastructure. We set the entropy 139 // Initialize statistical testing infrastructure. We set the entropy
140 // provider to nullptr to disallow non-browser processes from creating 140 // provider to nullptr to disallow non-browser processes from creating
141 // their own one-time randomized trials; they should be created in the 141 // their own one-time randomized trials; they should be created in the
142 // browser process. 142 // browser process.
143 field_trial_list->reset(new base::FieldTrialList(nullptr)); 143 field_trial_list->reset(new base::FieldTrialList(nullptr));
144 144
145 // Ensure any field trials in browser are reflected into the child 145 // Ensure any field trials in browser are reflected into the child
146 // process. 146 // process.
147 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_MACOSX) && \
148 !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
149 // On POSIX systems that use the zygote, we get the trials from a shared
150 // memory segment backed by an fd instead of the command line.
151 bool result =
152 base::FieldTrialList::CreateTrialsFromDescriptor(kFieldTrialDescriptor);
153 if (!result) {
154 base::FieldTrialList::CreateTrialsFromCommandLine(
155 command_line, switches::kFieldTrialHandle);
156 }
157 #else
147 base::FieldTrialList::CreateTrialsFromCommandLine( 158 base::FieldTrialList::CreateTrialsFromCommandLine(
148 command_line, switches::kFieldTrialHandle); 159 command_line, switches::kFieldTrialHandle);
160 #endif
149 161
150 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 162 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
151 feature_list->InitializeFromCommandLine( 163 feature_list->InitializeFromCommandLine(
152 command_line.GetSwitchValueASCII(switches::kEnableFeatures), 164 command_line.GetSwitchValueASCII(switches::kEnableFeatures),
153 command_line.GetSwitchValueASCII(switches::kDisableFeatures)); 165 command_line.GetSwitchValueASCII(switches::kDisableFeatures));
154 base::FeatureList::SetInstance(std::move(feature_list)); 166 base::FeatureList::SetInstance(std::move(feature_list));
155 } 167 }
156 168
157 } // namespace 169 } // namespace
158 170
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // - The ipc_fd is passed through the Java service. 483 // - The ipc_fd is passed through the Java service.
472 // Thus, these are all disabled. 484 // Thus, these are all disabled.
473 #if !defined(OS_ANDROID) 485 #if !defined(OS_ANDROID)
474 // Set C library locale to make sure CommandLine can parse argument values 486 // Set C library locale to make sure CommandLine can parse argument values
475 // in correct encoding. 487 // in correct encoding.
476 setlocale(LC_ALL, ""); 488 setlocale(LC_ALL, "");
477 489
478 SetupSignalHandlers(); 490 SetupSignalHandlers();
479 g_fds->Set(kMojoIPCChannel, 491 g_fds->Set(kMojoIPCChannel,
480 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); 492 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
493
494 g_fds->Set(
495 kFieldTrialDescriptor,
496 kFieldTrialDescriptor + base::GlobalDescriptors::kBaseDescriptor);
481 #endif // !OS_ANDROID 497 #endif // !OS_ANDROID
482 498
483 #if defined(OS_LINUX) || defined(OS_OPENBSD) 499 #if defined(OS_LINUX) || defined(OS_OPENBSD)
484 g_fds->Set(kCrashDumpSignal, 500 g_fds->Set(kCrashDumpSignal,
485 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); 501 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
486 #endif // OS_LINUX || OS_OPENBSD 502 #endif // OS_LINUX || OS_OPENBSD
487 503
488 504
489 #endif // !OS_WIN 505 #endif // !OS_WIN
490 506
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 847
832 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
833 }; 849 };
834 850
835 // static 851 // static
836 ContentMainRunner* ContentMainRunner::Create() { 852 ContentMainRunner* ContentMainRunner::Create() {
837 return new ContentMainRunnerImpl(); 853 return new ContentMainRunnerImpl();
838 } 854 }
839 855
840 } // namespace content 856 } // namespace content
OLDNEW
« 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