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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 content_client->browser_ = &g_empty_content_browser_client.Get(); | 292 content_client->browser_ = &g_empty_content_browser_client.Get(); |
293 } | 293 } |
294 | 294 |
295 #if !defined(OS_IOS) | 295 #if !defined(OS_IOS) |
296 if (process_type == switches::kPluginProcess || | 296 if (process_type == switches::kPluginProcess || |
297 process_type == switches::kPpapiPluginProcess) { | 297 process_type == switches::kPpapiPluginProcess) { |
298 if (delegate) | 298 if (delegate) |
299 content_client->plugin_ = delegate->CreateContentPluginClient(); | 299 content_client->plugin_ = delegate->CreateContentPluginClient(); |
300 if (!content_client->plugin_) | 300 if (!content_client->plugin_) |
301 content_client->plugin_ = &g_empty_content_plugin_client.Get(); | 301 content_client->plugin_ = &g_empty_content_plugin_client.Get(); |
| 302 #if !defined(CHROME_SPLIT_DLL) |
302 } else if (process_type == switches::kRendererProcess || | 303 } else if (process_type == switches::kRendererProcess || |
303 CommandLine::ForCurrentProcess()->HasSwitch( | 304 CommandLine::ForCurrentProcess()->HasSwitch( |
304 switches::kSingleProcess)) { | 305 switches::kSingleProcess)) { |
305 if (delegate) | 306 if (delegate) |
306 content_client->renderer_ = delegate->CreateContentRendererClient(); | 307 content_client->renderer_ = delegate->CreateContentRendererClient(); |
307 if (!content_client->renderer_) | 308 if (!content_client->renderer_) |
308 content_client->renderer_ = &g_empty_content_renderer_client.Get(); | 309 content_client->renderer_ = &g_empty_content_renderer_client.Get(); |
| 310 #endif |
309 } else if (process_type == switches::kUtilityProcess) { | 311 } else if (process_type == switches::kUtilityProcess) { |
310 if (delegate) | 312 if (delegate) |
311 content_client->utility_ = delegate->CreateContentUtilityClient(); | 313 content_client->utility_ = delegate->CreateContentUtilityClient(); |
312 if (!content_client->utility_) | 314 if (!content_client->utility_) |
313 content_client->utility_ = &g_empty_content_utility_client.Get(); | 315 content_client->utility_ = &g_empty_content_utility_client.Get(); |
314 } | 316 } |
315 #endif // !OS_IOS | 317 #endif // !OS_IOS |
316 } | 318 } |
317 }; | 319 }; |
318 | 320 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 #if !defined(OS_IOS) | 396 #if !defined(OS_IOS) |
395 // Run the FooMain() for a given process type. | 397 // Run the FooMain() for a given process type. |
396 // If |process_type| is empty, runs BrowserMain(). | 398 // If |process_type| is empty, runs BrowserMain(). |
397 // Returns the exit code for this process. | 399 // Returns the exit code for this process. |
398 int RunNamedProcessTypeMain( | 400 int RunNamedProcessTypeMain( |
399 const std::string& process_type, | 401 const std::string& process_type, |
400 const MainFunctionParams& main_function_params, | 402 const MainFunctionParams& main_function_params, |
401 ContentMainDelegate* delegate) { | 403 ContentMainDelegate* delegate) { |
402 static const MainFunction kMainFunctions[] = { | 404 static const MainFunction kMainFunctions[] = { |
403 { "", BrowserMain }, | 405 { "", BrowserMain }, |
404 { switches::kRendererProcess, RendererMain }, | |
405 #if defined(ENABLE_PLUGINS) | 406 #if defined(ENABLE_PLUGINS) |
406 { switches::kPluginProcess, PluginMain }, | 407 { switches::kPluginProcess, PluginMain }, |
| 408 // TODO(scottmg): http://crbug.com/237249 This will have to be split into |
| 409 // content_main_runner_browser and content_main_runner_child. |
| 410 #if !defined(CHROME_SPLIT_DLL) |
407 { switches::kWorkerProcess, WorkerMain }, | 411 { switches::kWorkerProcess, WorkerMain }, |
| 412 #endif |
408 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 413 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
409 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, | 414 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, |
410 #endif | 415 #endif |
411 { switches::kUtilityProcess, UtilityMain }, | 416 { switches::kUtilityProcess, UtilityMain }, |
| 417 // TODO(scottmg): http://crbug.com/237249 This will have to be split into |
| 418 // content_main_runner_browser and content_main_runner_child. |
| 419 #if !defined(CHROME_SPLIT_DLL) |
| 420 { switches::kRendererProcess, RendererMain }, |
| 421 #endif |
412 { switches::kGpuProcess, GpuMain }, | 422 { switches::kGpuProcess, GpuMain }, |
413 }; | 423 }; |
414 | 424 |
415 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 425 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
416 if (process_type == kMainFunctions[i].name) { | 426 if (process_type == kMainFunctions[i].name) { |
417 if (delegate) { | 427 if (delegate) { |
418 int exit_code = delegate->RunProcess(process_type, | 428 int exit_code = delegate->RunProcess(process_type, |
419 main_function_params); | 429 main_function_params); |
420 #if defined(OS_ANDROID) | 430 #if defined(OS_ANDROID) |
421 // In Android's browser process, the negative exit code doesn't mean the | 431 // In Android's browser process, the negative exit code doesn't mean the |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 822 |
813 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 823 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
814 }; | 824 }; |
815 | 825 |
816 // static | 826 // static |
817 ContentMainRunner* ContentMainRunner::Create() { | 827 ContentMainRunner* ContentMainRunner::Create() { |
818 return new ContentMainRunnerImpl(); | 828 return new ContentMainRunnerImpl(); |
819 } | 829 } |
820 | 830 |
821 } // namespace content | 831 } // namespace content |
OLD | NEW |