Chromium Code Reviews| 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/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 #endif // OS_MACOSX | 45 #endif // OS_MACOSX |
| 46 | 46 |
| 47 #if defined(ENABLE_PLUGINS) | 47 #if defined(ENABLE_PLUGINS) |
| 48 #include "content/renderer/pepper/pepper_plugin_registry.h" | 48 #include "content/renderer/pepper/pepper_plugin_registry.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(ENABLE_WEBRTC) | 51 #if defined(ENABLE_WEBRTC) |
| 52 #include "third_party/libjingle/overrides/init_webrtc.h" | 52 #include "third_party/libjingle/overrides/init_webrtc.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 #if defined(USE_OZONE) | |
| 56 #include "ui/ozone/public/client_native_pixmap_factory.h" | |
| 57 #endif | |
| 58 | |
| 55 namespace content { | 59 namespace content { |
| 56 namespace { | 60 namespace { |
| 57 // This function provides some ways to test crash and assertion handling | 61 // This function provides some ways to test crash and assertion handling |
| 58 // behavior of the renderer. | 62 // behavior of the renderer. |
| 59 static void HandleRendererErrorTestParameters( | 63 static void HandleRendererErrorTestParameters( |
| 60 const base::CommandLine& command_line) { | 64 const base::CommandLine& command_line) { |
| 61 if (command_line.HasSwitch(switches::kWaitForDebugger)) | 65 if (command_line.HasSwitch(switches::kWaitForDebugger)) |
| 62 base::debug::WaitForDebugger(60, true); | 66 base::debug::WaitForDebugger(60, true); |
| 63 | 67 |
| 64 if (command_line.HasSwitch(switches::kRendererStartupDialog)) | 68 if (command_line.HasSwitch(switches::kRendererStartupDialog)) |
| 65 ChildProcess::WaitForDebugger("Renderer"); | 69 ChildProcess::WaitForDebugger("Renderer"); |
| 66 } | 70 } |
| 67 | 71 |
| 72 #if defined(USE_OZONE) | |
| 73 base::LazyInstance<scoped_ptr<ui::ClientNativePixmapFactory>> g_pixmap_factory = | |
| 74 LAZY_INSTANCE_INITIALIZER; | |
| 75 #endif | |
| 76 | |
| 68 } // namespace | 77 } // namespace |
| 69 | 78 |
| 70 // mainline routine for running as the Renderer process | 79 // mainline routine for running as the Renderer process |
| 71 int RendererMain(const MainFunctionParams& parameters) { | 80 int RendererMain(const MainFunctionParams& parameters) { |
| 72 TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); | 81 TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); |
| 73 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); | 82 base::trace_event::TraceLog::GetInstance()->SetProcessName("Renderer"); |
| 74 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | 83 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
| 75 kTraceEventRendererProcessSortIndex); | 84 kTraceEventRendererProcessSortIndex); |
| 76 | 85 |
| 77 const base::CommandLine& parsed_command_line = parameters.command_line; | 86 const base::CommandLine& parsed_command_line = parameters.command_line; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 93 #endif | 102 #endif |
| 94 | 103 |
| 95 SkGraphics::Init(); | 104 SkGraphics::Init(); |
| 96 #if defined(OS_ANDROID) | 105 #if defined(OS_ANDROID) |
| 97 const int kMB = 1024 * 1024; | 106 const int kMB = 1024 * 1024; |
| 98 size_t font_cache_limit = | 107 size_t font_cache_limit = |
| 99 base::SysInfo::IsLowEndDevice() ? kMB : 8 * kMB; | 108 base::SysInfo::IsLowEndDevice() ? kMB : 8 * kMB; |
| 100 SkGraphics::SetFontCacheLimit(font_cache_limit); | 109 SkGraphics::SetFontCacheLimit(font_cache_limit); |
| 101 #endif | 110 #endif |
| 102 | 111 |
| 112 #if defined(USE_OZONE) | |
| 113 g_pixmap_factory.Get() = ui::ClientNativePixmapFactory::Create(); | |
| 114 ui::ClientNativePixmapFactory::SetInstance(g_pixmap_factory.Get().get()); | |
|
dshwang
2015/08/05 12:11:50
you are right. It's not yet completely switched to
| |
| 115 #endif | |
| 116 | |
| 103 // This function allows pausing execution using the --renderer-startup-dialog | 117 // This function allows pausing execution using the --renderer-startup-dialog |
| 104 // flag allowing us to attach a debugger. | 118 // flag allowing us to attach a debugger. |
| 105 // Do not move this function down since that would mean we can't easily debug | 119 // Do not move this function down since that would mean we can't easily debug |
| 106 // whatever occurs before it. | 120 // whatever occurs before it. |
| 107 HandleRendererErrorTestParameters(parsed_command_line); | 121 HandleRendererErrorTestParameters(parsed_command_line); |
| 108 | 122 |
| 109 RendererMainPlatformDelegate platform(parameters); | 123 RendererMainPlatformDelegate platform(parameters); |
| 110 #if defined(OS_MACOSX) | 124 #if defined(OS_MACOSX) |
| 111 // As long as scrollbars on Mac are painted with Cocoa, the message pump | 125 // As long as scrollbars on Mac are painted with Cocoa, the message pump |
| 112 // needs to be backed by a Foundation-level loop to process NSTimers. See | 126 // needs to be backed by a Foundation-level loop to process NSTimers. See |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 // ignore shutdown-only leaks. | 216 // ignore shutdown-only leaks. |
| 203 __lsan_do_leak_check(); | 217 __lsan_do_leak_check(); |
| 204 #endif | 218 #endif |
| 205 } | 219 } |
| 206 platform.PlatformUninitialize(); | 220 platform.PlatformUninitialize(); |
| 207 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 221 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
| 208 return 0; | 222 return 0; |
| 209 } | 223 } |
| 210 | 224 |
| 211 } // namespace content | 225 } // namespace content |
| OLD | NEW |