OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/system_monitor/system_monitor.h" | 17 #include "base/system_monitor/system_monitor.h" |
18 #include "base/threading/platform_thread.h" | |
19 #include "base/time.h" | 18 #include "base/time.h" |
20 #include "content/common/content_counters.h" | 19 #include "content/common/content_counters.h" |
21 #include "content/common/content_switches.h" | 20 #include "content/common/content_switches.h" |
22 #include "content/common/main_function_params.h" | 21 #include "content/common/main_function_params.h" |
23 #include "content/common/hi_res_timer_manager.h" | 22 #include "content/common/hi_res_timer_manager.h" |
24 #include "content/common/pepper_plugin_registry.h" | 23 #include "content/common/pepper_plugin_registry.h" |
25 #include "content/renderer/render_process_impl.h" | 24 #include "content/renderer/render_process_impl.h" |
26 #include "content/renderer/render_thread.h" | 25 #include "content/renderer/render_thread.h" |
27 #include "content/renderer/renderer_main_platform_delegate.h" | 26 #include "content/renderer/renderer_main_platform_delegate.h" |
28 #include "ui/base/ui_base_switches.h" | 27 #include "ui/base/ui_base_switches.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 150 |
152 RendererMainPlatformDelegate platform(parameters); | 151 RendererMainPlatformDelegate platform(parameters); |
153 | 152 |
154 base::StatsScope<base::StatsCounterTimer> | 153 base::StatsScope<base::StatsCounterTimer> |
155 startup_timer(content::Counters::renderer_main()); | 154 startup_timer(content::Counters::renderer_main()); |
156 | 155 |
157 RendererMessageLoopObserver task_observer; | 156 RendererMessageLoopObserver task_observer; |
158 #if defined(OS_MACOSX) | 157 #if defined(OS_MACOSX) |
159 // As long as we use Cocoa in the renderer (for the forseeable future as of | 158 // As long as we use Cocoa in the renderer (for the forseeable future as of |
160 // now; see http://crbug.com/13890 for info) we need to have a UI loop. | 159 // now; see http://crbug.com/13890 for info) we need to have a UI loop. |
161 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 160 MessageLoop main_message_loop("CrRendererMain", MessageLoop::TYPE_UI); |
162 #else | 161 #else |
163 // The main message loop of the renderer services doesn't have IO or UI tasks, | 162 // The main message loop of the renderer services doesn't have IO or UI tasks, |
164 // unless in-process-plugins is used. | 163 // unless in-process-plugins is used. |
165 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? | 164 MessageLoop main_message_loop("CrRendererMain", |
166 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT); | 165 RenderProcessImpl::InProcessPlugins() ? |
| 166 MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT); |
167 #endif | 167 #endif |
168 main_message_loop.AddTaskObserver(&task_observer); | 168 main_message_loop.AddTaskObserver(&task_observer); |
169 | 169 |
170 base::PlatformThread::SetName("CrRendererMain"); | |
171 | |
172 base::SystemMonitor system_monitor; | 170 base::SystemMonitor system_monitor; |
173 HighResolutionTimerManager hi_res_timer_manager; | 171 HighResolutionTimerManager hi_res_timer_manager; |
174 | 172 |
175 platform.PlatformInitialize(); | 173 platform.PlatformInitialize(); |
176 | 174 |
177 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 175 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
178 platform.InitSandboxTests(no_sandbox); | 176 platform.InitSandboxTests(no_sandbox); |
179 | 177 |
180 // Initialize histogram statistics gathering system. | 178 // Initialize histogram statistics gathering system. |
181 // Don't create StatisticsRecorder in the single process mode. | 179 // Don't create StatisticsRecorder in the single process mode. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 pool->Recycle(); | 224 pool->Recycle(); |
227 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 225 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
228 MessageLoop::current()->Run(); | 226 MessageLoop::current()->Run(); |
229 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 227 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
230 } | 228 } |
231 } | 229 } |
232 platform.PlatformUninitialize(); | 230 platform.PlatformUninitialize(); |
233 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 231 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
234 return 0; | 232 return 0; |
235 } | 233 } |
OLD | NEW |