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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #if defined(USE_X11) | 86 #if defined(USE_X11) |
87 #include <stdlib.h> | 87 #include <stdlib.h> |
88 #include <string.h> | 88 #include <string.h> |
89 #include "ui/base/x/x11_util.h" | 89 #include "ui/base/x/x11_util.h" |
90 #endif | 90 #endif |
91 | 91 |
92 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 92 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
93 #include "chrome/app/breakpad_linux.h" | 93 #include "chrome/app/breakpad_linux.h" |
94 #endif | 94 #endif |
95 | 95 |
96 base::LazyInstance<chrome::ChromeContentBrowserClient> | 96 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD) |
97 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; | |
98 base::LazyInstance<chrome::ChromeContentRendererClient> | 97 base::LazyInstance<chrome::ChromeContentRendererClient> |
99 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 98 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
100 base::LazyInstance<chrome::ChromeContentUtilityClient> | 99 base::LazyInstance<chrome::ChromeContentUtilityClient> |
101 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 100 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
102 base::LazyInstance<chrome::ChromeContentPluginClient> | 101 base::LazyInstance<chrome::ChromeContentPluginClient> |
103 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 102 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
| 103 #else // In browser in multiple DLL mode. |
| 104 base::LazyInstance<chrome::ChromeContentBrowserClient> |
| 105 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
| 106 #endif |
104 | 107 |
105 #if defined(OS_POSIX) | 108 #if defined(OS_POSIX) |
106 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky | 109 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky |
107 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; | 110 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; |
108 #endif | 111 #endif |
109 | 112 |
110 extern int NaClMain(const content::MainFunctionParams&); | 113 extern int NaClMain(const content::MainFunctionParams&); |
111 extern int ServiceProcessMain(const content::MainFunctionParams&); | 114 extern int ServiceProcessMain(const content::MainFunctionParams&); |
112 | 115 |
113 namespace { | 116 namespace { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 #if !defined(DISABLE_NACL) && defined(OS_LINUX) | 384 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
382 nacl::RegisterPathProvider(); | 385 nacl::RegisterPathProvider(); |
383 #endif | 386 #endif |
384 | 387 |
385 // No support for ANDROID yet as DiagnosticsController needs wchar support. | 388 // No support for ANDROID yet as DiagnosticsController needs wchar support. |
386 // TODO(gspencer): That's not true anymore, or at least there are no w-string | 389 // TODO(gspencer): That's not true anymore, or at least there are no w-string |
387 // references anymore. Not sure if that means this can be enabled on Android or | 390 // references anymore. Not sure if that means this can be enabled on Android or |
388 // not though: it still uses string16. As there is no easily accessible command | 391 // not though: it still uses string16. As there is no easily accessible command |
389 // line on Android, I'm not sure this is a big deal, at least for purposes of | 392 // line on Android, I'm not sure this is a big deal, at least for purposes of |
390 // troubleshooting with a customer. | 393 // troubleshooting with a customer. |
391 #if !defined(OS_ANDROID) | 394 #if !defined(OS_ANDROID) && !defined(CHROME_MULTIPLE_DLL_CHILD) |
392 // If we are in diagnostics mode this is the end of the line: after the | 395 // If we are in diagnostics mode this is the end of the line: after the |
393 // diagnostics are run the process will invariably exit. | 396 // diagnostics are run the process will invariably exit. |
394 if (command_line.HasSwitch(switches::kDiagnostics)) { | 397 if (command_line.HasSwitch(switches::kDiagnostics)) { |
395 diagnostics::DiagnosticsWriter::FormatType format = | 398 diagnostics::DiagnosticsWriter::FormatType format = |
396 diagnostics::DiagnosticsWriter::HUMAN; | 399 diagnostics::DiagnosticsWriter::HUMAN; |
397 if (command_line.HasSwitch(switches::kDiagnosticsFormat)) { | 400 if (command_line.HasSwitch(switches::kDiagnosticsFormat)) { |
398 std::string format_str = | 401 std::string format_str = |
399 command_line.GetSwitchValueASCII(switches::kDiagnosticsFormat); | 402 command_line.GetSwitchValueASCII(switches::kDiagnosticsFormat); |
400 if (format_str == "machine") { | 403 if (format_str == "machine") { |
401 format = diagnostics::DiagnosticsWriter::MACHINE; | 404 format = diagnostics::DiagnosticsWriter::MACHINE; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 #if defined(OS_WIN) | 669 #if defined(OS_WIN) |
667 SuppressWindowsErrorDialogs(); | 670 SuppressWindowsErrorDialogs(); |
668 #endif | 671 #endif |
669 } | 672 } |
670 | 673 |
671 int ChromeMainDelegate::RunProcess( | 674 int ChromeMainDelegate::RunProcess( |
672 const std::string& process_type, | 675 const std::string& process_type, |
673 const content::MainFunctionParams& main_function_params) { | 676 const content::MainFunctionParams& main_function_params) { |
674 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize | 677 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize |
675 // doesn't support empty array. So we comment out the block for Android. | 678 // doesn't support empty array. So we comment out the block for Android. |
676 #if !defined(OS_ANDROID) | 679 #if !defined(OS_ANDROID) && \ |
| 680 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_BROWSER)) |
677 static const MainFunction kMainFunctions[] = { | 681 static const MainFunction kMainFunctions[] = { |
678 { switches::kServiceProcess, ServiceProcessMain }, | 682 { switches::kServiceProcess, ServiceProcessMain }, |
679 #if defined(OS_MACOSX) | 683 #if defined(OS_MACOSX) |
680 { switches::kRelauncherProcess, | 684 { switches::kRelauncherProcess, |
681 mac_relauncher::internal::RelauncherMain }, | 685 mac_relauncher::internal::RelauncherMain }, |
682 #endif | 686 #endif |
683 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. | 687 |
684 #if !defined(DISABLE_NACL) | 688 #if !defined(DISABLE_NACL) && \ |
| 689 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD)) |
685 { switches::kNaClLoaderProcess, NaClMain }, | 690 { switches::kNaClLoaderProcess, NaClMain }, |
686 #endif // DISABLE_NACL | 691 #endif // DISABLE_NACL |
687 }; | 692 }; |
688 | 693 |
689 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 694 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
690 if (process_type == kMainFunctions[i].name) | 695 if (process_type == kMainFunctions[i].name) |
691 return kMainFunctions[i].function(main_function_params); | 696 return kMainFunctions[i].function(main_function_params); |
692 } | 697 } |
693 #endif | 698 #endif |
694 | 699 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 747 |
743 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 748 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
744 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 749 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
745 // this up for the browser process in a different manner. | 750 // this up for the browser process in a different manner. |
746 InitCrashReporter(); | 751 InitCrashReporter(); |
747 #endif | 752 #endif |
748 } | 753 } |
749 | 754 |
750 #endif // OS_MACOSX | 755 #endif // OS_MACOSX |
751 | 756 |
| 757 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD) |
| 758 |
| 759 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { |
| 760 return &g_chrome_content_plugin_client.Get(); |
| 761 } |
| 762 |
| 763 content::ContentRendererClient* |
| 764 ChromeMainDelegate::CreateContentRendererClient() { |
| 765 return &g_chrome_content_renderer_client.Get(); |
| 766 } |
| 767 |
| 768 content::ContentUtilityClient* |
| 769 ChromeMainDelegate::CreateContentUtilityClient() { |
| 770 return &g_chrome_content_utility_client.Get(); |
| 771 } |
| 772 |
| 773 content::ContentBrowserClient* |
| 774 ChromeMainDelegate::CreateContentBrowserClient() { |
| 775 return NULL; |
| 776 } |
| 777 |
| 778 #else // In browser in multiple DLL mode. |
| 779 |
752 content::ContentBrowserClient* | 780 content::ContentBrowserClient* |
753 ChromeMainDelegate::CreateContentBrowserClient() { | 781 ChromeMainDelegate::CreateContentBrowserClient() { |
754 return &g_chrome_content_browser_client.Get(); | 782 return &g_chrome_content_browser_client.Get(); |
755 } | 783 } |
756 | 784 |
757 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { | 785 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { |
758 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into | 786 return NULL; |
759 // browser and child parts. | |
760 return &g_chrome_content_plugin_client.Get(); | |
761 } | 787 } |
762 | 788 |
763 content::ContentRendererClient* | 789 content::ContentRendererClient* |
764 ChromeMainDelegate::CreateContentRendererClient() { | 790 ChromeMainDelegate::CreateContentRendererClient() { |
765 return &g_chrome_content_renderer_client.Get(); | 791 return NULL; |
766 } | 792 } |
767 | 793 |
768 content::ContentUtilityClient* | 794 content::ContentUtilityClient* |
769 ChromeMainDelegate::CreateContentUtilityClient() { | 795 ChromeMainDelegate::CreateContentUtilityClient() { |
770 return &g_chrome_content_utility_client.Get(); | 796 return NULL; |
771 } | 797 } |
| 798 |
| 799 #endif |
OLD | NEW |