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

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

Issue 398323002: Fix Mac build with disable_nacl=1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: conditional #include Created 6 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 | « no previous file | no next file » | 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/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/common/chrome_version_info.h" 28 #include "chrome/common/chrome_version_info.h"
29 #include "chrome/common/crash_keys.h" 29 #include "chrome/common/crash_keys.h"
30 #include "chrome/common/logging_chrome.h" 30 #include "chrome/common/logging_chrome.h"
31 #include "chrome/common/profiling.h" 31 #include "chrome/common/profiling.h"
32 #include "chrome/common/switch_utils.h" 32 #include "chrome/common/switch_utils.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "chrome/plugin/chrome_content_plugin_client.h" 34 #include "chrome/plugin/chrome_content_plugin_client.h"
35 #include "chrome/renderer/chrome_content_renderer_client.h" 35 #include "chrome/renderer/chrome_content_renderer_client.h"
36 #include "chrome/utility/chrome_content_utility_client.h" 36 #include "chrome/utility/chrome_content_utility_client.h"
37 #include "components/component_updater/component_updater_paths.h" 37 #include "components/component_updater/component_updater_paths.h"
38 #include "components/nacl/common/nacl_switches.h"
39 #include "components/startup_metric_utils/startup_metric_utils.h" 38 #include "components/startup_metric_utils/startup_metric_utils.h"
40 #include "content/public/common/content_client.h" 39 #include "content/public/common/content_client.h"
41 #include "content/public/common/content_paths.h" 40 #include "content/public/common/content_paths.h"
42 #include "ui/base/ui_base_switches.h" 41 #include "ui/base/ui_base_switches.h"
43 42
44 #if defined(OS_WIN) 43 #if defined(OS_WIN)
45 #include <atlbase.h> 44 #include <atlbase.h>
46 #include <malloc.h> 45 #include <malloc.h>
47 #include <algorithm> 46 #include <algorithm>
48 #include "base/strings/string_util.h" 47 #include "base/strings/string_util.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 #endif 101 #endif
103 102
104 #if defined(OS_LINUX) 103 #if defined(OS_LINUX)
105 #include "base/environment.h" 104 #include "base/environment.h"
106 #endif 105 #endif
107 106
108 #if defined(OS_MACOSX) || defined(OS_WIN) 107 #if defined(OS_MACOSX) || defined(OS_WIN)
109 #include "chrome/browser/policy/policy_path_parser.h" 108 #include "chrome/browser/policy/policy_path_parser.h"
110 #endif 109 #endif
111 110
111 #if !defined(DISABLE_NACL)
112 #include "components/nacl/common/nacl_switches.h"
113 #endif
114
112 #if !defined(CHROME_MULTIPLE_DLL_CHILD) 115 #if !defined(CHROME_MULTIPLE_DLL_CHILD)
113 base::LazyInstance<chrome::ChromeContentBrowserClient> 116 base::LazyInstance<chrome::ChromeContentBrowserClient>
114 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; 117 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER;
115 #endif 118 #endif
116 119
117 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) 120 #if !defined(CHROME_MULTIPLE_DLL_BROWSER)
118 base::LazyInstance<ChromeContentRendererClient> 121 base::LazyInstance<ChromeContentRendererClient>
119 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER; 122 g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
120 base::LazyInstance<ChromeContentUtilityClient> 123 base::LazyInstance<ChromeContentUtilityClient>
121 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; 124 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Needed for scrollbar related images. 230 // Needed for scrollbar related images.
228 process_type == switches::kWorkerProcess || 231 process_type == switches::kWorkerProcess ||
229 #endif 232 #endif
230 #if defined(OS_POSIX) && !defined(OS_MACOSX) 233 #if defined(OS_POSIX) && !defined(OS_MACOSX)
231 // The zygote process opens the resources for the renderers. 234 // The zygote process opens the resources for the renderers.
232 process_type == switches::kZygoteProcess || 235 process_type == switches::kZygoteProcess ||
233 #endif 236 #endif
234 #if defined(OS_MACOSX) 237 #if defined(OS_MACOSX)
235 // Mac needs them too for scrollbar related images and for sandbox 238 // Mac needs them too for scrollbar related images and for sandbox
236 // profiles. 239 // profiles.
240 #if !defined(DISABLE_NACL)
237 process_type == switches::kNaClLoaderProcess || 241 process_type == switches::kNaClLoaderProcess ||
242 #endif
238 process_type == switches::kPpapiPluginProcess || 243 process_type == switches::kPpapiPluginProcess ||
239 process_type == switches::kPpapiBrokerProcess || 244 process_type == switches::kPpapiBrokerProcess ||
240 process_type == switches::kGpuProcess || 245 process_type == switches::kGpuProcess ||
241 #endif 246 #endif
242 process_type == switches::kRendererProcess || 247 process_type == switches::kRendererProcess ||
243 process_type == switches::kUtilityProcess; 248 process_type == switches::kUtilityProcess;
244 } 249 }
245 250
246 #if defined(OS_POSIX) 251 #if defined(OS_POSIX)
247 // Check for --version and --product-version; return true if we encountered 252 // Check for --version and --product-version; return true if we encountered
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 std::string last_three = 596 std::string last_three =
592 executable.value().substr(executable.value().size() - 3); 597 executable.value().substr(executable.value().size() - 3);
593 598
594 if (last_three == " EH") { 599 if (last_three == " EH") {
595 CHECK(process_type == switches::kPluginProcess || 600 CHECK(process_type == switches::kPluginProcess ||
596 process_type == switches::kUtilityProcess) 601 process_type == switches::kUtilityProcess)
597 << "Executable-heap process requires --type=" 602 << "Executable-heap process requires --type="
598 << switches::kPluginProcess << " or " 603 << switches::kPluginProcess << " or "
599 << switches::kUtilityProcess << ", saw " << process_type; 604 << switches::kUtilityProcess << ", saw " << process_type;
600 } else if (last_three == " NP") { 605 } else if (last_three == " NP") {
606 #if !defined(DISABLE_NACL)
601 CHECK_EQ(switches::kNaClLoaderProcess, process_type) 607 CHECK_EQ(switches::kNaClLoaderProcess, process_type)
602 << "Non-PIE process requires --type=" 608 << "Non-PIE process requires --type="
603 << switches::kNaClLoaderProcess << ", saw " << process_type; 609 << switches::kNaClLoaderProcess << ", saw " << process_type;
610 #endif
604 } else { 611 } else {
612 #if defined(DISABLE_NACL)
613 CHECK(process_type != switches::kPluginProcess)
614 << "Non-executable-heap PIE process is intolerant of --type="
615 << switches::kPluginProcess;
616 #else
605 CHECK(process_type != switches::kPluginProcess && 617 CHECK(process_type != switches::kPluginProcess &&
606 process_type != switches::kNaClLoaderProcess) 618 process_type != switches::kNaClLoaderProcess)
607 << "Non-executable-heap PIE process is intolerant of --type=" 619 << "Non-executable-heap PIE process is intolerant of --type="
608 << switches::kPluginProcess << " and " 620 << switches::kPluginProcess << " and "
609 << switches::kNaClLoaderProcess << ", saw " << process_type; 621 << switches::kNaClLoaderProcess << ", saw " << process_type;
622 #endif
610 } 623 }
611 } 624 }
612 } else { 625 } else {
613 CHECK(!command_line.HasSwitch(switches::kProcessType) && 626 CHECK(!command_line.HasSwitch(switches::kProcessType) &&
614 process_type.empty()) 627 process_type.empty())
615 << "Main application forbids --type, saw " << process_type; 628 << "Main application forbids --type, saw " << process_type;
616 } 629 }
617 630
618 if (breakpad::IsCrashReporterEnabled()) 631 if (breakpad::IsCrashReporterEnabled())
619 breakpad::InitCrashProcessInfo(process_type); 632 breakpad::InitCrashProcessInfo(process_type);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 logging::CleanupChromeLogging(); 835 logging::CleanupChromeLogging();
823 #else 836 #else
824 // Android doesn't use InitChromeLogging, so we close the log file manually. 837 // Android doesn't use InitChromeLogging, so we close the log file manually.
825 logging::CloseLogFile(); 838 logging::CloseLogFile();
826 #endif // !defined(OS_ANDROID) 839 #endif // !defined(OS_ANDROID)
827 } 840 }
828 841
829 #if defined(OS_MACOSX) 842 #if defined(OS_MACOSX)
830 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess( 843 bool ChromeMainDelegate::ProcessRegistersWithSystemProcess(
831 const std::string& process_type) { 844 const std::string& process_type) {
845 #if defined(DISABLE_NACL)
846 return false;
847 #else
832 return process_type == switches::kNaClLoaderProcess; 848 return process_type == switches::kNaClLoaderProcess;
849 #endif
833 } 850 }
834 851
835 bool ChromeMainDelegate::ShouldSendMachPort(const std::string& process_type) { 852 bool ChromeMainDelegate::ShouldSendMachPort(const std::string& process_type) {
836 return process_type != switches::kRelauncherProcess && 853 return process_type != switches::kRelauncherProcess &&
837 process_type != switches::kServiceProcess; 854 process_type != switches::kServiceProcess;
838 } 855 }
839 856
840 bool ChromeMainDelegate::DelaySandboxInitialization( 857 bool ChromeMainDelegate::DelaySandboxInitialization(
841 const std::string& process_type) { 858 const std::string& process_type) {
859 #if !defined(DISABLE_NACL)
842 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox(). 860 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox().
843 // No sandbox needed for relauncher. 861 // No sandbox needed for relauncher.
844 return process_type == switches::kNaClLoaderProcess || 862 if (process_type == switches::kNaClLoaderProcess)
845 process_type == switches::kRelauncherProcess; 863 return true;
864 #endif
865 return process_type == switches::kRelauncherProcess;
846 } 866 }
847 #elif defined(OS_POSIX) && !defined(OS_ANDROID) 867 #elif defined(OS_POSIX) && !defined(OS_ANDROID)
848 void ChromeMainDelegate::ZygoteStarting( 868 void ChromeMainDelegate::ZygoteStarting(
849 ScopedVector<content::ZygoteForkDelegate>* delegates) { 869 ScopedVector<content::ZygoteForkDelegate>* delegates) {
850 #if !defined(DISABLE_NACL) 870 #if !defined(DISABLE_NACL)
851 nacl::AddNaClZygoteForkDelegates(delegates); 871 nacl::AddNaClZygoteForkDelegates(delegates);
852 #endif 872 #endif
853 } 873 }
854 874
855 void ChromeMainDelegate::ZygoteForked() { 875 void ChromeMainDelegate::ZygoteForked() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 919 }
900 920
901 content::ContentUtilityClient* 921 content::ContentUtilityClient*
902 ChromeMainDelegate::CreateContentUtilityClient() { 922 ChromeMainDelegate::CreateContentUtilityClient() {
903 #if defined(CHROME_MULTIPLE_DLL_BROWSER) 923 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
904 return NULL; 924 return NULL;
905 #else 925 #else
906 return g_chrome_content_utility_client.Pointer(); 926 return g_chrome_content_utility_client.Pointer();
907 #endif 927 #endif
908 } 928 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698