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 "content/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 NOTREACHED(); | 158 NOTREACHED(); |
159 } | 159 } |
160 } | 160 } |
161 #endif // defined(OS_WIN) | 161 #endif // defined(OS_WIN) |
162 } // namespace | 162 } // namespace |
163 | 163 |
164 namespace content { | 164 namespace content { |
165 | 165 |
166 base::LazyInstance<ContentBrowserClient> | 166 base::LazyInstance<ContentBrowserClient> |
167 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 167 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
168 #if !defined(OS_IOS) | 168 #if !defined(OS_IOS) && \ |
| 169 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD)) |
169 base::LazyInstance<ContentPluginClient> | 170 base::LazyInstance<ContentPluginClient> |
170 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 171 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
171 base::LazyInstance<ContentRendererClient> | 172 base::LazyInstance<ContentRendererClient> |
172 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 173 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
173 base::LazyInstance<ContentUtilityClient> | 174 base::LazyInstance<ContentUtilityClient> |
174 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 175 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
175 #endif // !OS_IOS | 176 #endif // !OS_IOS |
176 | 177 |
177 #if defined(OS_WIN) | 178 #if defined(OS_WIN) |
178 | 179 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 static void Set(const std::string& process_type, | 286 static void Set(const std::string& process_type, |
286 ContentMainDelegate* delegate) { | 287 ContentMainDelegate* delegate) { |
287 ContentClient* content_client = GetContentClient(); | 288 ContentClient* content_client = GetContentClient(); |
288 if (process_type.empty()) { | 289 if (process_type.empty()) { |
289 if (delegate) | 290 if (delegate) |
290 content_client->browser_ = delegate->CreateContentBrowserClient(); | 291 content_client->browser_ = delegate->CreateContentBrowserClient(); |
291 if (!content_client->browser_) | 292 if (!content_client->browser_) |
292 content_client->browser_ = &g_empty_content_browser_client.Get(); | 293 content_client->browser_ = &g_empty_content_browser_client.Get(); |
293 } | 294 } |
294 | 295 |
295 #if !defined(OS_IOS) | 296 #if !defined(OS_IOS) && \ |
| 297 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD)) |
296 if (process_type == switches::kPluginProcess || | 298 if (process_type == switches::kPluginProcess || |
297 process_type == switches::kPpapiPluginProcess) { | 299 process_type == switches::kPpapiPluginProcess) { |
298 if (delegate) | 300 if (delegate) |
299 content_client->plugin_ = delegate->CreateContentPluginClient(); | 301 content_client->plugin_ = delegate->CreateContentPluginClient(); |
300 if (!content_client->plugin_) | 302 if (!content_client->plugin_) |
301 content_client->plugin_ = &g_empty_content_plugin_client.Get(); | 303 content_client->plugin_ = &g_empty_content_plugin_client.Get(); |
302 // Single process not supported in split dll mode. | 304 // Single process not supported in split dll mode. |
303 } else if (process_type == switches::kRendererProcess || | 305 } else if (process_type == switches::kRendererProcess || |
304 CommandLine::ForCurrentProcess()->HasSwitch( | 306 CommandLine::ForCurrentProcess()->HasSwitch( |
305 switches::kSingleProcess)) { | 307 switches::kSingleProcess)) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 401 |
400 #if !defined(OS_IOS) | 402 #if !defined(OS_IOS) |
401 // Run the FooMain() for a given process type. | 403 // Run the FooMain() for a given process type. |
402 // If |process_type| is empty, runs BrowserMain(). | 404 // If |process_type| is empty, runs BrowserMain(). |
403 // Returns the exit code for this process. | 405 // Returns the exit code for this process. |
404 int RunNamedProcessTypeMain( | 406 int RunNamedProcessTypeMain( |
405 const std::string& process_type, | 407 const std::string& process_type, |
406 const MainFunctionParams& main_function_params, | 408 const MainFunctionParams& main_function_params, |
407 ContentMainDelegate* delegate) { | 409 ContentMainDelegate* delegate) { |
408 static const MainFunction kMainFunctions[] = { | 410 static const MainFunction kMainFunctions[] = { |
| 411 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_BROWSER) |
409 { "", BrowserMain }, | 412 { "", BrowserMain }, |
| 413 #endif |
| 414 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD) |
410 #if defined(ENABLE_PLUGINS) | 415 #if defined(ENABLE_PLUGINS) |
411 { switches::kPluginProcess, PluginMain }, | 416 { switches::kPluginProcess, PluginMain }, |
412 { switches::kWorkerProcess, WorkerMain }, | 417 { switches::kWorkerProcess, WorkerMain }, |
413 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 418 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
414 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, | 419 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, |
415 #endif | 420 #endif // ENABLE_PLUGINS |
416 { switches::kUtilityProcess, UtilityMain }, | 421 { switches::kUtilityProcess, UtilityMain }, |
417 { switches::kRendererProcess, RendererMain }, | 422 { switches::kRendererProcess, RendererMain }, |
418 { switches::kGpuProcess, GpuMain }, | 423 { switches::kGpuProcess, GpuMain }, |
| 424 #endif // !CHROME_MULTIPLE_DLL || CHROME_MULTIPLE_DLL_CHILD |
419 }; | 425 }; |
420 | 426 |
421 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 427 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
422 if (process_type == kMainFunctions[i].name) { | 428 if (process_type == kMainFunctions[i].name) { |
423 if (delegate) { | 429 if (delegate) { |
424 int exit_code = delegate->RunProcess(process_type, | 430 int exit_code = delegate->RunProcess(process_type, |
425 main_function_params); | 431 main_function_params); |
426 #if defined(OS_ANDROID) | 432 #if defined(OS_ANDROID) |
427 // In Android's browser process, the negative exit code doesn't mean the | 433 // In Android's browser process, the negative exit code doesn't mean the |
428 // default behavior should be used as the UI message loop is managed by | 434 // default behavior should be used as the UI message loop is managed by |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 821 |
816 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 822 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
817 }; | 823 }; |
818 | 824 |
819 // static | 825 // static |
820 ContentMainRunner* ContentMainRunner::Create() { | 826 ContentMainRunner* ContentMainRunner::Create() { |
821 return new ContentMainRunnerImpl(); | 827 return new ContentMainRunnerImpl(); |
822 } | 828 } |
823 | 829 |
824 } // namespace content | 830 } // namespace content |
OLD | NEW |