| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 base::LazyInstance<chrome::ChromeContentBrowserClient> | 99 base::LazyInstance<chrome::ChromeContentBrowserClient> |
| 100 g_chrome_content_browser_client(base::LINKER_INITIALIZED); | 100 g_chrome_content_browser_client(base::LINKER_INITIALIZED); |
| 101 base::LazyInstance<chrome::ChromeContentRendererClient> | 101 base::LazyInstance<chrome::ChromeContentRendererClient> |
| 102 g_chrome_content_renderer_client(base::LINKER_INITIALIZED); | 102 g_chrome_content_renderer_client(base::LINKER_INITIALIZED); |
| 103 base::LazyInstance<chrome::ChromeContentUtilityClient> | 103 base::LazyInstance<chrome::ChromeContentUtilityClient> |
| 104 g_chrome_content_utility_client(base::LINKER_INITIALIZED); | 104 g_chrome_content_utility_client(base::LINKER_INITIALIZED); |
| 105 base::LazyInstance<chrome::ChromeContentPluginClient> | 105 base::LazyInstance<chrome::ChromeContentPluginClient> |
| 106 g_chrome_content_plugin_client(base::LINKER_INITIALIZED); | 106 g_chrome_content_plugin_client(base::LINKER_INITIALIZED); |
| 107 | 107 |
| 108 extern int NaClMain(const MainFunctionParams&); | 108 extern int NaClMain(const content::MainFunctionParams&); |
| 109 extern int ServiceProcessMain(const MainFunctionParams&); | 109 extern int ServiceProcessMain(const content::MainFunctionParams&); |
| 110 | 110 |
| 111 namespace { | 111 namespace { |
| 112 | 112 |
| 113 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
| 114 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; | 114 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; |
| 115 | 115 |
| 116 // Load the memory profiling DLL. All it needs to be activated | 116 // Load the memory profiling DLL. All it needs to be activated |
| 117 // is to be loaded. Return true on success, false otherwise. | 117 // is to be loaded. Return true on success, false otherwise. |
| 118 bool LoadMemoryProfiler() { | 118 bool LoadMemoryProfiler() { |
| 119 HMODULE prof_module = LoadLibrary(kProfilingDll); | 119 HMODULE prof_module = LoadLibrary(kProfilingDll); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 sigact.sa_flags = SA_RESETHAND; | 367 sigact.sa_flags = SA_RESETHAND; |
| 368 sigemptyset(&sigact.sa_mask); | 368 sigemptyset(&sigact.sa_mask); |
| 369 CHECK(sigaction(SIGTERM, &sigact, NULL) == 0); | 369 CHECK(sigaction(SIGTERM, &sigact, NULL) == 0); |
| 370 } | 370 } |
| 371 #endif | 371 #endif |
| 372 | 372 |
| 373 #endif // OS_POSIX | 373 #endif // OS_POSIX |
| 374 | 374 |
| 375 struct MainFunction { | 375 struct MainFunction { |
| 376 const char* name; | 376 const char* name; |
| 377 int (*function)(const MainFunctionParams&); | 377 int (*function)(const content::MainFunctionParams&); |
| 378 }; | 378 }; |
| 379 | 379 |
| 380 } // namespace | 380 } // namespace |
| 381 | 381 |
| 382 ChromeMainDelegate::ChromeMainDelegate() { | 382 ChromeMainDelegate::ChromeMainDelegate() { |
| 383 } | 383 } |
| 384 | 384 |
| 385 ChromeMainDelegate::~ChromeMainDelegate() { | 385 ChromeMainDelegate::~ChromeMainDelegate() { |
| 386 } | 386 } |
| 387 | 387 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 650 |
| 651 // Note: If you are adding a new process type below, be sure to adjust the | 651 // Note: If you are adding a new process type below, be sure to adjust the |
| 652 // AdjustLinuxOOMScore function too. | 652 // AdjustLinuxOOMScore function too. |
| 653 #if defined(OS_LINUX) | 653 #if defined(OS_LINUX) |
| 654 AdjustLinuxOOMScore(process_type); | 654 AdjustLinuxOOMScore(process_type); |
| 655 #endif | 655 #endif |
| 656 } | 656 } |
| 657 | 657 |
| 658 int ChromeMainDelegate::RunProcess( | 658 int ChromeMainDelegate::RunProcess( |
| 659 const std::string& process_type, | 659 const std::string& process_type, |
| 660 const MainFunctionParams& main_function_params) { | 660 const content::MainFunctionParams& main_function_params) { |
| 661 static const MainFunction kMainFunctions[] = { | 661 static const MainFunction kMainFunctions[] = { |
| 662 { switches::kServiceProcess, ServiceProcessMain }, | 662 { switches::kServiceProcess, ServiceProcessMain }, |
| 663 #if defined(OS_MACOSX) | 663 #if defined(OS_MACOSX) |
| 664 { switches::kRelauncherProcess, | 664 { switches::kRelauncherProcess, |
| 665 mac_relauncher::internal::RelauncherMain }, | 665 mac_relauncher::internal::RelauncherMain }, |
| 666 #endif | 666 #endif |
| 667 #if !defined(DISABLE_NACL) | 667 #if !defined(DISABLE_NACL) |
| 668 { switches::kNaClLoaderProcess, NaClMain }, | 668 { switches::kNaClLoaderProcess, NaClMain }, |
| 669 #endif // DISABLE_NACL | 669 #endif // DISABLE_NACL |
| 670 }; | 670 }; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 | 731 |
| 732 #if defined(USE_LINUX_BREAKPAD) | 732 #if defined(USE_LINUX_BREAKPAD) |
| 733 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 733 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
| 734 // this up for the browser process in a different manner. | 734 // this up for the browser process in a different manner. |
| 735 InitCrashReporter(); | 735 InitCrashReporter(); |
| 736 #endif | 736 #endif |
| 737 | 737 |
| 738 InitializeChromeContentClient(process_type); | 738 InitializeChromeContentClient(process_type); |
| 739 } | 739 } |
| 740 #endif // OS_MACOSX | 740 #endif // OS_MACOSX |
| OLD | NEW |