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 <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 base::LazyInstance<ChromeContentBrowserClient>::DestructorAtExit | 163 base::LazyInstance<ChromeContentBrowserClient>::DestructorAtExit |
164 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; | 164 g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER; |
165 #endif | 165 #endif |
166 | 166 |
167 #if defined(OS_POSIX) | 167 #if defined(OS_POSIX) |
168 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 168 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = |
169 LAZY_INSTANCE_INITIALIZER; | 169 LAZY_INSTANCE_INITIALIZER; |
170 #endif | 170 #endif |
171 | 171 |
172 extern int NaClMain(const content::MainFunctionParams&); | 172 extern int NaClMain(const content::MainFunctionParams&); |
173 extern int ServiceProcessMain(const content::MainFunctionParams&); | 173 extern int CloudPrintServiceProcessMain(const content::MainFunctionParams&); |
174 | 174 |
175 namespace { | 175 namespace { |
176 | 176 |
177 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
178 // Early versions of Chrome incorrectly registered a chromehtml: URL handler, | 178 // Early versions of Chrome incorrectly registered a chromehtml: URL handler, |
179 // which gives us nothing but trouble. Avoid launching chrome this way since | 179 // which gives us nothing but trouble. Avoid launching chrome this way since |
180 // some apps fail to properly escape arguments. | 180 // some apps fail to properly escape arguments. |
181 bool HasDeprecatedArguments(const base::string16& command_line) { | 181 bool HasDeprecatedArguments(const base::string16& command_line) { |
182 const wchar_t kChromeHtml[] = L"chromehtml:"; | 182 const wchar_t kChromeHtml[] = L"chromehtml:"; |
183 base::string16 command_line_lower = base::ToLowerASCII(command_line); | 183 base::string16 command_line_lower = base::ToLowerASCII(command_line); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 DCHECK_GT(kMiscScore, 0); | 243 DCHECK_GT(kMiscScore, 0); |
244 DCHECK_GT(kPluginScore, 0); | 244 DCHECK_GT(kPluginScore, 0); |
245 | 245 |
246 if (process_type == switches::kPpapiPluginProcess) { | 246 if (process_type == switches::kPpapiPluginProcess) { |
247 score = kPluginScore; | 247 score = kPluginScore; |
248 } else if (process_type == switches::kPpapiBrokerProcess) { | 248 } else if (process_type == switches::kPpapiBrokerProcess) { |
249 // The broker should be killed before the PPAPI plugin. | 249 // The broker should be killed before the PPAPI plugin. |
250 score = kPluginScore + kScoreBump; | 250 score = kPluginScore + kScoreBump; |
251 } else if (process_type == switches::kUtilityProcess || | 251 } else if (process_type == switches::kUtilityProcess || |
252 process_type == switches::kGpuProcess || | 252 process_type == switches::kGpuProcess || |
253 process_type == switches::kServiceProcess) { | 253 process_type == switches::kCloudPrintServiceProcess) { |
254 score = kMiscScore; | 254 score = kMiscScore; |
255 #ifndef DISABLE_NACL | 255 #ifndef DISABLE_NACL |
256 } else if (process_type == switches::kNaClLoaderProcess || | 256 } else if (process_type == switches::kNaClLoaderProcess || |
257 process_type == switches::kNaClLoaderNonSfiProcess) { | 257 process_type == switches::kNaClLoaderNonSfiProcess) { |
258 score = kPluginScore; | 258 score = kPluginScore; |
259 #endif | 259 #endif |
260 } else if (process_type == switches::kZygoteProcess || | 260 } else if (process_type == switches::kZygoteProcess || |
261 process_type.empty()) { | 261 process_type.empty()) { |
262 // For zygotes and unlabeled process types, we want to still make | 262 // For zygotes and unlabeled process types, we want to still make |
263 // them killable by the OOM killer. | 263 // them killable by the OOM killer. |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 chrome_pdf::PPP_GetInterface, | 933 chrome_pdf::PPP_GetInterface, |
934 chrome_pdf::PPP_InitializeModule, | 934 chrome_pdf::PPP_InitializeModule, |
935 chrome_pdf::PPP_ShutdownModule); | 935 chrome_pdf::PPP_ShutdownModule); |
936 #endif | 936 #endif |
937 #endif | 937 #endif |
938 } | 938 } |
939 | 939 |
940 int ChromeMainDelegate::RunProcess( | 940 int ChromeMainDelegate::RunProcess( |
941 const std::string& process_type, | 941 const std::string& process_type, |
942 const content::MainFunctionParams& main_function_params) { | 942 const content::MainFunctionParams& main_function_params) { |
943 // ANDROID doesn't support "service", so no ServiceProcessMain, and arraysize | 943 // ANDROID doesn't support "cloud-print-service", so no |
944 // doesn't support empty array. So we comment out the block for Android. | 944 // CloudPrintServiceProcessMain, and arraysize doesn't support empty array. So |
| 945 // we comment out the block for Android. |
945 #if !defined(OS_ANDROID) | 946 #if !defined(OS_ANDROID) |
946 static const MainFunction kMainFunctions[] = { | 947 static const MainFunction kMainFunctions[] = { |
947 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(CHROME_MULTIPLE_DLL_CHILD) | 948 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(CHROME_MULTIPLE_DLL_CHILD) |
948 { switches::kServiceProcess, ServiceProcessMain }, | 949 {switches::kCloudPrintServiceProcess, CloudPrintServiceProcessMain}, |
949 #endif | 950 #endif |
950 | 951 |
951 #if defined(OS_MACOSX) | 952 #if defined(OS_MACOSX) |
952 { switches::kRelauncherProcess, | 953 {switches::kRelauncherProcess, mac_relauncher::internal::RelauncherMain}, |
953 mac_relauncher::internal::RelauncherMain }, | |
954 #endif | 954 #endif |
955 | 955 |
956 // This entry is not needed on Linux, where the NaCl loader | 956 // This entry is not needed on Linux, where the NaCl loader |
957 // process is launched via nacl_helper instead. | 957 // process is launched via nacl_helper instead. |
958 #if !defined(DISABLE_NACL) && !defined(CHROME_MULTIPLE_DLL_BROWSER) && \ | 958 #if !defined(DISABLE_NACL) && !defined(CHROME_MULTIPLE_DLL_BROWSER) && \ |
959 !defined(OS_LINUX) | 959 !defined(OS_LINUX) |
960 { switches::kNaClLoaderProcess, NaClMain }, | 960 {switches::kNaClLoaderProcess, NaClMain}, |
961 #else | 961 #else |
962 { "<invalid>", NULL }, // To avoid constant array of size 0 | 962 { "<invalid>", NULL }, // To avoid constant array of size 0 |
963 // when DISABLE_NACL and CHROME_MULTIPLE_DLL_CHILD | 963 // when DISABLE_NACL and CHROME_MULTIPLE_DLL_CHILD |
964 #endif // DISABLE_NACL | 964 #endif // DISABLE_NACL |
965 }; | 965 }; |
966 | 966 |
967 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { | 967 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { |
968 if (process_type == kMainFunctions[i].name) | 968 if (process_type == kMainFunctions[i].name) |
969 return kMainFunctions[i].function(main_function_params); | 969 return kMainFunctions[i].function(main_function_params); |
970 } | 970 } |
(...skipping 18 matching lines...) Expand all Loading... |
989 const std::string& process_type) { | 989 const std::string& process_type) { |
990 #if defined(DISABLE_NACL) | 990 #if defined(DISABLE_NACL) |
991 return false; | 991 return false; |
992 #else | 992 #else |
993 return process_type == switches::kNaClLoaderProcess; | 993 return process_type == switches::kNaClLoaderProcess; |
994 #endif | 994 #endif |
995 } | 995 } |
996 | 996 |
997 bool ChromeMainDelegate::ShouldSendMachPort(const std::string& process_type) { | 997 bool ChromeMainDelegate::ShouldSendMachPort(const std::string& process_type) { |
998 return process_type != switches::kRelauncherProcess && | 998 return process_type != switches::kRelauncherProcess && |
999 process_type != switches::kServiceProcess; | 999 process_type != switches::kCloudPrintServiceProcess; |
1000 } | 1000 } |
1001 | 1001 |
1002 bool ChromeMainDelegate::DelaySandboxInitialization( | 1002 bool ChromeMainDelegate::DelaySandboxInitialization( |
1003 const std::string& process_type) { | 1003 const std::string& process_type) { |
1004 #if !defined(DISABLE_NACL) | 1004 #if !defined(DISABLE_NACL) |
1005 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox(). | 1005 // NaClLoader does this in NaClMainPlatformDelegate::EnableSandbox(). |
1006 // No sandbox needed for relauncher. | 1006 // No sandbox needed for relauncher. |
1007 if (process_type == switches::kNaClLoaderProcess) | 1007 if (process_type == switches::kNaClLoaderProcess) |
1008 return true; | 1008 return true; |
1009 #endif | 1009 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 case version_info::Channel::CANARY: | 1084 case version_info::Channel::CANARY: |
1085 return true; | 1085 return true; |
1086 case version_info::Channel::DEV: | 1086 case version_info::Channel::DEV: |
1087 case version_info::Channel::BETA: | 1087 case version_info::Channel::BETA: |
1088 case version_info::Channel::STABLE: | 1088 case version_info::Channel::STABLE: |
1089 default: | 1089 default: |
1090 // Don't enable instrumentation. | 1090 // Don't enable instrumentation. |
1091 return false; | 1091 return false; |
1092 } | 1092 } |
1093 } | 1093 } |
OLD | NEW |