Chromium Code Reviews| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 | 399 |
| 400 if (delegate) | 400 if (delegate) |
| 401 return delegate->RunProcess(process_type, main_params); | 401 return delegate->RunProcess(process_type, main_params); |
| 402 | 402 |
| 403 NOTREACHED() << "Unknown zygote process type: " << process_type; | 403 NOTREACHED() << "Unknown zygote process type: " << process_type; |
| 404 return 1; | 404 return 1; |
| 405 } | 405 } |
| 406 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 406 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 407 | 407 |
| 408 #if !defined(OS_IOS) | 408 #if !defined(OS_IOS) |
| 409 static void RegisterMainThreadFactories() { | |
| 410 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | |
| 411 UtilityProcessHost::RegisterUtilityMainThreadFactory( | |
| 412 CreateInProcessUtilityThread); | |
| 413 RenderProcessHost::RegisterRendererMainThreadFactory( | |
| 414 CreateInProcessRendererThread); | |
| 415 GpuProcessHost::RegisterGpuMainThreadFactory( | |
| 416 CreateInProcessGpuThread); | |
| 417 #else | |
| 418 CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 419 if (command_line.HasSwitch(switches::kSingleProcess)) { | |
| 420 command_line.RemoveSwitch(switches::kSingleProcess); | |
| 421 LOG(ERROR) << | |
| 422 "--single-process is not supported in chrome multiple dll browser."; | |
|
Nico
2013/11/19 00:35:16
Can't you just LOG(FATAL)?
dshwang
2013/11/19 11:12:01
piman@ mentioned in https://codereview.chromium.or
piman
2013/11/19 20:35:57
I'm ok with a LOG(FATAL) here, that explains what'
| |
| 423 } | |
| 424 if (command_line.HasSwitch(switches::kInProcessGPU)) { | |
| 425 command_line.RemoveSwitch(switches::kInProcessGPU); | |
| 426 LOG(ERROR) << | |
| 427 "--in-process-gpu is not supported in chrome multiple dll browser."; | |
| 428 } | |
| 429 #endif | |
| 430 } | |
| 431 | |
| 409 // Run the FooMain() for a given process type. | 432 // Run the FooMain() for a given process type. |
| 410 // If |process_type| is empty, runs BrowserMain(). | 433 // If |process_type| is empty, runs BrowserMain(). |
| 411 // Returns the exit code for this process. | 434 // Returns the exit code for this process. |
| 412 int RunNamedProcessTypeMain( | 435 int RunNamedProcessTypeMain( |
| 413 const std::string& process_type, | 436 const std::string& process_type, |
| 414 const MainFunctionParams& main_function_params, | 437 const MainFunctionParams& main_function_params, |
| 415 ContentMainDelegate* delegate) { | 438 ContentMainDelegate* delegate) { |
| 416 static const MainFunction kMainFunctions[] = { | 439 static const MainFunction kMainFunctions[] = { |
| 417 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 440 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
| 418 { "", BrowserMain }, | 441 { "", BrowserMain }, |
| 419 #endif | 442 #endif |
| 420 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 443 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 421 #if defined(ENABLE_PLUGINS) | 444 #if defined(ENABLE_PLUGINS) |
| 422 { switches::kPluginProcess, PluginMain }, | 445 { switches::kPluginProcess, PluginMain }, |
| 423 { switches::kWorkerProcess, WorkerMain }, | 446 { switches::kWorkerProcess, WorkerMain }, |
| 424 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 447 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
| 425 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, | 448 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, |
| 426 #endif // ENABLE_PLUGINS | 449 #endif // ENABLE_PLUGINS |
| 427 { switches::kUtilityProcess, UtilityMain }, | 450 { switches::kUtilityProcess, UtilityMain }, |
| 428 { switches::kRendererProcess, RendererMain }, | 451 { switches::kRendererProcess, RendererMain }, |
| 429 { switches::kGpuProcess, GpuMain }, | 452 { switches::kGpuProcess, GpuMain }, |
| 430 #endif // !CHROME_MULTIPLE_DLL_BROWSER | 453 #endif // !CHROME_MULTIPLE_DLL_BROWSER |
| 431 }; | 454 }; |
| 432 | 455 |
| 433 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 456 RegisterMainThreadFactories(); |
| 434 UtilityProcessHost::RegisterUtilityMainThreadFactory( | |
| 435 CreateInProcessUtilityThread); | |
| 436 RenderProcessHost::RegisterRendererMainThreadFactory( | |
| 437 CreateInProcessRendererThread); | |
| 438 GpuProcessHost::RegisterGpuMainThreadFactory( | |
| 439 CreateInProcessGpuThread); | |
| 440 #endif | |
| 441 | 457 |
| 442 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 458 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
| 443 if (process_type == kMainFunctions[i].name) { | 459 if (process_type == kMainFunctions[i].name) { |
| 444 if (delegate) { | 460 if (delegate) { |
| 445 int exit_code = delegate->RunProcess(process_type, | 461 int exit_code = delegate->RunProcess(process_type, |
| 446 main_function_params); | 462 main_function_params); |
| 447 #if defined(OS_ANDROID) | 463 #if defined(OS_ANDROID) |
| 448 // In Android's browser process, the negative exit code doesn't mean the | 464 // In Android's browser process, the negative exit code doesn't mean the |
| 449 // default behavior should be used as the UI message loop is managed by | 465 // default behavior should be used as the UI message loop is managed by |
| 450 // the Java and the browser process's default behavior is always | 466 // the Java and the browser process's default behavior is always |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 | 851 |
| 836 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 852 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 837 }; | 853 }; |
| 838 | 854 |
| 839 // static | 855 // static |
| 840 ContentMainRunner* ContentMainRunner::Create() { | 856 ContentMainRunner* ContentMainRunner::Create() { |
| 841 return new ContentMainRunnerImpl(); | 857 return new ContentMainRunnerImpl(); |
| 842 } | 858 } |
| 843 | 859 |
| 844 } // namespace content | 860 } // namespace content |
| OLD | NEW |