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/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/timer/hi_res_timer_manager.h" | 23 #include "base/timer/hi_res_timer_manager.h" |
24 #include "content/child/child_process.h" | 24 #include "content/child/child_process.h" |
25 #include "content/common/content_constants_internal.h" | 25 #include "content/common/content_constants_internal.h" |
26 #include "content/common/pepper_plugin_registry.h" | 26 #include "content/common/pepper_plugin_registry.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/main_function_params.h" | 28 #include "content/public/common/main_function_params.h" |
29 #include "content/public/renderer/content_renderer_client.h" | 29 #include "content/public/renderer/content_renderer_client.h" |
30 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" | 30 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
| 31 #include "content/renderer/pepper/ppapi_interface_factory.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 "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
35 #include "webkit/child/webkit_child_helpers.h" | 36 #include "webkit/child/webkit_child_helpers.h" |
36 #include "webkit/glue/webkit_glue.h" | 37 #include "webkit/glue/webkit_glue.h" |
37 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" | |
38 | 38 |
39 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
40 #include <Carbon/Carbon.h> | 40 #include <Carbon/Carbon.h> |
41 #include <signal.h> | 41 #include <signal.h> |
42 #include <unistd.h> | 42 #include <unistd.h> |
43 | 43 |
44 #include "base/mac/mac_util.h" | 44 #include "base/mac/mac_util.h" |
45 #include "base/mac/scoped_nsautorelease_pool.h" | 45 #include "base/mac/scoped_nsautorelease_pool.h" |
46 #include "third_party/WebKit/public/web/WebView.h" | 46 #include "third_party/WebKit/public/web/WebView.h" |
47 #endif // OS_MACOSX | 47 #endif // OS_MACOSX |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 #endif | 141 #endif |
142 | 142 |
143 // This function allows pausing execution using the --renderer-startup-dialog | 143 // This function allows pausing execution using the --renderer-startup-dialog |
144 // flag allowing us to attach a debugger. | 144 // flag allowing us to attach a debugger. |
145 // Do not move this function down since that would mean we can't easily debug | 145 // Do not move this function down since that would mean we can't easily debug |
146 // whatever occurs before it. | 146 // whatever occurs before it. |
147 HandleRendererErrorTestParameters(parsed_command_line); | 147 HandleRendererErrorTestParameters(parsed_command_line); |
148 | 148 |
149 RendererMainPlatformDelegate platform(parameters); | 149 RendererMainPlatformDelegate platform(parameters); |
150 | 150 |
151 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager = | |
152 webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance(); | |
153 factory_manager->RegisterFactory(ContentPPAPIInterfaceFactory); | |
154 | 151 |
155 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); | 152 base::StatsCounterTimer stats_counter_timer("Content.RendererInit"); |
156 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); | 153 base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer); |
157 | 154 |
158 RendererMessageLoopObserver task_observer; | 155 RendererMessageLoopObserver task_observer; |
159 #if defined(OS_MACOSX) | 156 #if defined(OS_MACOSX) |
160 // As long as we use Cocoa in the renderer (for the forseeable future as of | 157 // As long as we use Cocoa in the renderer (for the forseeable future as of |
161 // now; see http://crbug.com/13890 for info) we need to have a UI loop. | 158 // now; see http://crbug.com/13890 for info) we need to have a UI loop. |
162 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 159 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
163 #else | 160 #else |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 switches::kForceFieldTrials); | 195 switches::kForceFieldTrials); |
199 // Field trials are created in an "activated" state to ensure they get | 196 // Field trials are created in an "activated" state to ensure they get |
200 // reported in crash reports. | 197 // reported in crash reports. |
201 bool result = base::FieldTrialList::CreateTrialsFromString( | 198 bool result = base::FieldTrialList::CreateTrialsFromString( |
202 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), | 199 parsed_command_line.GetSwitchValueASCII(switches::kForceFieldTrials), |
203 base::FieldTrialList::ACTIVATE_TRIALS); | 200 base::FieldTrialList::ACTIVATE_TRIALS); |
204 DCHECK(result); | 201 DCHECK(result); |
205 } | 202 } |
206 | 203 |
207 #if defined(ENABLE_PLUGINS) | 204 #if defined(ENABLE_PLUGINS) |
| 205 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager = |
| 206 webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance(); |
| 207 factory_manager->RegisterFactory(ContentPPAPIInterfaceFactory); |
| 208 |
208 // Load pepper plugins before engaging the sandbox. | 209 // Load pepper plugins before engaging the sandbox. |
209 PepperPluginRegistry::GetInstance(); | 210 PepperPluginRegistry::GetInstance(); |
210 #endif | 211 #endif |
211 #if defined(ENABLE_WEBRTC) | 212 #if defined(ENABLE_WEBRTC) |
212 // Initialize WebRTC before engaging the sandbox. | 213 // Initialize WebRTC before engaging the sandbox. |
213 // NOTE: On linux, this call could already have been made from | 214 // NOTE: On linux, this call could already have been made from |
214 // zygote_main_linux.cc. However, calling multiple times from the same thread | 215 // zygote_main_linux.cc. However, calling multiple times from the same thread |
215 // is OK. | 216 // is OK. |
216 InitializeWebRtcModule(); | 217 InitializeWebRtcModule(); |
217 #endif | 218 #endif |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 base::MessageLoop::current()->Run(); | 254 base::MessageLoop::current()->Run(); |
254 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 255 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
255 } | 256 } |
256 } | 257 } |
257 platform.PlatformUninitialize(); | 258 platform.PlatformUninitialize(); |
258 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 259 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
259 return 0; | 260 return 0; |
260 } | 261 } |
261 | 262 |
262 } // namespace content | 263 } // namespace content |
OLD | NEW |