OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | |
9 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
10 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
11 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
13 #include "base/metrics/stats_counters.h" | 12 #include "base/metrics/stats_counters.h" |
14 #include "base/path_service.h" | 13 #include "base/path_service.h" |
15 #include "base/process_util.h" | 14 #include "base/process_util.h" |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
17 #include "base/system_monitor/system_monitor.h" | 16 #include "base/system_monitor/system_monitor.h" |
18 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
19 #include "base/time.h" | 18 #include "base/time.h" |
20 #include "content/common/content_counters.h" | 19 #include "content/common/content_counters.h" |
21 #include "content/common/main_function_params.h" | 20 #include "content/common/main_function_params.h" |
22 #include "content/common/hi_res_timer_manager.h" | 21 #include "content/common/hi_res_timer_manager.h" |
23 #include "content/common/pepper_plugin_registry.h" | 22 #include "content/common/pepper_plugin_registry.h" |
24 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
25 #include "content/renderer/render_process_impl.h" | 24 #include "content/renderer/render_process_impl.h" |
26 #include "content/renderer/render_thread_impl.h" | 25 #include "content/renderer/render_thread_impl.h" |
27 #include "content/renderer/renderer_main_platform_delegate.h" | 26 #include "content/renderer/renderer_main_platform_delegate.h" |
28 #include "ui/base/ui_base_switches.h" | 27 #include "ui/base/ui_base_switches.h" |
29 | 28 |
30 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
31 #include <Carbon/Carbon.h> | 30 #include <Carbon/Carbon.h> |
32 #include <signal.h> | 31 #include <signal.h> |
33 #include <unistd.h> | 32 #include <unistd.h> |
34 | 33 |
35 #include "base/mac/mac_util.h" | 34 #include "base/mac/mac_util.h" |
| 35 #include "base/mac/scoped_nsautorelease_pool.h" |
36 #include "third_party/mach_override/mach_override.h" | 36 #include "third_party/mach_override/mach_override.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
38 #endif // OS_MACOSX | 38 #endif // OS_MACOSX |
39 | 39 |
40 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
41 namespace { | 41 namespace { |
42 | 42 |
43 CFArrayRef ChromeTISCreateInputSourceList( | 43 CFArrayRef ChromeTISCreateInputSourceList( |
44 CFDictionaryRef properties, | 44 CFDictionaryRef properties, |
45 Boolean includeAllInstalled) { | 45 Boolean includeAllInstalled) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 private: | 117 private: |
118 base::TimeTicks begin_process_message_; | 118 base::TimeTicks begin_process_message_; |
119 base::Histogram* const process_times_; | 119 base::Histogram* const process_times_; |
120 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); | 120 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
121 }; | 121 }; |
122 | 122 |
123 // mainline routine for running as the Renderer process | 123 // mainline routine for running as the Renderer process |
124 int RendererMain(const MainFunctionParams& parameters) { | 124 int RendererMain(const MainFunctionParams& parameters) { |
125 TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); | 125 TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); |
126 | 126 |
127 const CommandLine& parsed_command_line = parameters.command_line_; | 127 const CommandLine& parsed_command_line = parameters.command_line; |
128 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | |
129 | 128 |
130 #if defined(OS_MACOSX) | 129 #if defined(OS_MACOSX) |
| 130 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool; |
131 InstallFrameworkHacks(); | 131 InstallFrameworkHacks(); |
132 #endif // OS_MACOSX | 132 #endif // OS_MACOSX |
133 | 133 |
134 #if defined(OS_CHROMEOS) | 134 #if defined(OS_CHROMEOS) |
135 // As Zygote process starts up earlier than browser process gets its own | 135 // As Zygote process starts up earlier than browser process gets its own |
136 // locale (at login time for Chrome OS), we have to set the ICU default | 136 // locale (at login time for Chrome OS), we have to set the ICU default |
137 // locale for renderer process here. | 137 // locale for renderer process here. |
138 // ICU locale will be used for fallback font selection etc. | 138 // ICU locale will be used for fallback font selection etc. |
139 if (parsed_command_line.HasSwitch(switches::kLang)) { | 139 if (parsed_command_line.HasSwitch(switches::kLang)) { |
140 const std::string locale = | 140 const std::string locale = |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 215 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
216 RenderProcessImpl render_process; | 216 RenderProcessImpl render_process; |
217 render_process.set_main_thread(new RenderThreadImpl()); | 217 render_process.set_main_thread(new RenderThreadImpl()); |
218 #endif | 218 #endif |
219 | 219 |
220 platform.RunSandboxTests(); | 220 platform.RunSandboxTests(); |
221 | 221 |
222 startup_timer.Stop(); // End of Startup Time Measurement. | 222 startup_timer.Stop(); // End of Startup Time Measurement. |
223 | 223 |
224 if (run_loop) { | 224 if (run_loop) { |
| 225 #if defined(OS_MACOSX) |
225 if (pool) | 226 if (pool) |
226 pool->Recycle(); | 227 pool->Recycle(); |
| 228 #endif |
227 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 229 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
228 MessageLoop::current()->Run(); | 230 MessageLoop::current()->Run(); |
229 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 231 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
230 } | 232 } |
231 } | 233 } |
232 platform.PlatformUninitialize(); | 234 platform.PlatformUninitialize(); |
233 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 235 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
234 return 0; | 236 return 0; |
235 } | 237 } |
OLD | NEW |