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 12 matching lines...) Expand all Loading... | |
23 #include "chrome/common/chrome_paths_internal.h" | 23 #include "chrome/common/chrome_paths_internal.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/chrome_version_info.h" |
26 #include "chrome/common/logging_chrome.h" | 26 #include "chrome/common/logging_chrome.h" |
27 #include "chrome/common/profiling.h" | 27 #include "chrome/common/profiling.h" |
28 #include "chrome/common/startup_metric_utils.h" | 28 #include "chrome/common/startup_metric_utils.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "chrome/plugin/chrome_content_plugin_client.h" | 30 #include "chrome/plugin/chrome_content_plugin_client.h" |
31 #include "chrome/renderer/chrome_content_renderer_client.h" | 31 #include "chrome/renderer/chrome_content_renderer_client.h" |
32 #include "chrome/utility/chrome_content_utility_client.h" | 32 #include "chrome/utility/chrome_content_utility_client.h" |
33 #include "components/nacl/common/nacl_switches.h" | |
33 #include "content/public/common/content_client.h" | 34 #include "content/public/common/content_client.h" |
34 #include "content/public/common/content_paths.h" | 35 #include "content/public/common/content_paths.h" |
35 #include "ui/base/ui_base_switches.h" | 36 #include "ui/base/ui_base_switches.h" |
36 | 37 |
37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
38 #include <algorithm> | 39 #include <algorithm> |
39 #include <atlbase.h> | 40 #include <atlbase.h> |
40 #include <malloc.h> | 41 #include <malloc.h> |
41 #include "base/strings/string_util.h" | 42 #include "base/strings/string_util.h" |
42 #include "sandbox/win/src/sandbox.h" | 43 #include "sandbox/win/src/sandbox.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
55 #include "chrome/common/mac/objc_zombie.h" | 56 #include "chrome/common/mac/objc_zombie.h" |
56 #include "grit/chromium_strings.h" | 57 #include "grit/chromium_strings.h" |
57 #include "ui/base/l10n/l10n_util_mac.h" | 58 #include "ui/base/l10n/l10n_util_mac.h" |
58 #endif | 59 #endif |
59 | 60 |
60 #if defined(OS_POSIX) | 61 #if defined(OS_POSIX) |
61 #include <locale.h> | 62 #include <locale.h> |
62 #include <signal.h> | 63 #include <signal.h> |
63 #endif | 64 #endif |
64 | 65 |
66 #if !defined(DISABLE_NACL) | |
65 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 67 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
66 #include "chrome/app/nacl_fork_delegate_linux.h" | 68 #include "components/nacl/common/nacl_fork_delegate_linux.h" |
69 #include "components/nacl/common/nacl_paths.h" | |
67 #endif | 70 #endif |
71 #endif // !defined(DISABLE_NACL) | |
68 | 72 |
69 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) |
70 #include "base/sys_info.h" | 74 #include "base/sys_info.h" |
71 #include "chrome/browser/chromeos/boot_times_loader.h" | 75 #include "chrome/browser/chromeos/boot_times_loader.h" |
72 #include "chromeos/chromeos_paths.h" | 76 #include "chromeos/chromeos_paths.h" |
73 #endif | 77 #endif |
74 | 78 |
75 #if defined(OS_ANDROID) | 79 #if defined(OS_ANDROID) |
76 #include "chrome/common/descriptors_android.h" | 80 #include "chrome/common/descriptors_android.h" |
77 #endif | 81 #endif |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 process_type == switches::kPpapiPluginProcess) { | 164 process_type == switches::kPpapiPluginProcess) { |
161 score = kPluginScore; | 165 score = kPluginScore; |
162 } else if (process_type == switches::kPpapiBrokerProcess) { | 166 } else if (process_type == switches::kPpapiBrokerProcess) { |
163 // The broker should be killed before the PPAPI plugin. | 167 // The broker should be killed before the PPAPI plugin. |
164 score = kPluginScore + kScoreBump; | 168 score = kPluginScore + kScoreBump; |
165 } else if (process_type == switches::kUtilityProcess || | 169 } else if (process_type == switches::kUtilityProcess || |
166 process_type == switches::kWorkerProcess || | 170 process_type == switches::kWorkerProcess || |
167 process_type == switches::kGpuProcess || | 171 process_type == switches::kGpuProcess || |
168 process_type == switches::kServiceProcess) { | 172 process_type == switches::kServiceProcess) { |
169 score = kMiscScore; | 173 score = kMiscScore; |
170 #ifndef DISABLE_NACL | 174 #if !defined(DISABLE_NACL) |
171 } else if (process_type == switches::kNaClLoaderProcess) { | 175 } else if (process_type == switches::kNaClLoaderProcess) { |
172 score = kPluginScore; | 176 score = kPluginScore; |
173 #endif | 177 #endif |
174 } else if (process_type == switches::kZygoteProcess || | 178 } else if (process_type == switches::kZygoteProcess || |
175 process_type.empty()) { | 179 process_type.empty()) { |
176 // For zygotes and unlabeled process types, we want to still make | 180 // For zygotes and unlabeled process types, we want to still make |
177 // them killable by the OOM killer. | 181 // them killable by the OOM killer. |
178 score = kZygoteScore; | 182 score = kZygoteScore; |
179 } else if (process_type == switches::kRendererProcess) { | 183 } else if (process_type == switches::kRendererProcess) { |
180 LOG(WARNING) << "process type 'renderer' " | 184 LOG(WARNING) << "process type 'renderer' " |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 | 471 |
468 void ChromeMainDelegate::PreSandboxStartup() { | 472 void ChromeMainDelegate::PreSandboxStartup() { |
469 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 473 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
470 std::string process_type = | 474 std::string process_type = |
471 command_line.GetSwitchValueASCII(switches::kProcessType); | 475 command_line.GetSwitchValueASCII(switches::kProcessType); |
472 | 476 |
473 chrome::RegisterPathProvider(); | 477 chrome::RegisterPathProvider(); |
474 #if defined(OS_CHROMEOS) | 478 #if defined(OS_CHROMEOS) |
475 chromeos::RegisterPathProvider(); | 479 chromeos::RegisterPathProvider(); |
476 #endif | 480 #endif |
481 #if !defined(DISABLE_NACL) | |
482 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
483 nacl::RegisterPathProvider(); | |
484 #endif | |
485 #endif // !defined(DISABLE_NACL) | |
477 | 486 |
478 #if defined(OS_MACOSX) | 487 #if defined(OS_MACOSX) |
479 // On the Mac, the child executable lives at a predefined location within | 488 // On the Mac, the child executable lives at a predefined location within |
480 // the app bundle's versioned directory. | 489 // the app bundle's versioned directory. |
481 PathService::Override(content::CHILD_PROCESS_EXE, | 490 PathService::Override(content::CHILD_PROCESS_EXE, |
482 chrome::GetVersionedDirectory(). | 491 chrome::GetVersionedDirectory(). |
483 Append(chrome::kHelperProcessExecutablePath)); | 492 Append(chrome::kHelperProcessExecutablePath)); |
484 | 493 |
485 InitMacCrashReporter(command_line, process_type); | 494 InitMacCrashReporter(command_line, process_type); |
486 #endif | 495 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 | 530 |
522 #if defined(OS_WIN) | 531 #if defined(OS_WIN) |
523 // TODO(darin): Kill this once http://crbug.com/52609 is fixed. | 532 // TODO(darin): Kill this once http://crbug.com/52609 is fixed. |
524 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); | 533 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); |
525 #endif | 534 #endif |
526 | 535 |
527 if (SubprocessNeedsResourceBundle(process_type)) { | 536 if (SubprocessNeedsResourceBundle(process_type)) { |
528 // Initialize ResourceBundle which handles files loaded from external | 537 // Initialize ResourceBundle which handles files loaded from external |
529 // sources. The language should have been passed in to us from the | 538 // sources. The language should have been passed in to us from the |
530 // browser process as a command line flag. | 539 // browser process as a command line flag. |
531 DCHECK(command_line.HasSwitch(switches::kLang) || | 540 #if defined(DISABLE_NACL) |
541 DCHECK(command_line.HasSwitch(switches::kLang) || | |
542 process_type == switches::kZygoteProcess || | |
543 process_type == switches::kGpuProcess || | |
cpu_(ooo_6.6-7.5)
2013/06/20 03:09:44
indenting seems off
| |
544 process_type == switches::kPpapiBrokerProcess || | |
545 process_type == switches::kPpapiPluginProcess); | |
546 #else | |
547 DCHECK(command_line.HasSwitch(switches::kLang) || | |
532 process_type == switches::kZygoteProcess || | 548 process_type == switches::kZygoteProcess || |
533 process_type == switches::kGpuProcess || | 549 process_type == switches::kGpuProcess || |
534 process_type == switches::kNaClLoaderProcess || | 550 process_type == switches::kNaClLoaderProcess || |
535 process_type == switches::kPpapiBrokerProcess || | 551 process_type == switches::kPpapiBrokerProcess || |
536 process_type == switches::kPpapiPluginProcess); | 552 process_type == switches::kPpapiPluginProcess); |
553 #endif | |
537 | 554 |
538 // TODO(markusheintz): The command line flag --lang is actually processed | 555 // TODO(markusheintz): The command line flag --lang is actually processed |
539 // by the CommandLinePrefStore, and made available through the PrefService | 556 // by the CommandLinePrefStore, and made available through the PrefService |
540 // via the preference prefs::kApplicationLocale. The browser process uses | 557 // via the preference prefs::kApplicationLocale. The browser process uses |
541 // the --lang flag to pass the value of the PrefService in here. Maybe | 558 // the --lang flag to pass the value of the PrefService in here. Maybe |
542 // this value could be passed in a different way. | 559 // this value could be passed in a different way. |
543 const std::string locale = | 560 const std::string locale = |
544 command_line.GetSwitchValueASCII(switches::kLang); | 561 command_line.GetSwitchValueASCII(switches::kLang); |
545 #if defined(OS_ANDROID) | 562 #if defined(OS_ANDROID) |
546 // The renderer sandbox prevents us from accessing our .pak files directly. | 563 // The renderer sandbox prevents us from accessing our .pak files directly. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
713 | 730 |
714 content::ContentRendererClient* | 731 content::ContentRendererClient* |
715 ChromeMainDelegate::CreateContentRendererClient() { | 732 ChromeMainDelegate::CreateContentRendererClient() { |
716 return &g_chrome_content_renderer_client.Get(); | 733 return &g_chrome_content_renderer_client.Get(); |
717 } | 734 } |
718 | 735 |
719 content::ContentUtilityClient* | 736 content::ContentUtilityClient* |
720 ChromeMainDelegate::CreateContentUtilityClient() { | 737 ChromeMainDelegate::CreateContentUtilityClient() { |
721 return &g_chrome_content_utility_client.Get(); | 738 return &g_chrome_content_utility_client.Get(); |
722 } | 739 } |
OLD | NEW |