Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) | |
|
Alexei Svitkine (slow)
2016/11/29 19:32:47
I think this can be simplified - this ifdef needs
lawrencewu
2016/11/29 19:52:44
I think this can even just be OS_POSIX.
| |
| 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. | |
| 147 base::FieldTrialList::CreateTrialsFromCommandLine( | 151 base::FieldTrialList::CreateTrialsFromCommandLine( |
| 148 command_line, switches::kFieldTrialHandle); | 152 command_line, switches::kFieldTrialHandle, kFieldTrialDescriptor); |
| 153 #else | |
| 154 base::FieldTrialList::CreateTrialsFromCommandLine( | |
| 155 command_line, switches::kFieldTrialHandle, -1); | |
| 156 #endif | |
| 149 | 157 |
| 150 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 158 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 151 feature_list->InitializeFromCommandLine( | 159 feature_list->InitializeFromCommandLine( |
| 152 command_line.GetSwitchValueASCII(switches::kEnableFeatures), | 160 command_line.GetSwitchValueASCII(switches::kEnableFeatures), |
| 153 command_line.GetSwitchValueASCII(switches::kDisableFeatures)); | 161 command_line.GetSwitchValueASCII(switches::kDisableFeatures)); |
| 154 base::FeatureList::SetInstance(std::move(feature_list)); | 162 base::FeatureList::SetInstance(std::move(feature_list)); |
| 155 } | 163 } |
| 156 | 164 |
| 157 } // namespace | 165 } // namespace |
| 158 | 166 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 // - The ipc_fd is passed through the Java service. | 479 // - The ipc_fd is passed through the Java service. |
| 472 // Thus, these are all disabled. | 480 // Thus, these are all disabled. |
| 473 #if !defined(OS_ANDROID) | 481 #if !defined(OS_ANDROID) |
| 474 // Set C library locale to make sure CommandLine can parse argument values | 482 // Set C library locale to make sure CommandLine can parse argument values |
| 475 // in correct encoding. | 483 // in correct encoding. |
| 476 setlocale(LC_ALL, ""); | 484 setlocale(LC_ALL, ""); |
| 477 | 485 |
| 478 SetupSignalHandlers(); | 486 SetupSignalHandlers(); |
| 479 g_fds->Set(kMojoIPCChannel, | 487 g_fds->Set(kMojoIPCChannel, |
| 480 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 488 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
| 489 | |
| 490 g_fds->Set( | |
| 491 kFieldTrialDescriptor, | |
| 492 kFieldTrialDescriptor + base::GlobalDescriptors::kBaseDescriptor); | |
| 481 #endif // !OS_ANDROID | 493 #endif // !OS_ANDROID |
| 482 | 494 |
| 483 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 495 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 484 g_fds->Set(kCrashDumpSignal, | 496 g_fds->Set(kCrashDumpSignal, |
| 485 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); | 497 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); |
| 486 #endif // OS_LINUX || OS_OPENBSD | 498 #endif // OS_LINUX || OS_OPENBSD |
| 487 | 499 |
| 488 | 500 |
| 489 #endif // !OS_WIN | 501 #endif // !OS_WIN |
| 490 | 502 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 | 843 |
| 832 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 844 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 833 }; | 845 }; |
| 834 | 846 |
| 835 // static | 847 // static |
| 836 ContentMainRunner* ContentMainRunner::Create() { | 848 ContentMainRunner* ContentMainRunner::Create() { |
| 837 return new ContentMainRunnerImpl(); | 849 return new ContentMainRunnerImpl(); |
| 838 } | 850 } |
| 839 | 851 |
| 840 } // namespace content | 852 } // namespace content |
| OLD | NEW |