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/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #include "chrome/common/chrome_result_codes.h" | 113 #include "chrome/common/chrome_result_codes.h" |
114 #include "chrome/common/chrome_switches.h" | 114 #include "chrome/common/chrome_switches.h" |
115 #include "chrome/common/crash_keys.h" | 115 #include "chrome/common/crash_keys.h" |
116 #include "chrome/common/env_vars.h" | 116 #include "chrome/common/env_vars.h" |
117 #include "chrome/common/features.h" | 117 #include "chrome/common/features.h" |
118 #include "chrome/common/logging_chrome.h" | 118 #include "chrome/common/logging_chrome.h" |
119 #include "chrome/common/media/media_resource_provider.h" | 119 #include "chrome/common/media/media_resource_provider.h" |
120 #include "chrome/common/net/net_resource_provider.h" | 120 #include "chrome/common/net/net_resource_provider.h" |
121 #include "chrome/common/pref_names.h" | 121 #include "chrome/common/pref_names.h" |
122 #include "chrome/common/profiling.h" | 122 #include "chrome/common/profiling.h" |
| 123 #include "chrome/common/stack_sampling_configuration.h" |
123 #include "chrome/common/variations/variations_util.h" | 124 #include "chrome/common/variations/variations_util.h" |
124 #include "chrome/grit/generated_resources.h" | 125 #include "chrome/grit/generated_resources.h" |
125 #include "chrome/installer/util/google_update_settings.h" | 126 #include "chrome/installer/util/google_update_settings.h" |
126 #include "components/component_updater/component_updater_service.h" | 127 #include "components/component_updater/component_updater_service.h" |
127 #include "components/device_event_log/device_event_log.h" | 128 #include "components/device_event_log/device_event_log.h" |
128 #include "components/flags_ui/pref_service_flags_storage.h" | 129 #include "components/flags_ui/pref_service_flags_storage.h" |
129 #include "components/google/core/browser/google_util.h" | 130 #include "components/google/core/browser/google_util.h" |
130 #include "components/language_usage_metrics/language_usage_metrics.h" | 131 #include "components/language_usage_metrics/language_usage_metrics.h" |
131 #include "components/metrics/call_stack_profile_metrics_provider.h" | 132 #include "components/metrics/call_stack_profile_metrics_provider.h" |
132 #include "components/metrics/metrics_reporting_default_state.h" | 133 #include "components/metrics/metrics_reporting_default_state.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 ChromeBrowserMainParts::ChromeBrowserMainParts( | 757 ChromeBrowserMainParts::ChromeBrowserMainParts( |
757 const content::MainFunctionParams& parameters) | 758 const content::MainFunctionParams& parameters) |
758 : parameters_(parameters), | 759 : parameters_(parameters), |
759 parsed_command_line_(parameters.command_line), | 760 parsed_command_line_(parameters.command_line), |
760 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 761 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
761 startup_watcher_(new StartupTimeBomb()), | 762 startup_watcher_(new StartupTimeBomb()), |
762 shutdown_watcher_(new ShutdownWatcherHelper()), | 763 shutdown_watcher_(new ShutdownWatcherHelper()), |
763 browser_field_trials_(parameters.command_line), | 764 browser_field_trials_(parameters.command_line), |
764 sampling_profiler_( | 765 sampling_profiler_( |
765 base::PlatformThread::CurrentId(), | 766 base::PlatformThread::CurrentId(), |
766 sampling_profiler_config_.GetSamplingParams(), | 767 StackSamplingConfiguration::Get()-> |
| 768 GetSamplingParamsForCurrentProcess(), |
767 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( | 769 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( |
768 metrics::CallStackProfileParams( | 770 metrics::CallStackProfileParams( |
769 metrics::CallStackProfileParams::BROWSER_PROCESS, | 771 metrics::CallStackProfileParams::BROWSER_PROCESS, |
770 metrics::CallStackProfileParams::UI_THREAD, | 772 metrics::CallStackProfileParams::UI_THREAD, |
771 metrics::CallStackProfileParams::PROCESS_STARTUP, | 773 metrics::CallStackProfileParams::PROCESS_STARTUP, |
772 metrics::CallStackProfileParams::MAY_SHUFFLE))), | 774 metrics::CallStackProfileParams::MAY_SHUFFLE))), |
773 profile_(NULL), | 775 profile_(NULL), |
774 run_message_loop_(true), | 776 run_message_loop_(true), |
775 local_state_(NULL) { | 777 local_state_(NULL) { |
776 if (sampling_profiler_config_.IsProfilerEnabled()) | 778 if (StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) |
777 sampling_profiler_.Start(); | 779 sampling_profiler_.Start(); |
778 | 780 |
779 // If we're running tests (ui_task is non-null). | 781 // If we're running tests (ui_task is non-null). |
780 if (parameters.ui_task) | 782 if (parameters.ui_task) |
781 browser_defaults::enable_help_app = false; | 783 browser_defaults::enable_help_app = false; |
782 | 784 |
783 // Chrome disallows cookies by default. All code paths that want to use | 785 // Chrome disallows cookies by default. All code paths that want to use |
784 // cookies need to go through one of Chrome's URLRequestContexts which have | 786 // cookies need to go through one of Chrome's URLRequestContexts which have |
785 // a ChromeNetworkDelegate attached that selectively allows cookies again. | 787 // a ChromeNetworkDelegate attached that selectively allows cookies again. |
786 net::URLRequest::SetDefaultCookiePolicyToBlock(); | 788 net::URLRequest::SetDefaultCookiePolicyToBlock(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 887 } |
886 | 888 |
887 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 889 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
888 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 890 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
889 // Even though base::Bind does AddRef and Release, the object will not be | 891 // Even though base::Bind does AddRef and Release, the object will not be |
890 // deleted after the Task is executed. | 892 // deleted after the Task is executed. |
891 field_trial_synchronizer_ = new FieldTrialSynchronizer(); | 893 field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
892 | 894 |
893 // Register a synthetic field trial for the sampling profiler configuration | 895 // Register a synthetic field trial for the sampling profiler configuration |
894 // that was already chosen. | 896 // that was already chosen. |
895 sampling_profiler_config_.RegisterSyntheticFieldTrial( | 897 StackSamplingConfiguration::Get()->RegisterSyntheticFieldTrial( |
896 base::Bind(&ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial)); | 898 base::Bind(&ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial)); |
897 | 899 |
898 #if defined(OS_WIN) || defined(OS_MACOSX) || \ | 900 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
899 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 901 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
900 metrics::DesktopSessionDurationTracker::Initialize(); | 902 metrics::DesktopSessionDurationTracker::Initialize(); |
901 #endif | 903 #endif |
902 | 904 |
903 #if defined(OS_WIN) | 905 #if defined(OS_WIN) |
904 // Cleanup the PreRead field trial registry key. | 906 // Cleanup the PreRead field trial registry key. |
905 // TODO(fdoray): Remove this when M56 hits stable. | 907 // TODO(fdoray): Remove this when M56 hits stable. |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2218 chromeos::CrosSettings::Shutdown(); | 2220 chromeos::CrosSettings::Shutdown(); |
2219 #endif // defined(OS_CHROMEOS) | 2221 #endif // defined(OS_CHROMEOS) |
2220 #endif // defined(OS_ANDROID) | 2222 #endif // defined(OS_ANDROID) |
2221 } | 2223 } |
2222 | 2224 |
2223 // Public members: | 2225 // Public members: |
2224 | 2226 |
2225 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2227 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2226 chrome_extra_parts_.push_back(parts); | 2228 chrome_extra_parts_.push_back(parts); |
2227 } | 2229 } |
OLD | NEW |