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

Side by Side Diff: content/app/content_main_runner.cc

Issue 2530573002: Share field trial allocator on zygote-using Linuxes (Closed)
Patch Set: add check back 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
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)
148 // On POSIX systems that use the zygote, we get the trials from a shared
149 // memory segment backed by an fd instead of the command line.
147 base::FieldTrialList::CreateTrialsFromCommandLine( 150 base::FieldTrialList::CreateTrialsFromCommandLine(
148 command_line, switches::kFieldTrialHandle); 151 command_line, switches::kFieldTrialHandle, kFieldTrialDescriptor);
152 #else
153 base::FieldTrialList::CreateTrialsFromCommandLine(
154 command_line, switches::kFieldTrialHandle, -1);
155 #endif
149 156
150 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 157 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
151 feature_list->InitializeFromCommandLine( 158 feature_list->InitializeFromCommandLine(
152 command_line.GetSwitchValueASCII(switches::kEnableFeatures), 159 command_line.GetSwitchValueASCII(switches::kEnableFeatures),
153 command_line.GetSwitchValueASCII(switches::kDisableFeatures)); 160 command_line.GetSwitchValueASCII(switches::kDisableFeatures));
154 base::FeatureList::SetInstance(std::move(feature_list)); 161 base::FeatureList::SetInstance(std::move(feature_list));
155 } 162 }
156 163
157 } // namespace 164 } // namespace
158 165
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // - The ipc_fd is passed through the Java service. 478 // - The ipc_fd is passed through the Java service.
472 // Thus, these are all disabled. 479 // Thus, these are all disabled.
473 #if !defined(OS_ANDROID) 480 #if !defined(OS_ANDROID)
474 // Set C library locale to make sure CommandLine can parse argument values 481 // Set C library locale to make sure CommandLine can parse argument values
475 // in correct encoding. 482 // in correct encoding.
476 setlocale(LC_ALL, ""); 483 setlocale(LC_ALL, "");
477 484
478 SetupSignalHandlers(); 485 SetupSignalHandlers();
479 g_fds->Set(kMojoIPCChannel, 486 g_fds->Set(kMojoIPCChannel,
480 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); 487 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
488
489 g_fds->Set(
490 kFieldTrialDescriptor,
491 kFieldTrialDescriptor + base::GlobalDescriptors::kBaseDescriptor);
481 #endif // !OS_ANDROID 492 #endif // !OS_ANDROID
482 493
483 #if defined(OS_LINUX) || defined(OS_OPENBSD) 494 #if defined(OS_LINUX) || defined(OS_OPENBSD)
484 g_fds->Set(kCrashDumpSignal, 495 g_fds->Set(kCrashDumpSignal,
485 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); 496 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
486 #endif // OS_LINUX || OS_OPENBSD 497 #endif // OS_LINUX || OS_OPENBSD
487 498
488 499
489 #endif // !OS_WIN 500 #endif // !OS_WIN
490 501
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 842
832 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 843 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
833 }; 844 };
834 845
835 // static 846 // static
836 ContentMainRunner* ContentMainRunner::Create() { 847 ContentMainRunner* ContentMainRunner::Create() {
837 return new ContentMainRunnerImpl(); 848 return new ContentMainRunnerImpl();
838 } 849 }
839 850
840 } // namespace content 851 } // namespace content
OLDNEW
« no previous file with comments | « components/variations/child_process_field_trial_syncer_unittest.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698