| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include <string.h> | 81 #include <string.h> |
| 82 #include "ui/base/x/x11_util.h" | 82 #include "ui/base/x/x11_util.h" |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 #if defined(USE_LINUX_BREAKPAD) | 85 #if defined(USE_LINUX_BREAKPAD) |
| 86 #include "chrome/app/breakpad_linux.h" | 86 #include "chrome/app/breakpad_linux.h" |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 base::LazyInstance<chrome::ChromeContentBrowserClient> | 89 base::LazyInstance<chrome::ChromeContentBrowserClient> |
| 90 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 90 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
| 91 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into | |
| 92 // browser and child parts. | |
| 93 #if !defined(CHROME_SPLIT_DLL) | |
| 94 base::LazyInstance<chrome::ChromeContentRendererClient> | 91 base::LazyInstance<chrome::ChromeContentRendererClient> |
| 95 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 92 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
| 96 base::LazyInstance<chrome::ChromeContentUtilityClient> | 93 base::LazyInstance<chrome::ChromeContentUtilityClient> |
| 97 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 94 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
| 98 base::LazyInstance<chrome::ChromeContentPluginClient> | 95 base::LazyInstance<chrome::ChromeContentPluginClient> |
| 99 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 96 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
| 100 #endif | |
| 101 | 97 |
| 102 extern int NaClMain(const content::MainFunctionParams&); | 98 extern int NaClMain(const content::MainFunctionParams&); |
| 103 extern int ServiceProcessMain(const content::MainFunctionParams&); | 99 extern int ServiceProcessMain(const content::MainFunctionParams&); |
| 104 | 100 |
| 105 namespace { | 101 namespace { |
| 106 | 102 |
| 107 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
| 108 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; | 104 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; |
| 109 | 105 |
| 110 // Load the memory profiling DLL. All it needs to be activated | 106 // Load the memory profiling DLL. All it needs to be activated |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 const content::MainFunctionParams& main_function_params) { | 624 const content::MainFunctionParams& main_function_params) { |
| 629 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize | 625 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize |
| 630 // doesn't support empty array. So we comment out the block for Android. | 626 // doesn't support empty array. So we comment out the block for Android. |
| 631 #if !defined(OS_ANDROID) | 627 #if !defined(OS_ANDROID) |
| 632 static const MainFunction kMainFunctions[] = { | 628 static const MainFunction kMainFunctions[] = { |
| 633 { switches::kServiceProcess, ServiceProcessMain }, | 629 { switches::kServiceProcess, ServiceProcessMain }, |
| 634 #if defined(OS_MACOSX) | 630 #if defined(OS_MACOSX) |
| 635 { switches::kRelauncherProcess, | 631 { switches::kRelauncherProcess, |
| 636 mac_relauncher::internal::RelauncherMain }, | 632 mac_relauncher::internal::RelauncherMain }, |
| 637 #endif | 633 #endif |
| 638 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. | 634 #if !defined(DISABLE_NACL) |
| 639 #if !defined(DISABLE_NACL) && !defined(CHROME_SPLIT_DLL) | |
| 640 { switches::kNaClLoaderProcess, NaClMain }, | 635 { switches::kNaClLoaderProcess, NaClMain }, |
| 641 #endif // DISABLE_NACL | 636 #endif // DISABLE_NACL |
| 642 }; | 637 }; |
| 643 | 638 |
| 644 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 639 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
| 645 if (process_type == kMainFunctions[i].name) | 640 if (process_type == kMainFunctions[i].name) |
| 646 return kMainFunctions[i].function(main_function_params); | 641 return kMainFunctions[i].function(main_function_params); |
| 647 } | 642 } |
| 648 #endif | 643 #endif |
| 649 | 644 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 } | 698 } |
| 704 | 699 |
| 705 #endif // OS_MACOSX | 700 #endif // OS_MACOSX |
| 706 | 701 |
| 707 content::ContentBrowserClient* | 702 content::ContentBrowserClient* |
| 708 ChromeMainDelegate::CreateContentBrowserClient() { | 703 ChromeMainDelegate::CreateContentBrowserClient() { |
| 709 return &g_chrome_content_browser_client.Get(); | 704 return &g_chrome_content_browser_client.Get(); |
| 710 } | 705 } |
| 711 | 706 |
| 712 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { | 707 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { |
| 713 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into | |
| 714 // browser and child parts. | |
| 715 #if defined(CHROME_SPLIT_DLL) | |
| 716 return NULL; | |
| 717 #else | |
| 718 return &g_chrome_content_plugin_client.Get(); | 708 return &g_chrome_content_plugin_client.Get(); |
| 719 #endif | |
| 720 } | 709 } |
| 721 | 710 |
| 722 content::ContentRendererClient* | 711 content::ContentRendererClient* |
| 723 ChromeMainDelegate::CreateContentRendererClient() { | 712 ChromeMainDelegate::CreateContentRendererClient() { |
| 724 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into | |
| 725 // browser and child parts. | |
| 726 #if defined(CHROME_SPLIT_DLL) | |
| 727 return NULL; | |
| 728 #else | |
| 729 return &g_chrome_content_renderer_client.Get(); | 713 return &g_chrome_content_renderer_client.Get(); |
| 730 #endif | |
| 731 } | 714 } |
| 732 | 715 |
| 733 content::ContentUtilityClient* | 716 content::ContentUtilityClient* |
| 734 ChromeMainDelegate::CreateContentUtilityClient() { | 717 ChromeMainDelegate::CreateContentUtilityClient() { |
| 735 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into | |
| 736 // browser and child parts. | |
| 737 #if defined(CHROME_SPLIT_DLL) | |
| 738 return NULL; | |
| 739 #else | |
| 740 return &g_chrome_content_utility_client.Get(); | 718 return &g_chrome_content_utility_client.Get(); |
| 741 #endif | |
| 742 } | 719 } |
| OLD | NEW |