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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 main_message_loop.AddTaskObserver(&task_observer); | 171 main_message_loop.AddTaskObserver(&task_observer); |
172 | 172 |
173 scoped_ptr<MemoryObserver> memory_observer; | 173 scoped_ptr<MemoryObserver> memory_observer; |
174 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { | 174 if (parsed_command_line.HasSwitch(switches::kMemoryMetrics)) { |
175 memory_observer.reset(new MemoryObserver()); | 175 memory_observer.reset(new MemoryObserver()); |
176 main_message_loop.AddTaskObserver(memory_observer.get()); | 176 main_message_loop.AddTaskObserver(memory_observer.get()); |
177 } | 177 } |
178 | 178 |
179 base::PlatformThread::SetName("CrRendererMain"); | 179 base::PlatformThread::SetName("CrRendererMain"); |
180 | 180 |
181 platform.PlatformInitialize(); | |
182 | |
183 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 181 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
184 | 182 |
185 // Initialize histogram statistics gathering system. | 183 // Initialize histogram statistics gathering system. |
186 base::StatisticsRecorder::Initialize(); | 184 base::StatisticsRecorder::Initialize(); |
187 | 185 |
188 // Initialize statistical testing infrastructure. We set the entropy provider | 186 // Initialize statistical testing infrastructure. We set the entropy provider |
189 // to NULL to disallow the renderer process from creating its own one-time | 187 // to NULL to disallow the renderer process from creating its own one-time |
190 // randomized trials; they should be created in the browser process. | 188 // randomized trials; they should be created in the browser process. |
191 base::FieldTrialList field_trial_list(NULL); | 189 base::FieldTrialList field_trial_list(NULL); |
192 // Ensure any field trials in browser are reflected into renderer. | 190 // Ensure any field trials in browser are reflected into renderer. |
193 if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { | 191 if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { |
194 // Field trials are created in an "activated" state to ensure they get | 192 // Field trials are created in an "activated" state to ensure they get |
195 // reported in crash reports. | 193 // reported in crash reports. |
196 bool result = base::FieldTrialList::CreateTrialsFromString( | 194 bool result = base::FieldTrialList::CreateTrialsFromString( |
197 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), | 195 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
198 base::FieldTrialList::ACTIVATE_TRIALS, | 196 base::FieldTrialList::ACTIVATE_TRIALS, |
199 std::set<std::string>()); | 197 std::set<std::string>()); |
200 DCHECK(result); | 198 DCHECK(result); |
201 } | 199 } |
202 | 200 |
201 // PlatformInitialize uses FieldTrials, so this must happen later. | |
jamesr
2014/06/17 21:04:20
how does PlatformInitialize depend on FieldTrials?
| |
202 platform.PlatformInitialize(); | |
203 | |
203 #if defined(ENABLE_PLUGINS) | 204 #if defined(ENABLE_PLUGINS) |
204 // Load pepper plugins before engaging the sandbox. | 205 // Load pepper plugins before engaging the sandbox. |
205 PepperPluginRegistry::GetInstance(); | 206 PepperPluginRegistry::GetInstance(); |
206 #endif | 207 #endif |
207 #if defined(ENABLE_WEBRTC) | 208 #if defined(ENABLE_WEBRTC) |
208 // Initialize WebRTC before engaging the sandbox. | 209 // Initialize WebRTC before engaging the sandbox. |
209 // NOTE: On linux, this call could already have been made from | 210 // NOTE: On linux, this call could already have been made from |
210 // zygote_main_linux.cc. However, calling multiple times from the same thread | 211 // zygote_main_linux.cc. However, calling multiple times from the same thread |
211 // is OK. | 212 // is OK. |
212 InitializeWebRtcModule(); | 213 InitializeWebRtcModule(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 base::MessageLoop::current()->Run(); | 250 base::MessageLoop::current()->Run(); |
250 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 251 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
251 } | 252 } |
252 } | 253 } |
253 platform.PlatformUninitialize(); | 254 platform.PlatformUninitialize(); |
254 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 255 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
255 return 0; | 256 return 0; |
256 } | 257 } |
257 | 258 |
258 } // namespace content | 259 } // namespace content |
OLD | NEW |