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 "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 extern int IpcFuzzerMain(const content::MainFunctionParams&); | |
|
Tom Sepez
2013/07/12 18:47:20
#if defined(ENABLE_IPC_FUZZER) around this prototy
aedla
2013/07/15 16:12:08
Done.
| |
| 109 extern int NaClMain(const content::MainFunctionParams&); | 110 extern int NaClMain(const content::MainFunctionParams&); |
| 110 extern int ServiceProcessMain(const content::MainFunctionParams&); | 111 extern int ServiceProcessMain(const content::MainFunctionParams&); |
| 111 | 112 |
| 112 namespace { | 113 namespace { |
| 113 | 114 |
| 114 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 115 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; | 116 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; |
| 116 | 117 |
| 117 // Load the memory profiling DLL. All it needs to be activated | 118 // Load the memory profiling DLL. All it needs to be activated |
| 118 // is to be loaded. Return true on success, false otherwise. | 119 // 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); | 642 AdjustLinuxOOMScore(process_type); |
| 642 #endif | 643 #endif |
| 643 #if defined(OS_WIN) | 644 #if defined(OS_WIN) |
| 644 SuppressWindowsErrorDialogs(); | 645 SuppressWindowsErrorDialogs(); |
| 645 #endif | 646 #endif |
| 646 } | 647 } |
| 647 | 648 |
| 648 int ChromeMainDelegate::RunProcess( | 649 int ChromeMainDelegate::RunProcess( |
| 649 const std::string& process_type, | 650 const std::string& process_type, |
| 650 const content::MainFunctionParams& main_function_params) { | 651 const content::MainFunctionParams& main_function_params) { |
| 652 | |
| 653 #if defined(ENABLE_IPC_FUZZER) | |
| 654 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kIpcFuzzerOverride)) | |
| 655 return IpcFuzzerMain(main_function_params); | |
| 656 #endif | |
| 657 | |
| 651 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize | 658 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize |
| 652 // doesn't support empty array. So we comment out the block for Android. | 659 // doesn't support empty array. So we comment out the block for Android. |
| 653 #if !defined(OS_ANDROID) | 660 #if !defined(OS_ANDROID) |
| 654 static const MainFunction kMainFunctions[] = { | 661 static const MainFunction kMainFunctions[] = { |
| 655 { switches::kServiceProcess, ServiceProcessMain }, | 662 { switches::kServiceProcess, ServiceProcessMain }, |
| 656 #if defined(OS_MACOSX) | 663 #if defined(OS_MACOSX) |
| 657 { switches::kRelauncherProcess, | 664 { switches::kRelauncherProcess, |
| 658 mac_relauncher::internal::RelauncherMain }, | 665 mac_relauncher::internal::RelauncherMain }, |
| 659 #endif | 666 #endif |
| 660 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. | 667 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 | 746 |
| 740 content::ContentRendererClient* | 747 content::ContentRendererClient* |
| 741 ChromeMainDelegate::CreateContentRendererClient() { | 748 ChromeMainDelegate::CreateContentRendererClient() { |
| 742 return &g_chrome_content_renderer_client.Get(); | 749 return &g_chrome_content_renderer_client.Get(); |
| 743 } | 750 } |
| 744 | 751 |
| 745 content::ContentUtilityClient* | 752 content::ContentUtilityClient* |
| 746 ChromeMainDelegate::CreateContentUtilityClient() { | 753 ChromeMainDelegate::CreateContentUtilityClient() { |
| 747 return &g_chrome_content_utility_client.Get(); | 754 return &g_chrome_content_utility_client.Get(); |
| 748 } | 755 } |
| OLD | NEW |