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 "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 base::LazyInstance<chrome::ChromeContentUtilityClient> | 99 base::LazyInstance<chrome::ChromeContentUtilityClient> |
100 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 100 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
101 base::LazyInstance<chrome::ChromeContentPluginClient> | 101 base::LazyInstance<chrome::ChromeContentPluginClient> |
102 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 102 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
103 | 103 |
104 #if defined(OS_MACOSX) || defined(USE_LINUX_BREAKPAD) | 104 #if defined(OS_MACOSX) || defined(USE_LINUX_BREAKPAD) |
105 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky | 105 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky |
106 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; | 106 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; |
107 #endif | 107 #endif |
108 | 108 |
| 109 #if defined (ENABLE_IPC_FUZZER) |
| 110 extern int IpcFuzzerMain(const content::MainFunctionParams&); |
| 111 #endif |
| 112 |
109 extern int NaClMain(const content::MainFunctionParams&); | 113 extern int NaClMain(const content::MainFunctionParams&); |
110 extern int ServiceProcessMain(const content::MainFunctionParams&); | 114 extern int ServiceProcessMain(const content::MainFunctionParams&); |
111 | 115 |
112 namespace { | 116 namespace { |
113 | 117 |
114 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
115 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; | 119 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; |
116 | 120 |
117 // Load the memory profiling DLL. All it needs to be activated | 121 // Load the memory profiling DLL. All it needs to be activated |
118 // is to be loaded. Return true on success, false otherwise. | 122 // is to be loaded. Return true on success, false otherwise. |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 AdjustLinuxOOMScore(process_type); | 645 AdjustLinuxOOMScore(process_type); |
642 #endif | 646 #endif |
643 #if defined(OS_WIN) | 647 #if defined(OS_WIN) |
644 SuppressWindowsErrorDialogs(); | 648 SuppressWindowsErrorDialogs(); |
645 #endif | 649 #endif |
646 } | 650 } |
647 | 651 |
648 int ChromeMainDelegate::RunProcess( | 652 int ChromeMainDelegate::RunProcess( |
649 const std::string& process_type, | 653 const std::string& process_type, |
650 const content::MainFunctionParams& main_function_params) { | 654 const content::MainFunctionParams& main_function_params) { |
| 655 |
| 656 #if defined(ENABLE_IPC_FUZZER) |
| 657 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kIpcFuzzerOverride)) |
| 658 return IpcFuzzerMain(main_function_params); |
| 659 #endif |
| 660 |
651 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize | 661 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize |
652 // doesn't support empty array. So we comment out the block for Android. | 662 // doesn't support empty array. So we comment out the block for Android. |
653 #if !defined(OS_ANDROID) | 663 #if !defined(OS_ANDROID) |
654 static const MainFunction kMainFunctions[] = { | 664 static const MainFunction kMainFunctions[] = { |
655 { switches::kServiceProcess, ServiceProcessMain }, | 665 { switches::kServiceProcess, ServiceProcessMain }, |
656 #if defined(OS_MACOSX) | 666 #if defined(OS_MACOSX) |
657 { switches::kRelauncherProcess, | 667 { switches::kRelauncherProcess, |
658 mac_relauncher::internal::RelauncherMain }, | 668 mac_relauncher::internal::RelauncherMain }, |
659 #endif | 669 #endif |
660 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. | 670 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 749 |
740 content::ContentRendererClient* | 750 content::ContentRendererClient* |
741 ChromeMainDelegate::CreateContentRendererClient() { | 751 ChromeMainDelegate::CreateContentRendererClient() { |
742 return &g_chrome_content_renderer_client.Get(); | 752 return &g_chrome_content_renderer_client.Get(); |
743 } | 753 } |
744 | 754 |
745 content::ContentUtilityClient* | 755 content::ContentUtilityClient* |
746 ChromeMainDelegate::CreateContentUtilityClient() { | 756 ChromeMainDelegate::CreateContentUtilityClient() { |
747 return &g_chrome_content_utility_client.Get(); | 757 return &g_chrome_content_utility_client.Get(); |
748 } | 758 } |
OLD | NEW |