| 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" | 15 #include "base/metrics/field_trial.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/statistics_recorder.h" | 17 #include "base/metrics/statistics_recorder.h" |
| 18 #include "base/pending_task.h" | 18 #include "base/pending_task.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
| 21 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
| 22 #include "base/timer/hi_res_timer_manager.h" | 22 #include "base/timer/hi_res_timer_manager.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "components/scheduler/renderer/renderer_scheduler.h" | 25 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 26 #include "content/child/child_process.h" | 26 #include "content/child/child_process.h" |
| 27 #include "content/common/content_constants_internal.h" | 27 #include "content/common/content_constants_internal.h" |
| 28 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 28 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/common/main_function_params.h" | 30 #include "content/public/common/main_function_params.h" |
| 30 #include "content/public/renderer/content_renderer_client.h" | 31 #include "content/public/renderer/content_renderer_client.h" |
| 31 #include "content/renderer/render_process_impl.h" | 32 #include "content/renderer/render_process_impl.h" |
| 32 #include "content/renderer/render_thread_impl.h" | 33 #include "content/renderer/render_thread_impl.h" |
| 33 #include "content/renderer/renderer_main_platform_delegate.h" | 34 #include "content/renderer/renderer_main_platform_delegate.h" |
| 34 #include "third_party/skia/include/core/SkGraphics.h" | 35 #include "third_party/skia/include/core/SkGraphics.h" |
| 35 #include "ui/base/ui_base_switches.h" | 36 #include "ui/base/ui_base_switches.h" |
| 36 | 37 |
| 37 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 #endif | 54 #endif |
| 54 | 55 |
| 55 #if defined(ENABLE_WEBRTC) | 56 #if defined(ENABLE_WEBRTC) |
| 56 #include "third_party/libjingle/overrides/init_webrtc.h" | 57 #include "third_party/libjingle/overrides/init_webrtc.h" |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 #if defined(USE_OZONE) | 60 #if defined(USE_OZONE) |
| 60 #include "ui/ozone/public/client_native_pixmap_factory.h" | 61 #include "ui/ozone/public/client_native_pixmap_factory.h" |
| 61 #endif | 62 #endif |
| 62 | 63 |
| 63 #if defined(MOJO_SHELL_CLIENT) | |
| 64 #include "content/common/mojo/mojo_shell_connection_impl.h" | |
| 65 #endif | |
| 66 | |
| 67 namespace content { | 64 namespace content { |
| 68 namespace { | 65 namespace { |
| 69 // This function provides some ways to test crash and assertion handling | 66 // This function provides some ways to test crash and assertion handling |
| 70 // behavior of the renderer. | 67 // behavior of the renderer. |
| 71 static void HandleRendererErrorTestParameters( | 68 static void HandleRendererErrorTestParameters( |
| 72 const base::CommandLine& command_line) { | 69 const base::CommandLine& command_line) { |
| 73 if (command_line.HasSwitch(switches::kWaitForDebugger)) | 70 if (command_line.HasSwitch(switches::kWaitForDebugger)) |
| 74 base::debug::WaitForDebugger(60, true); | 71 base::debug::WaitForDebugger(60, true); |
| 75 | 72 |
| 76 if (command_line.HasSwitch(switches::kRendererStartupDialog)) | 73 if (command_line.HasSwitch(switches::kRendererStartupDialog)) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't | 86 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't |
| 90 // expect synchronous events around the main loop of a thread. | 87 // expect synchronous events around the main loop of a thread. |
| 91 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); | 88 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); |
| 92 | 89 |
| 93 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); | 90 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); |
| 94 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | 91 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
| 95 kTraceEventRendererProcessSortIndex); | 92 kTraceEventRendererProcessSortIndex); |
| 96 | 93 |
| 97 const base::CommandLine& parsed_command_line = parameters.command_line; | 94 const base::CommandLine& parsed_command_line = parameters.command_line; |
| 98 | 95 |
| 99 #if defined(MOJO_SHELL_CLIENT) | 96 MojoShellConnectionImpl::Create(); |
| 100 if (parsed_command_line.HasSwitch(switches::kEnableMojoShellConnection)) | |
| 101 MojoShellConnectionImpl::Create(); | |
| 102 #endif | |
| 103 | 97 |
| 104 #if defined(OS_MACOSX) | 98 #if defined(OS_MACOSX) |
| 105 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool; | 99 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool; |
| 106 #endif // OS_MACOSX | 100 #endif // OS_MACOSX |
| 107 | 101 |
| 108 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
| 109 // As Zygote process starts up earlier than browser process gets its own | 103 // As Zygote process starts up earlier than browser process gets its own |
| 110 // locale (at login time for Chrome OS), we have to set the ICU default | 104 // locale (at login time for Chrome OS), we have to set the ICU default |
| 111 // locale for renderer process here. | 105 // locale for renderer process here. |
| 112 // ICU locale will be used for fallback font selection etc. | 106 // ICU locale will be used for fallback font selection etc. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // ignore shutdown-only leaks. | 224 // ignore shutdown-only leaks. |
| 231 __lsan_do_leak_check(); | 225 __lsan_do_leak_check(); |
| 232 #endif | 226 #endif |
| 233 } | 227 } |
| 234 platform.PlatformUninitialize(); | 228 platform.PlatformUninitialize(); |
| 235 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); | 229 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); |
| 236 return 0; | 230 return 0; |
| 237 } | 231 } |
| 238 | 232 |
| 239 } // namespace content | 233 } // namespace content |
| OLD | NEW |