| 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 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 5 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| 6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 virtual void ShowMissingLocaleMessageBox() = 0; | 81 virtual void ShowMissingLocaleMessageBox() = 0; |
| 82 | 82 |
| 83 const content::MainFunctionParams& parameters() const { | 83 const content::MainFunctionParams& parameters() const { |
| 84 return parameters_; | 84 return parameters_; |
| 85 } | 85 } |
| 86 const CommandLine& parsed_command_line() const { | 86 const CommandLine& parsed_command_line() const { |
| 87 return parsed_command_line_; | 87 return parsed_command_line_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 Profile* profile() { return profile_; } | 90 Profile* profile() { return profile_; } |
| 91 MetricsService* metrics() { return metrics_; } | |
| 92 | 91 |
| 93 private: | 92 private: |
| 94 // Methods for |EarlyInitialization()| --------------------------------------- | 93 // Methods for |EarlyInitialization()| --------------------------------------- |
| 95 | 94 |
| 96 // A/B test for the maximum number of persistent connections per host. | 95 // A/B test for the maximum number of persistent connections per host. |
| 97 void ConnectionFieldTrial(); | 96 void ConnectionFieldTrial(); |
| 98 | 97 |
| 99 // A/B test for determining a value for unused socket timeout. | 98 // A/B test for determining a value for unused socket timeout. |
| 100 void SocketTimeoutFieldTrial(); | 99 void SocketTimeoutFieldTrial(); |
| 101 | 100 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 | 121 |
| 123 // A field trial to see what effects launching Chrome automatically on | 122 // A field trial to see what effects launching Chrome automatically on |
| 124 // computer startup has on retention and usage of Chrome. | 123 // computer startup has on retention and usage of Chrome. |
| 125 void AutoLaunchChromeFieldTrial(); | 124 void AutoLaunchChromeFieldTrial(); |
| 126 | 125 |
| 127 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- | 126 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- |
| 128 | 127 |
| 129 // Constructs metrics service and does related initialization, including | 128 // Constructs metrics service and does related initialization, including |
| 130 // creation of field trials. Call only after labs have been converted to | 129 // creation of field trials. Call only after labs have been converted to |
| 131 // switches. | 130 // switches. |
| 132 MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); | 131 void SetupMetricsAndFieldTrials(); |
| 133 | |
| 134 static MetricsService* InitializeMetrics( | |
| 135 const CommandLine& parsed_command_line, | |
| 136 const PrefService* local_state); | |
| 137 | 132 |
| 138 // Add an invocation of your field trial init function to this method. | 133 // Add an invocation of your field trial init function to this method. |
| 139 void SetupFieldTrials(bool metrics_recording_enabled, | 134 void SetupFieldTrials(bool metrics_recording_enabled, |
| 140 bool proxy_policy_is_set); | 135 bool proxy_policy_is_set); |
| 141 | 136 |
| 137 // Starts recording of metrics. This can only be called after we have a file |
| 138 // thread. |
| 139 void StartMetricsRecording(); |
| 140 |
| 142 // Methods for Main Message Loop ------------------------------------------- | 141 // Methods for Main Message Loop ------------------------------------------- |
| 143 | 142 |
| 144 int PreCreateThreadsImpl(); | 143 int PreCreateThreadsImpl(); |
| 145 int PreMainMessageLoopRunImpl(); | 144 int PreMainMessageLoopRunImpl(); |
| 146 | 145 |
| 147 // Members initialized on construction --------------------------------------- | 146 // Members initialized on construction --------------------------------------- |
| 148 | 147 |
| 149 const content::MainFunctionParams& parameters_; | 148 const content::MainFunctionParams& parameters_; |
| 150 const CommandLine& parsed_command_line_; | 149 const CommandLine& parsed_command_line_; |
| 151 int result_code_; | 150 int result_code_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bool run_message_loop_; | 185 bool run_message_loop_; |
| 187 ProcessSingleton::NotifyResult notify_result_; | 186 ProcessSingleton::NotifyResult notify_result_; |
| 188 | 187 |
| 189 // Initialized in SetupMetricsAndFieldTrials. | 188 // Initialized in SetupMetricsAndFieldTrials. |
| 190 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; | 189 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; |
| 191 | 190 |
| 192 // Members initialized in PreMainMessageLoopRun, needed in | 191 // Members initialized in PreMainMessageLoopRun, needed in |
| 193 // PreMainMessageLoopRunThreadsCreated. | 192 // PreMainMessageLoopRunThreadsCreated. |
| 194 bool is_first_run_; | 193 bool is_first_run_; |
| 195 bool first_run_ui_bypass_; | 194 bool first_run_ui_bypass_; |
| 196 MetricsService* metrics_; | |
| 197 PrefService* local_state_; | 195 PrefService* local_state_; |
| 198 FilePath user_data_dir_; | 196 FilePath user_data_dir_; |
| 199 | 197 |
| 200 // Members needed across shutdown methods. | 198 // Members needed across shutdown methods. |
| 201 bool restart_last_session_; | 199 bool restart_last_session_; |
| 202 | 200 |
| 203 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, | 201 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, |
| 204 WarmConnectionFieldTrial_WarmestSocket); | 202 WarmConnectionFieldTrial_WarmestSocket); |
| 205 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Random); | 203 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Random); |
| 206 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Invalid); | 204 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Invalid); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 220 // Records the time from our process' startup to the present time in | 218 // Records the time from our process' startup to the present time in |
| 221 // the UMA histogram |metric_name|. | 219 // the UMA histogram |metric_name|. |
| 222 void RecordBrowserStartupTime(); | 220 void RecordBrowserStartupTime(); |
| 223 | 221 |
| 224 // Records a time value to an UMA histogram in the context of the | 222 // Records a time value to an UMA histogram in the context of the |
| 225 // PreReadExperiment field-trial. This also reports to the appropriate | 223 // PreReadExperiment field-trial. This also reports to the appropriate |
| 226 // sub-histogram (_PreRead(Enabled|Disabled)). | 224 // sub-histogram (_PreRead(Enabled|Disabled)). |
| 227 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 225 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
| 228 | 226 |
| 229 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 227 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| OLD | NEW |