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" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 static void HandleRendererErrorTestParameters( | 68 static void HandleRendererErrorTestParameters( |
69 const base::CommandLine& command_line) { | 69 const base::CommandLine& command_line) { |
70 if (command_line.HasSwitch(switches::kWaitForDebugger)) | 70 if (command_line.HasSwitch(switches::kWaitForDebugger)) |
71 base::debug::WaitForDebugger(60, true); | 71 base::debug::WaitForDebugger(60, true); |
72 | 72 |
73 if (command_line.HasSwitch(switches::kRendererStartupDialog)) | 73 if (command_line.HasSwitch(switches::kRendererStartupDialog)) |
74 ChildProcess::WaitForDebugger("Renderer"); | 74 ChildProcess::WaitForDebugger("Renderer"); |
75 } | 75 } |
76 | 76 |
77 #if defined(USE_OZONE) | 77 #if defined(USE_OZONE) |
78 base::LazyInstance<scoped_ptr<ui::ClientNativePixmapFactory>> g_pixmap_factory = | 78 base::LazyInstance<std::unique_ptr<ui::ClientNativePixmapFactory>> |
79 LAZY_INSTANCE_INITIALIZER; | 79 g_pixmap_factory = LAZY_INSTANCE_INITIALIZER; |
80 #endif | 80 #endif |
81 | 81 |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 // mainline routine for running as the Renderer process | 84 // mainline routine for running as the Renderer process |
85 int RendererMain(const MainFunctionParams& parameters) { | 85 int RendererMain(const MainFunctionParams& parameters) { |
86 // 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 |
87 // expect synchronous events around the main loop of a thread. | 87 // expect synchronous events around the main loop of a thread. |
88 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); | 88 TRACE_EVENT_ASYNC_BEGIN0("startup", "RendererMain", 0); |
89 | 89 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // flag allowing us to attach a debugger. | 128 // flag allowing us to attach a debugger. |
129 // Do not move this function down since that would mean we can't easily debug | 129 // Do not move this function down since that would mean we can't easily debug |
130 // whatever occurs before it. | 130 // whatever occurs before it. |
131 HandleRendererErrorTestParameters(parsed_command_line); | 131 HandleRendererErrorTestParameters(parsed_command_line); |
132 | 132 |
133 RendererMainPlatformDelegate platform(parameters); | 133 RendererMainPlatformDelegate platform(parameters); |
134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
135 // As long as scrollbars on Mac are painted with Cocoa, the message pump | 135 // As long as scrollbars on Mac are painted with Cocoa, the message pump |
136 // needs to be backed by a Foundation-level loop to process NSTimers. See | 136 // needs to be backed by a Foundation-level loop to process NSTimers. See |
137 // http://crbug.com/306348#c24 for details. | 137 // http://crbug.com/306348#c24 for details. |
138 scoped_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop()); | 138 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpNSRunLoop()); |
139 scoped_ptr<base::MessageLoop> main_message_loop( | 139 std::unique_ptr<base::MessageLoop> main_message_loop( |
140 new base::MessageLoop(std::move(pump))); | 140 new base::MessageLoop(std::move(pump))); |
141 #else | 141 #else |
142 // The main message loop of the renderer services doesn't have IO or UI tasks. | 142 // The main message loop of the renderer services doesn't have IO or UI tasks. |
143 scoped_ptr<base::MessageLoop> main_message_loop(new base::MessageLoop()); | 143 std::unique_ptr<base::MessageLoop> main_message_loop(new base::MessageLoop()); |
144 #endif | 144 #endif |
145 | 145 |
146 base::PlatformThread::SetName("CrRendererMain"); | 146 base::PlatformThread::SetName("CrRendererMain"); |
147 | 147 |
148 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 148 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
149 | 149 |
150 // Initialize histogram statistics gathering system. | 150 // Initialize histogram statistics gathering system. |
151 base::StatisticsRecorder::Initialize(); | 151 base::StatisticsRecorder::Initialize(); |
152 | 152 |
153 #if defined(OS_ANDROID) | 153 #if defined(OS_ANDROID) |
154 // If we have a pending chromium android linker histogram, record it. | 154 // If we have a pending chromium android linker histogram, record it. |
155 base::android::RecordChromiumAndroidLinkerRendererHistogram(); | 155 base::android::RecordChromiumAndroidLinkerRendererHistogram(); |
156 #endif | 156 #endif |
157 | 157 |
158 // Initialize statistical testing infrastructure. We set the entropy provider | 158 // Initialize statistical testing infrastructure. We set the entropy provider |
159 // to NULL to disallow the renderer process from creating its own one-time | 159 // to NULL to disallow the renderer process from creating its own one-time |
160 // randomized trials; they should be created in the browser process. | 160 // randomized trials; they should be created in the browser process. |
161 base::FieldTrialList field_trial_list(NULL); | 161 base::FieldTrialList field_trial_list(NULL); |
162 // Ensure any field trials in browser are reflected into renderer. | 162 // Ensure any field trials in browser are reflected into renderer. |
163 if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { | 163 if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { |
164 bool result = base::FieldTrialList::CreateTrialsFromString( | 164 bool result = base::FieldTrialList::CreateTrialsFromString( |
165 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), | 165 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
166 std::set<std::string>()); | 166 std::set<std::string>()); |
167 DCHECK(result); | 167 DCHECK(result); |
168 } | 168 } |
169 | 169 |
170 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); | 170 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
171 feature_list->InitializeFromCommandLine( | 171 feature_list->InitializeFromCommandLine( |
172 parsed_command_line.GetSwitchValueASCII(switches::kEnableFeatures), | 172 parsed_command_line.GetSwitchValueASCII(switches::kEnableFeatures), |
173 parsed_command_line.GetSwitchValueASCII(switches::kDisableFeatures)); | 173 parsed_command_line.GetSwitchValueASCII(switches::kDisableFeatures)); |
174 base::FeatureList::SetInstance(std::move(feature_list)); | 174 base::FeatureList::SetInstance(std::move(feature_list)); |
175 | 175 |
176 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler( | 176 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler( |
177 scheduler::RendererScheduler::Create()); | 177 scheduler::RendererScheduler::Create()); |
178 | 178 |
179 // PlatformInitialize uses FieldTrials, so this must happen later. | 179 // PlatformInitialize uses FieldTrials, so this must happen later. |
180 platform.PlatformInitialize(); | 180 platform.PlatformInitialize(); |
181 | 181 |
182 #if defined(ENABLE_PLUGINS) | 182 #if defined(ENABLE_PLUGINS) |
183 // Load pepper plugins before engaging the sandbox. | 183 // Load pepper plugins before engaging the sandbox. |
184 PepperPluginRegistry::GetInstance(); | 184 PepperPluginRegistry::GetInstance(); |
185 #endif | 185 #endif |
186 #if defined(ENABLE_WEBRTC) | 186 #if defined(ENABLE_WEBRTC) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // ignore shutdown-only leaks. | 227 // ignore shutdown-only leaks. |
228 __lsan_do_leak_check(); | 228 __lsan_do_leak_check(); |
229 #endif | 229 #endif |
230 } | 230 } |
231 platform.PlatformUninitialize(); | 231 platform.PlatformUninitialize(); |
232 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); | 232 TRACE_EVENT_ASYNC_END0("startup", "RendererMain", 0); |
233 return 0; | 233 return 0; |
234 } | 234 } |
235 | 235 |
236 } // namespace content | 236 } // namespace content |
OLD | NEW |