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/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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 139 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
140 base::LazyInstance<ChromeContentPluginClient> | 140 base::LazyInstance<ChromeContentPluginClient> |
141 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 141 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
142 #endif | 142 #endif |
143 | 143 |
144 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 144 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
145 base::LazyInstance<ChromeContentBrowserClient> g_chrome_content_browser_client = | 145 base::LazyInstance<ChromeContentBrowserClient> g_chrome_content_browser_client = |
146 LAZY_INSTANCE_INITIALIZER; | 146 LAZY_INSTANCE_INITIALIZER; |
147 #endif | 147 #endif |
148 | 148 |
149 #if defined(OS_POSIX) || defined(OS_WIN) | 149 #if defined(OS_POSIX) |
150 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 150 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = |
151 LAZY_INSTANCE_INITIALIZER; | 151 LAZY_INSTANCE_INITIALIZER; |
152 #endif | 152 #endif |
153 | 153 |
154 extern int NaClMain(const content::MainFunctionParams&); | 154 extern int NaClMain(const content::MainFunctionParams&); |
155 extern int ServiceProcessMain(const content::MainFunctionParams&); | 155 extern int ServiceProcessMain(const content::MainFunctionParams&); |
156 | 156 |
157 namespace { | 157 namespace { |
158 | 158 |
159 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 } | 659 } |
660 #endif // defined(OS_MACOSX) | 660 #endif // defined(OS_MACOSX) |
661 | 661 |
662 void ChromeMainDelegate::PreSandboxStartup() { | 662 void ChromeMainDelegate::PreSandboxStartup() { |
663 const base::CommandLine& command_line = | 663 const base::CommandLine& command_line = |
664 *base::CommandLine::ForCurrentProcess(); | 664 *base::CommandLine::ForCurrentProcess(); |
665 std::string process_type = | 665 std::string process_type = |
666 command_line.GetSwitchValueASCII(switches::kProcessType); | 666 command_line.GetSwitchValueASCII(switches::kProcessType); |
667 | 667 |
668 #if defined(OS_POSIX) || defined(OS_WIN) | 668 #if defined(OS_POSIX) |
669 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); | 669 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); |
670 #endif | 670 #endif |
671 | 671 |
672 #if defined(OS_MACOSX) | 672 #if defined(OS_MACOSX) |
673 // On the Mac, the child executable lives at a predefined location within | 673 // On the Mac, the child executable lives at a predefined location within |
674 // the app bundle's versioned directory. | 674 // the app bundle's versioned directory. |
675 PathService::Override(content::CHILD_PROCESS_EXE, | 675 PathService::Override(content::CHILD_PROCESS_EXE, |
676 chrome::GetVersionedDirectory(). | 676 chrome::GetVersionedDirectory(). |
677 Append(chrome::kHelperProcessExecutablePath)); | 677 Append(chrome::kHelperProcessExecutablePath)); |
678 | 678 |
679 InitMacCrashReporter(command_line, process_type); | 679 InitMacCrashReporter(command_line, process_type); |
680 #endif | 680 #endif |
681 | 681 |
682 #if defined(OS_WIN) | 682 #if defined(OS_WIN) |
683 // TODO(scottmg): It would be nice to do this earlier to catch early crashes, | |
684 // perhaps as early as WinMain in chrome.exe. This would require some code | |
685 // restructuring to have paths and command lines set up, and also to handle | |
686 // having some of the code live in chrome.exe, while having the database be | |
687 // accessed by browser code in chrome.dll (to get a list of uploaded crashes | |
688 // for chrome://crashes). | |
689 crash_reporter::InitializeCrashpad(process_type.empty(), process_type); | |
690 #endif // OS_WIN | |
691 | |
692 #if defined(OS_WIN) | |
693 child_process_logging::Init(); | 683 child_process_logging::Init(); |
694 #endif | 684 #endif |
695 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 685 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
696 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 686 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
697 // cpu_brand info. | 687 // cpu_brand info. |
698 base::CPU cpu_info; | 688 base::CPU cpu_info; |
699 #endif | 689 #endif |
700 | 690 |
701 // Initialize the user data dir for any process type that needs it. | 691 // Initialize the user data dir for any process type that needs it. |
702 if (chrome::ProcessNeedsProfileDir(process_type)) | 692 if (chrome::ProcessNeedsProfileDir(process_type)) |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 case version_info::Channel::CANARY: | 980 case version_info::Channel::CANARY: |
991 return true; | 981 return true; |
992 case version_info::Channel::DEV: | 982 case version_info::Channel::DEV: |
993 case version_info::Channel::BETA: | 983 case version_info::Channel::BETA: |
994 case version_info::Channel::STABLE: | 984 case version_info::Channel::STABLE: |
995 default: | 985 default: |
996 // Don't enable instrumentation. | 986 // Don't enable instrumentation. |
997 return false; | 987 return false; |
998 } | 988 } |
999 } | 989 } |
OLD | NEW |