| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 #if defined(USE_TCMALLOC) | 55 #if defined(USE_TCMALLOC) |
| 56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
| 57 #if defined(TYPE_PROFILING) | 57 #if defined(TYPE_PROFILING) |
| 58 #include "base/allocator/type_profiler.h" | 58 #include "base/allocator/type_profiler.h" |
| 59 #include "base/allocator/type_profiler_tcmalloc.h" | 59 #include "base/allocator/type_profiler_tcmalloc.h" |
| 60 #endif | 60 #endif |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 #if !defined(OS_IOS) | 63 #if !defined(OS_IOS) |
| 64 #include "content/app/mojo/mojo_init.h" |
| 64 #include "content/public/plugin/content_plugin_client.h" | 65 #include "content/public/plugin/content_plugin_client.h" |
| 65 #include "content/public/renderer/content_renderer_client.h" | 66 #include "content/public/renderer/content_renderer_client.h" |
| 66 #include "content/public/utility/content_utility_client.h" | 67 #include "content/public/utility/content_utility_client.h" |
| 67 #endif | 68 #endif |
| 68 | 69 |
| 69 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 70 #include <atlbase.h> | 71 #include <atlbase.h> |
| 71 #include <atlapp.h> | 72 #include <atlapp.h> |
| 72 #include <malloc.h> | 73 #include <malloc.h> |
| 73 #include <cstring> | 74 #include <cstring> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 94 #endif | 95 #endif |
| 95 | 96 |
| 96 #endif // OS_POSIX | 97 #endif // OS_POSIX |
| 97 | 98 |
| 98 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 99 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
| 99 extern "C" { | 100 extern "C" { |
| 100 int tc_set_new_mode(int mode); | 101 int tc_set_new_mode(int mode); |
| 101 } | 102 } |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 #if defined(USE_MOJO) | |
| 105 #include "content/app/mojo/mojo_init.h" | |
| 106 #endif | |
| 107 | |
| 108 namespace content { | 105 namespace content { |
| 109 extern int GpuMain(const content::MainFunctionParams&); | 106 extern int GpuMain(const content::MainFunctionParams&); |
| 110 #if defined(ENABLE_PLUGINS) | 107 #if defined(ENABLE_PLUGINS) |
| 111 extern int PluginMain(const content::MainFunctionParams&); | 108 extern int PluginMain(const content::MainFunctionParams&); |
| 112 extern int PpapiPluginMain(const MainFunctionParams&); | 109 extern int PpapiPluginMain(const MainFunctionParams&); |
| 113 extern int PpapiBrokerMain(const MainFunctionParams&); | 110 extern int PpapiBrokerMain(const MainFunctionParams&); |
| 114 #endif | 111 #endif |
| 115 extern int RendererMain(const content::MainFunctionParams&); | 112 extern int RendererMain(const content::MainFunctionParams&); |
| 116 extern int UtilityMain(const MainFunctionParams&); | 113 extern int UtilityMain(const MainFunctionParams&); |
| 117 extern int WorkerMain(const MainFunctionParams&); | 114 extern int WorkerMain(const MainFunctionParams&); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 int exit_code; | 655 int exit_code; |
| 659 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) | 656 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) |
| 660 return exit_code; | 657 return exit_code; |
| 661 | 658 |
| 662 completed_basic_startup_ = true; | 659 completed_basic_startup_ = true; |
| 663 | 660 |
| 664 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 661 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 665 std::string process_type = | 662 std::string process_type = |
| 666 command_line.GetSwitchValueASCII(switches::kProcessType); | 663 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 667 | 664 |
| 668 #if defined(USE_MOJO) | 665 #if !defined(OS_IOS) |
| 669 // Initialize mojo here so that services can be registered. | 666 // Initialize mojo here so that services can be registered. |
| 670 InitializeMojo(); | 667 InitializeMojo(); |
| 671 #endif | 668 #endif |
| 672 | 669 |
| 673 if (!GetContentClient()) | 670 if (!GetContentClient()) |
| 674 SetContentClient(&empty_content_client_); | 671 SetContentClient(&empty_content_client_); |
| 675 ContentClientInitializer::Set(process_type, delegate_); | 672 ContentClientInitializer::Set(process_type, delegate_); |
| 676 | 673 |
| 677 #if defined(OS_WIN) | 674 #if defined(OS_WIN) |
| 678 // Route stdio to parent console (if any) or create one. | 675 // Route stdio to parent console (if any) or create one. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 DCHECK(!is_shutdown_); | 802 DCHECK(!is_shutdown_); |
| 806 | 803 |
| 807 if (completed_basic_startup_ && delegate_) { | 804 if (completed_basic_startup_ && delegate_) { |
| 808 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 805 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 809 std::string process_type = | 806 std::string process_type = |
| 810 command_line.GetSwitchValueASCII(switches::kProcessType); | 807 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 811 | 808 |
| 812 delegate_->ProcessExiting(process_type); | 809 delegate_->ProcessExiting(process_type); |
| 813 } | 810 } |
| 814 | 811 |
| 815 #if defined(USE_MOJO) | 812 #if !defined(OS_IOS) |
| 816 ShutdownMojo(); | 813 ShutdownMojo(); |
| 817 #endif | 814 #endif |
| 818 | 815 |
| 819 #if defined(OS_WIN) | 816 #if defined(OS_WIN) |
| 820 #ifdef _CRTDBG_MAP_ALLOC | 817 #ifdef _CRTDBG_MAP_ALLOC |
| 821 _CrtDumpMemoryLeaks(); | 818 _CrtDumpMemoryLeaks(); |
| 822 #endif // _CRTDBG_MAP_ALLOC | 819 #endif // _CRTDBG_MAP_ALLOC |
| 823 | 820 |
| 824 _Module.Term(); | 821 _Module.Term(); |
| 825 #endif // OS_WIN | 822 #endif // OS_WIN |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 858 |
| 862 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 859 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 863 }; | 860 }; |
| 864 | 861 |
| 865 // static | 862 // static |
| 866 ContentMainRunner* ContentMainRunner::Create() { | 863 ContentMainRunner* ContentMainRunner::Create() { |
| 867 return new ContentMainRunnerImpl(); | 864 return new ContentMainRunnerImpl(); |
| 868 } | 865 } |
| 869 | 866 |
| 870 } // namespace content | 867 } // namespace content |
| OLD | NEW |