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 #if defined(OS_MACOSX) | 5 #if defined(OS_MACOSX) |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #endif // OS_MACOSX | 8 #endif // OS_MACOSX |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/mac/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/metrics/stats_counters.h" | 18 #include "base/metrics/stats_counters.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
22 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
23 #include "base/time.h" | 23 #include "base/time.h" |
24 #include "chrome/common/chrome_constants.h" | |
25 #include "chrome/common/chrome_counters.h" | |
26 #include "chrome/common/chrome_switches.h" | |
27 #include "chrome/common/logging_chrome.h" | |
28 #include "chrome/common/net/net_resource_provider.h" | |
29 #include "chrome/common/pepper_plugin_registry.h" | 24 #include "chrome/common/pepper_plugin_registry.h" |
30 #include "chrome/renderer/renderer_main_platform_delegate.h" | 25 #include "content/common/content_counters.h" |
| 26 #include "content/common/content_switches.h" |
31 #include "content/common/main_function_params.h" | 27 #include "content/common/main_function_params.h" |
32 #include "content/common/hi_res_timer_manager.h" | 28 #include "content/common/hi_res_timer_manager.h" |
33 #include "content/renderer/render_process_impl.h" | 29 #include "content/renderer/render_process_impl.h" |
34 #include "content/renderer/render_thread.h" | 30 #include "content/renderer/render_thread.h" |
35 #include "grit/generated_resources.h" | 31 #include "content/renderer/renderer_main_platform_delegate.h" |
36 #include "net/base/net_module.h" | |
37 #include "ui/base/system_monitor/system_monitor.h" | 32 #include "ui/base/system_monitor/system_monitor.h" |
38 #include "ui/base/ui_base_switches.h" | 33 #include "ui/base/ui_base_switches.h" |
39 | 34 |
40 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
41 #include <Carbon/Carbon.h> // TISCreateInputSourceList | 36 #include <Carbon/Carbon.h> // TISCreateInputSourceList |
42 | 37 |
43 #include "base/eintr_wrapper.h" | 38 #include "base/eintr_wrapper.h" |
44 #include "base/sys_info.h" | 39 #include "base/sys_info.h" |
45 #include "chrome/app/breakpad_mac.h" | 40 #include "chrome/app/breakpad_mac.h" |
46 #include "third_party/mach_override/mach_override.h" | 41 #include "third_party/mach_override/mach_override.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // locale (at login time for Chrome OS), we have to set the ICU default | 267 // locale (at login time for Chrome OS), we have to set the ICU default |
273 // locale for renderer process here. | 268 // locale for renderer process here. |
274 // ICU locale will be used for fallback font selection etc. | 269 // ICU locale will be used for fallback font selection etc. |
275 if (parsed_command_line.HasSwitch(switches::kLang)) { | 270 if (parsed_command_line.HasSwitch(switches::kLang)) { |
276 const std::string locale = | 271 const std::string locale = |
277 parsed_command_line.GetSwitchValueASCII(switches::kLang); | 272 parsed_command_line.GetSwitchValueASCII(switches::kLang); |
278 base::i18n::SetICUDefaultLocale(locale); | 273 base::i18n::SetICUDefaultLocale(locale); |
279 } | 274 } |
280 #endif | 275 #endif |
281 | 276 |
282 // Configure modules that need access to resources. | |
283 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | |
284 | |
285 // This function allows pausing execution using the --renderer-startup-dialog | 277 // This function allows pausing execution using the --renderer-startup-dialog |
286 // flag allowing us to attach a debugger. | 278 // flag allowing us to attach a debugger. |
287 // Do not move this function down since that would mean we can't easily debug | 279 // Do not move this function down since that would mean we can't easily debug |
288 // whatever occurs before it. | 280 // whatever occurs before it. |
289 HandleRendererErrorTestParameters(parsed_command_line); | 281 HandleRendererErrorTestParameters(parsed_command_line); |
290 | 282 |
291 RendererMainPlatformDelegate platform(parameters); | 283 RendererMainPlatformDelegate platform(parameters); |
292 | 284 |
293 base::StatsScope<base::StatsCounterTimer> | 285 base::StatsScope<base::StatsCounterTimer> |
294 startup_timer(chrome::Counters::renderer_main()); | 286 startup_timer(content::Counters::renderer_main()); |
295 | 287 |
296 RendererMessageLoopObserver task_observer; | 288 RendererMessageLoopObserver task_observer; |
297 #if defined(OS_MACOSX) | 289 #if defined(OS_MACOSX) |
298 // As long as we use Cocoa in the renderer (for the forseeable future as of | 290 // As long as we use Cocoa in the renderer (for the forseeable future as of |
299 // now; see http://crbug.com/13890 for info) we need to have a UI loop. | 291 // now; see http://crbug.com/13890 for info) we need to have a UI loop. |
300 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 292 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
301 #else | 293 #else |
302 // The main message loop of the renderer services doesn't have IO or UI tasks, | 294 // The main message loop of the renderer services doesn't have IO or UI tasks, |
303 // unless in-process-plugins is used. | 295 // unless in-process-plugins is used. |
304 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? | 296 MessageLoop main_message_loop(RenderProcessImpl::InProcessPlugins() ? |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 pool->Recycle(); | 355 pool->Recycle(); |
364 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); | 356 TRACE_EVENT_BEGIN("RendererMain.START_MSG_LOOP", 0, 0); |
365 MessageLoop::current()->Run(); | 357 MessageLoop::current()->Run(); |
366 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); | 358 TRACE_EVENT_END("RendererMain.START_MSG_LOOP", 0, 0); |
367 } | 359 } |
368 } | 360 } |
369 platform.PlatformUninitialize(); | 361 platform.PlatformUninitialize(); |
370 TRACE_EVENT_END("RendererMain", 0, ""); | 362 TRACE_EVENT_END("RendererMain", 0, ""); |
371 return 0; | 363 return 0; |
372 } | 364 } |
OLD | NEW |