| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::string trial_name, group_name; | 897 std::string trial_name, group_name; |
| 896 if (sampling_profiler_config_.GetSyntheticFieldTrial(&trial_name, | 898 if (StackSamplingConfiguration::Get()->GetSyntheticFieldTrial(&trial_name, |
| 897 &group_name)) { | 899 &group_name)) { |
| 898 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(trial_name, | 900 ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(trial_name, |
| 899 group_name); | 901 group_name); |
| 900 } | 902 } |
| 901 | 903 |
| 902 #if defined(OS_WIN) || defined(OS_MACOSX) || \ | 904 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
| 903 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 905 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 904 metrics::DesktopSessionDurationTracker::Initialize(); | 906 metrics::DesktopSessionDurationTracker::Initialize(); |
| 905 #endif | 907 #endif |
| 906 | 908 |
| 907 #if defined(OS_WIN) | 909 #if defined(OS_WIN) |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 chromeos::CrosSettings::Shutdown(); | 2225 chromeos::CrosSettings::Shutdown(); |
| 2224 #endif // defined(OS_CHROMEOS) | 2226 #endif // defined(OS_CHROMEOS) |
| 2225 #endif // defined(OS_ANDROID) | 2227 #endif // defined(OS_ANDROID) |
| 2226 } | 2228 } |
| 2227 | 2229 |
| 2228 // Public members: | 2230 // Public members: |
| 2229 | 2231 |
| 2230 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2232 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2231 chrome_extra_parts_.push_back(parts); | 2233 chrome_extra_parts_.push_back(parts); |
| 2232 } | 2234 } |
| OLD | NEW |