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/environment.h" | 8 #include "base/environment.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
14 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/process/memory.h" | 16 #include "base/process/memory.h" |
17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "chrome/browser/chrome_content_browser_client.h" | 21 #include "chrome/browser/chrome_content_browser_client.h" |
22 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
23 #include "chrome/browser/policy/policy_path_parser.h" | 23 #include "chrome/browser/policy/policy_path_parser.h" |
24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_content_client.h" | 25 #include "chrome/common/chrome_content_client.h" |
26 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_paths_internal.h" | 27 #include "chrome/common/chrome_paths_internal.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
| 30 #include "chrome/common/crash_keys.h" |
30 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
31 #include "chrome/common/profiling.h" | 32 #include "chrome/common/profiling.h" |
32 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
33 #include "chrome/plugin/chrome_content_plugin_client.h" | 34 #include "chrome/plugin/chrome_content_plugin_client.h" |
34 #include "chrome/renderer/chrome_content_renderer_client.h" | 35 #include "chrome/renderer/chrome_content_renderer_client.h" |
35 #include "chrome/utility/chrome_content_utility_client.h" | 36 #include "chrome/utility/chrome_content_utility_client.h" |
36 #include "components/nacl/common/nacl_switches.h" | 37 #include "components/nacl/common/nacl_switches.h" |
37 #include "components/startup_metric_utils/startup_metric_utils.h" | 38 #include "components/startup_metric_utils/startup_metric_utils.h" |
38 #include "content/public/common/content_client.h" | 39 #include "content/public/common/content_client.h" |
39 #include "content/public/common/content_paths.h" | 40 #include "content/public/common/content_paths.h" |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 // sets this up for the browser process in a different manner. Zygotes | 738 // sets this up for the browser process in a different manner. Zygotes |
738 // need to call InitCrashReporter() in RunZygote(). | 739 // need to call InitCrashReporter() in RunZygote(). |
739 if (!process_type.empty() && process_type != switches::kZygoteProcess) { | 740 if (!process_type.empty() && process_type != switches::kZygoteProcess) { |
740 #if defined(OS_ANDROID) | 741 #if defined(OS_ANDROID) |
741 InitNonBrowserCrashReporterForAndroid(); | 742 InitNonBrowserCrashReporterForAndroid(); |
742 #else | 743 #else |
743 InitCrashReporter(); | 744 InitCrashReporter(); |
744 #endif | 745 #endif |
745 } | 746 } |
746 #endif | 747 #endif |
| 748 |
| 749 // After all the platform Breakpads have been initialized, store the command |
| 750 // line for crash reporting. |
| 751 crash_keys::SetSwitchesFromCommandLine(&command_line); |
747 } | 752 } |
748 | 753 |
749 void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { | 754 void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { |
750 startup_timer_->Stop(); // End of Startup Time Measurement. | 755 startup_timer_->Stop(); // End of Startup Time Measurement. |
751 | 756 |
752 // Note: If you are adding a new process type below, be sure to adjust the | 757 // Note: If you are adding a new process type below, be sure to adjust the |
753 // AdjustLinuxOOMScore function too. | 758 // AdjustLinuxOOMScore function too. |
754 #if defined(OS_LINUX) | 759 #if defined(OS_LINUX) |
755 AdjustLinuxOOMScore(process_type); | 760 AdjustLinuxOOMScore(process_type); |
756 #endif | 761 #endif |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 Profiling::ProcessStarted(); | 839 Profiling::ProcessStarted(); |
835 if (Profiling::BeingProfiled()) { | 840 if (Profiling::BeingProfiled()) { |
836 base::debug::RestartProfilingAfterFork(); | 841 base::debug::RestartProfilingAfterFork(); |
837 SetUpProfilingShutdownHandler(); | 842 SetUpProfilingShutdownHandler(); |
838 } | 843 } |
839 | 844 |
840 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 845 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
841 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 846 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
842 // this up for the browser process in a different manner. | 847 // this up for the browser process in a different manner. |
843 InitCrashReporter(); | 848 InitCrashReporter(); |
| 849 |
| 850 // Reset the command line for the newly spawned process. |
| 851 crash_keys::SetSwitchesFromCommandLine(CommandLine::ForCurrentProcess()); |
844 #endif | 852 #endif |
845 } | 853 } |
846 | 854 |
847 #endif // OS_MACOSX | 855 #endif // OS_MACOSX |
848 | 856 |
849 content::ContentBrowserClient* | 857 content::ContentBrowserClient* |
850 ChromeMainDelegate::CreateContentBrowserClient() { | 858 ChromeMainDelegate::CreateContentBrowserClient() { |
851 #if defined(CHROME_MULTIPLE_DLL_CHILD) | 859 #if defined(CHROME_MULTIPLE_DLL_CHILD) |
852 return NULL; | 860 return NULL; |
853 #else | 861 #else |
(...skipping 19 matching lines...) Expand all Loading... |
873 } | 881 } |
874 | 882 |
875 content::ContentUtilityClient* | 883 content::ContentUtilityClient* |
876 ChromeMainDelegate::CreateContentUtilityClient() { | 884 ChromeMainDelegate::CreateContentUtilityClient() { |
877 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 885 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
878 return NULL; | 886 return NULL; |
879 #else | 887 #else |
880 return &g_chrome_content_utility_client.Get(); | 888 return &g_chrome_content_utility_client.Get(); |
881 #endif | 889 #endif |
882 } | 890 } |
OLD | NEW |