Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 19572013: reland of http://crrev.com/212230 Create top-level separate targets for... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix delegate dispatch and test gyp deps Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | chrome/app/client_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop.h" 9 #include "base/message_loop/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
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 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_BROWSER)
96 base::LazyInstance<chrome::ChromeContentBrowserClient> 97 base::LazyInstance<chrome::ChromeContentBrowserClient>
97 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; 98 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER;
99 #endif
100
101 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD)
98 base::LazyInstance<chrome::ChromeContentRendererClient> 102 base::LazyInstance<chrome::ChromeContentRendererClient>
99 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; 103 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
100 base::LazyInstance<chrome::ChromeContentUtilityClient> 104 base::LazyInstance<chrome::ChromeContentUtilityClient>
101 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; 105 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER;
102 base::LazyInstance<chrome::ChromeContentPluginClient> 106 base::LazyInstance<chrome::ChromeContentPluginClient>
103 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; 107 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER;
108 #endif // !CHROME_MULTIPLE_DLL || CHROME_MULTIPLE_DLL_CHILD
104 109
105 #if defined(OS_POSIX) 110 #if defined(OS_POSIX)
106 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky 111 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky
107 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; 112 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER;
108 #endif 113 #endif
109 114
110 extern int NaClMain(const content::MainFunctionParams&); 115 extern int NaClMain(const content::MainFunctionParams&);
111 extern int ServiceProcessMain(const content::MainFunctionParams&); 116 extern int ServiceProcessMain(const content::MainFunctionParams&);
112 117
113 namespace { 118 namespace {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 #if !defined(DISABLE_NACL) && defined(OS_LINUX) 386 #if !defined(DISABLE_NACL) && defined(OS_LINUX)
382 nacl::RegisterPathProvider(); 387 nacl::RegisterPathProvider();
383 #endif 388 #endif
384 389
385 // No support for ANDROID yet as DiagnosticsController needs wchar support. 390 // 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 391 // 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 392 // 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 393 // 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 394 // line on Android, I'm not sure this is a big deal, at least for purposes of
390 // troubleshooting with a customer. 395 // troubleshooting with a customer.
391 #if !defined(OS_ANDROID) 396 #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 397 // If we are in diagnostics mode this is the end of the line: after the
393 // diagnostics are run the process will invariably exit. 398 // diagnostics are run the process will invariably exit.
394 if (command_line.HasSwitch(switches::kDiagnostics)) { 399 if (command_line.HasSwitch(switches::kDiagnostics)) {
395 diagnostics::DiagnosticsWriter::FormatType format = 400 diagnostics::DiagnosticsWriter::FormatType format =
396 diagnostics::DiagnosticsWriter::HUMAN; 401 diagnostics::DiagnosticsWriter::HUMAN;
397 if (command_line.HasSwitch(switches::kDiagnosticsFormat)) { 402 if (command_line.HasSwitch(switches::kDiagnosticsFormat)) {
398 std::string format_str = 403 std::string format_str =
399 command_line.GetSwitchValueASCII(switches::kDiagnosticsFormat); 404 command_line.GetSwitchValueASCII(switches::kDiagnosticsFormat);
400 if (format_str == "machine") { 405 if (format_str == "machine") {
401 format = diagnostics::DiagnosticsWriter::MACHINE; 406 format = diagnostics::DiagnosticsWriter::MACHINE;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 #if defined(OS_WIN) 671 #if defined(OS_WIN)
667 SuppressWindowsErrorDialogs(); 672 SuppressWindowsErrorDialogs();
668 #endif 673 #endif
669 } 674 }
670 675
671 int ChromeMainDelegate::RunProcess( 676 int ChromeMainDelegate::RunProcess(
672 const std::string& process_type, 677 const std::string& process_type,
673 const content::MainFunctionParams& main_function_params) { 678 const content::MainFunctionParams& main_function_params) {
674 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize 679 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize
675 // doesn't support empty array. So we comment out the block for Android. 680 // doesn't support empty array. So we comment out the block for Android.
676 #if !defined(OS_ANDROID) 681 #if !defined(OS_ANDROID) && \
682 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_BROWSER))
677 static const MainFunction kMainFunctions[] = { 683 static const MainFunction kMainFunctions[] = {
678 { switches::kServiceProcess, ServiceProcessMain }, 684 { switches::kServiceProcess, ServiceProcessMain },
679 #if defined(OS_MACOSX) 685 #if defined(OS_MACOSX)
680 { switches::kRelauncherProcess, 686 { switches::kRelauncherProcess,
681 mac_relauncher::internal::RelauncherMain }, 687 mac_relauncher::internal::RelauncherMain },
682 #endif 688 #endif
683 // TODO(scottmg): http://crbug.com/237249 NaCl -> child. 689
684 #if !defined(DISABLE_NACL) 690 #if !defined(DISABLE_NACL) && \
691 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD))
685 { switches::kNaClLoaderProcess, NaClMain }, 692 { switches::kNaClLoaderProcess, NaClMain },
686 #endif // DISABLE_NACL 693 #endif // DISABLE_NACL
687 }; 694 };
688 695
689 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { 696 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) {
690 if (process_type == kMainFunctions[i].name) 697 if (process_type == kMainFunctions[i].name)
691 return kMainFunctions[i].function(main_function_params); 698 return kMainFunctions[i].function(main_function_params);
692 } 699 }
693 #endif 700 #endif
694 701
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 #if defined(OS_POSIX) && !defined(OS_MACOSX) 750 #if defined(OS_POSIX) && !defined(OS_MACOSX)
744 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets 751 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets
745 // this up for the browser process in a different manner. 752 // this up for the browser process in a different manner.
746 InitCrashReporter(); 753 InitCrashReporter();
747 #endif 754 #endif
748 } 755 }
749 756
750 #endif // OS_MACOSX 757 #endif // OS_MACOSX
751 758
752 content::ContentBrowserClient* 759 content::ContentBrowserClient*
753 ChromeMainDelegate::CreateContentBrowserClient() { 760 ChromeMainDelegate::CreateContentBrowserClient() {
761 #if defined(CHROME_MULTIPLE_DLL_CHILD)
762 return NULL;
763 #else
754 return &g_chrome_content_browser_client.Get(); 764 return &g_chrome_content_browser_client.Get();
765 #endif
755 } 766 }
756 767
757 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() { 768 content::ContentPluginClient* ChromeMainDelegate::CreateContentPluginClient() {
758 // TODO(scottmg): http://crbug.com/237249 This will have to be split out into 769 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
759 // browser and child parts. 770 return NULL;
771 #else
760 return &g_chrome_content_plugin_client.Get(); 772 return &g_chrome_content_plugin_client.Get();
773 #endif
761 } 774 }
762 775
763 content::ContentRendererClient* 776 content::ContentRendererClient*
764 ChromeMainDelegate::CreateContentRendererClient() { 777 ChromeMainDelegate::CreateContentRendererClient() {
778 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
779 return NULL;
780 #else
765 return &g_chrome_content_renderer_client.Get(); 781 return &g_chrome_content_renderer_client.Get();
782 #endif
766 } 783 }
767 784
768 content::ContentUtilityClient* 785 content::ContentUtilityClient*
769 ChromeMainDelegate::CreateContentUtilityClient() { 786 ChromeMainDelegate::CreateContentUtilityClient() {
787 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
788 return NULL;
789 #else
770 return &g_chrome_content_utility_client.Get(); 790 return &g_chrome_content_utility_client.Get();
791 #endif
771 } 792 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | chrome/app/client_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698