Chromium Code Reviews| 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 "chrome/app/chrome_main.h" | 5 #include "chrome/app/chrome_main.h" |
| 6 | 6 |
| 7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.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 16 matching lines...) Expand all Loading... | |
| 27 #include "chrome/common/chrome_content_client.h" | 27 #include "chrome/common/chrome_content_client.h" |
| 28 #include "chrome/common/chrome_content_plugin_client.h" | 28 #include "chrome/common/chrome_content_plugin_client.h" |
| 29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 30 #include "chrome/common/chrome_paths_internal.h" | 30 #include "chrome/common/chrome_paths_internal.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/chrome_version_info.h" | 32 #include "chrome/common/chrome_version_info.h" |
| 33 #include "chrome/common/logging_chrome.h" | 33 #include "chrome/common/logging_chrome.h" |
| 34 #include "chrome/common/profiling.h" | 34 #include "chrome/common/profiling.h" |
| 35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 36 #include "chrome/renderer/chrome_content_renderer_client.h" | 36 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 37 #include "chrome/worker/chrome_content_worker_client.h" | |
| 37 #include "content/browser/renderer_host/render_process_host.h" | 38 #include "content/browser/renderer_host/render_process_host.h" |
| 38 #include "content/common/content_client.h" | 39 #include "content/common/content_client.h" |
| 39 #include "content/common/content_counters.h" | 40 #include "content/common/content_counters.h" |
| 40 #include "content/common/content_paths.h" | 41 #include "content/common/content_paths.h" |
| 41 #include "content/common/main_function_params.h" | 42 #include "content/common/main_function_params.h" |
| 42 #include "content/common/sandbox_init_wrapper.h" | 43 #include "content/common/sandbox_init_wrapper.h" |
| 43 #include "content/common/set_process_title.h" | 44 #include "content/common/set_process_title.h" |
| 44 #include "ipc/ipc_switches.h" | 45 #include "ipc/ipc_switches.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/base/ui_base_paths.h" | 47 #include "ui/base/ui_base_paths.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // Enable the heap profiler if the appropriate command-line switch is | 212 // Enable the heap profiler if the appropriate command-line switch is |
| 212 // present, bailing out of the app we can't. | 213 // present, bailing out of the app we can't. |
| 213 void EnableHeapProfiler(const CommandLine& command_line) { | 214 void EnableHeapProfiler(const CommandLine& command_line) { |
| 214 #if defined(OS_WIN) | 215 #if defined(OS_WIN) |
| 215 if (command_line.HasSwitch(switches::kMemoryProfiling)) | 216 if (command_line.HasSwitch(switches::kMemoryProfiling)) |
| 216 if (!LoadMemoryProfiler()) | 217 if (!LoadMemoryProfiler()) |
| 217 exit(-1); | 218 exit(-1); |
| 218 #endif | 219 #endif |
| 219 } | 220 } |
| 220 | 221 |
| 222 void InitializeChromeContentWorkerClient() { | |
| 223 static chrome::ChromeContentWorkerClient chrome_content_worker_client; | |
| 224 content::GetContentClient()->set_worker(&chrome_content_worker_client); | |
| 225 } | |
| 226 | |
| 221 void InitializeChromeContentRendererClient() { | 227 void InitializeChromeContentRendererClient() { |
| 222 #if !defined(NACL_WIN64) // We don't build the renderer code on win nacl64. | 228 #if !defined(NACL_WIN64) // We don't build the renderer code on win nacl64. |
| 223 static chrome::ChromeContentRendererClient chrome_content_renderer_client; | 229 static chrome::ChromeContentRendererClient chrome_content_renderer_client; |
| 224 content::GetContentClient()->set_renderer(&chrome_content_renderer_client); | 230 content::GetContentClient()->set_renderer(&chrome_content_renderer_client); |
| 225 #endif | 231 #endif |
| 232 InitializeChromeContentWorkerClient(); | |
|
jam
2011/05/24 20:21:31
so far, by design we only have one process getter
yurys
2011/05/25 17:28:29
I deleted ContentWorkerClient completely since it'
| |
| 226 } | 233 } |
| 227 | 234 |
| 228 void InitializeChromeContentClient(const std::string& process_type) { | 235 void InitializeChromeContentClient(const std::string& process_type) { |
| 229 if (process_type == switches::kPluginProcess) { | 236 if (process_type == switches::kPluginProcess) { |
| 230 static chrome::ChromeContentPluginClient chrome_content_plugin_client; | 237 static chrome::ChromeContentPluginClient chrome_content_plugin_client; |
| 231 content::GetContentClient()->set_plugin(&chrome_content_plugin_client); | 238 content::GetContentClient()->set_plugin(&chrome_content_plugin_client); |
| 232 } else if (process_type == switches::kRendererProcess || | 239 } else if (process_type == switches::kRendererProcess || |
| 233 process_type == switches::kExtensionProcess) { | 240 process_type == switches::kExtensionProcess) { |
| 234 InitializeChromeContentRendererClient(); | 241 InitializeChromeContentRendererClient(); |
| 242 } else if (process_type == switches::kWorkerProcess) { | |
| 243 InitializeChromeContentWorkerClient(); | |
| 235 } | 244 } |
| 236 } | 245 } |
| 237 | 246 |
| 238 void CommonSubprocessInit(const std::string& process_type) { | 247 void CommonSubprocessInit(const std::string& process_type) { |
| 239 #if defined(OS_WIN) | 248 #if defined(OS_WIN) |
| 240 // HACK: Let Windows know that we have started. This is needed to suppress | 249 // HACK: Let Windows know that we have started. This is needed to suppress |
| 241 // the IDC_APPSTARTING cursor from being displayed for a prolonged period | 250 // the IDC_APPSTARTING cursor from being displayed for a prolonged period |
| 242 // while a subprocess is starting. | 251 // while a subprocess is starting. |
| 243 PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); | 252 PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); |
| 244 MSG msg; | 253 MSG msg; |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 | 825 |
| 817 if (SubprocessNeedsResourceBundle(process_type)) | 826 if (SubprocessNeedsResourceBundle(process_type)) |
| 818 ResourceBundle::CleanupSharedInstance(); | 827 ResourceBundle::CleanupSharedInstance(); |
| 819 | 828 |
| 820 logging::CleanupChromeLogging(); | 829 logging::CleanupChromeLogging(); |
| 821 | 830 |
| 822 chrome_main::LowLevelShutdown(); | 831 chrome_main::LowLevelShutdown(); |
| 823 | 832 |
| 824 return exit_code; | 833 return exit_code; |
| 825 } | 834 } |
| OLD | NEW |