| 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/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 #if defined(USE_OZONE) | 72 #if defined(USE_OZONE) |
| 73 base::LazyInstance<scoped_ptr<ui::ClientNativePixmapFactory>> g_pixmap_factory = | 73 base::LazyInstance<scoped_ptr<ui::ClientNativePixmapFactory>> g_pixmap_factory = |
| 74 LAZY_INSTANCE_INITIALIZER; | 74 LAZY_INSTANCE_INITIALIZER; |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| 79 // mainline routine for running as the Renderer process | 79 // mainline routine for running as the Renderer process |
| 80 int RendererMain(const MainFunctionParams& parameters) { | 80 int RendererMain(const MainFunctionParams& parameters) { |
| 81 TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); | 81 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't |
| 82 // expect synchronous events around the main loop of a thread. |
| 83 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); |
| 84 |
| 82 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); | 85 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); |
| 83 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | 86 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
| 84 kTraceEventRendererProcessSortIndex); | 87 kTraceEventRendererProcessSortIndex); |
| 85 | 88 |
| 86 const base::CommandLine& parsed_command_line = parameters.command_line; | 89 const base::CommandLine& parsed_command_line = parameters.command_line; |
| 87 | 90 |
| 88 #if defined(OS_MACOSX) | 91 #if defined(OS_MACOSX) |
| 89 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool; | 92 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool; |
| 90 #endif // OS_MACOSX | 93 #endif // OS_MACOSX |
| 91 | 94 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 RenderThreadImpl::Create(main_message_loop.Pass(), | 200 RenderThreadImpl::Create(main_message_loop.Pass(), |
| 198 renderer_scheduler.Pass()); | 201 renderer_scheduler.Pass()); |
| 199 #endif | 202 #endif |
| 200 base::HighResolutionTimerManager hi_res_timer_manager; | 203 base::HighResolutionTimerManager hi_res_timer_manager; |
| 201 | 204 |
| 202 if (run_loop) { | 205 if (run_loop) { |
| 203 #if defined(OS_MACOSX) | 206 #if defined(OS_MACOSX) |
| 204 if (pool) | 207 if (pool) |
| 205 pool->Recycle(); | 208 pool->Recycle(); |
| 206 #endif | 209 #endif |
| 207 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 210 TRACE_EVENT_ASYNC_BEGIN0("toplevel", "RendererMain.START_MSG_LOOP", 0); |
| 208 base::MessageLoop::current()->Run(); | 211 base::MessageLoop::current()->Run(); |
| 209 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 212 TRACE_EVENT_ASYNC_END0("toplevel", "RendererMain.START_MSG_LOOP", 0); |
| 210 } | 213 } |
| 211 #if defined(LEAK_SANITIZER) | 214 #if defined(LEAK_SANITIZER) |
| 212 // Run leak detection before RenderProcessImpl goes out of scope. This helps | 215 // Run leak detection before RenderProcessImpl goes out of scope. This helps |
| 213 // ignore shutdown-only leaks. | 216 // ignore shutdown-only leaks. |
| 214 __lsan_do_leak_check(); | 217 __lsan_do_leak_check(); |
| 215 #endif | 218 #endif |
| 216 } | 219 } |
| 217 platform.PlatformUninitialize(); | 220 platform.PlatformUninitialize(); |
| 218 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 221 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); |
| 219 return 0; | 222 return 0; |
| 220 } | 223 } |
| 221 | 224 |
| 222 } // namespace content | 225 } // namespace content |
| OLD | NEW |