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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| 11 #include "base/debug/leak_annotations.h" | 11 #include "base/debug/leak_annotations.h" |
| 12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/field_trial.h" | |
| 16 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/metrics/statistics_recorder.h" | 16 #include "base/metrics/statistics_recorder.h" |
| 18 #include "base/pending_task.h" | 17 #include "base/pending_task.h" |
| 19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 20 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 21 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
| 22 #include "base/timer/hi_res_timer_manager.h" | 21 #include "base/timer/hi_res_timer_manager.h" |
| 23 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 24 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 25 #include "components/scheduler/renderer/renderer_scheduler.h" | 24 #include "components/scheduler/renderer/renderer_scheduler.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 147 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
| 149 | 148 |
| 150 // Initialize histogram statistics gathering system. | 149 // Initialize histogram statistics gathering system. |
| 151 base::StatisticsRecorder::Initialize(); | 150 base::StatisticsRecorder::Initialize(); |
| 152 | 151 |
| 153 #if defined(OS_ANDROID) | 152 #if defined(OS_ANDROID) |
| 154 // If we have a pending chromium android linker histogram, record it. | 153 // If we have a pending chromium android linker histogram, record it. |
| 155 base::android::RecordChromiumAndroidLinkerRendererHistogram(); | 154 base::android::RecordChromiumAndroidLinkerRendererHistogram(); |
| 156 #endif | 155 #endif |
| 157 | 156 |
| 158 // Initialize statistical testing infrastructure. We set the entropy provider | |
| 159 // to NULL to disallow the renderer process from creating its own one-time | |
| 160 // randomized trials; they should be created in the browser process. | |
| 161 base::FieldTrialList field_trial_list(NULL); | |
| 162 // Ensure any field trials in browser are reflected into renderer. | |
| 163 if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { | |
| 164 bool result = base::FieldTrialList::CreateTrialsFromString( | |
| 165 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), | |
| 166 std::set<std::string>()); | |
| 167 DCHECK(result); | |
| 168 } | |
| 169 | |
| 170 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 157 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 171 feature_list->InitializeFromCommandLine( | 158 feature_list->InitializeFromCommandLine( |
| 172 parsed_command_line.GetSwitchValueASCII(switches::kEnableFeatures), | 159 parsed_command_line.GetSwitchValueASCII(switches::kEnableFeatures), |
| 173 parsed_command_line.GetSwitchValueASCII(switches::kDisableFeatures)); | 160 parsed_command_line.GetSwitchValueASCII(switches::kDisableFeatures)); |
| 174 base::FeatureList::SetInstance(std::move(feature_list)); | 161 base::FeatureList::SetInstance(std::move(feature_list)); |
|
Alexei Svitkine (slow)
2016/04/29 18:42:13
How about removing this too and adding kRendererPr
Alexei Svitkine (slow)
2016/04/29 18:43:05
And by "switch", I of course mean "if" because app
| |
| 175 | 162 |
| 176 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler( | 163 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler( |
| 177 scheduler::RendererScheduler::Create()); | 164 scheduler::RendererScheduler::Create()); |
| 178 | 165 |
| 179 // PlatformInitialize uses FieldTrials, so this must happen later. | 166 // PlatformInitialize uses FieldTrials, so this must happen later. |
| 180 platform.PlatformInitialize(); | 167 platform.PlatformInitialize(); |
| 181 | 168 |
| 182 #if defined(ENABLE_PLUGINS) | 169 #if defined(ENABLE_PLUGINS) |
| 183 // Load pepper plugins before engaging the sandbox. | 170 // Load pepper plugins before engaging the sandbox. |
| 184 PepperPluginRegistry::GetInstance(); | 171 PepperPluginRegistry::GetInstance(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 // ignore shutdown-only leaks. | 214 // ignore shutdown-only leaks. |
| 228 __lsan_do_leak_check(); | 215 __lsan_do_leak_check(); |
| 229 #endif | 216 #endif |
| 230 } | 217 } |
| 231 platform.PlatformUninitialize(); | 218 platform.PlatformUninitialize(); |
| 232 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); | 219 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); |
| 233 return 0; | 220 return 0; |
| 234 } | 221 } |
| 235 | 222 |
| 236 } // namespace content | 223 } // namespace content |
| OLD | NEW |