OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_MAIN_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_MAIN_H_ |
6 #define CHROME_BROWSER_BROWSER_MAIN_H_ | 6 #define CHROME_BROWSER_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" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/tracked_objects.h" | 12 #include "base/tracked_objects.h" |
| 13 #include "chrome/browser/first_run/first_run.h" |
13 #include "content/browser/browser_main.h" | 14 #include "content/browser/browser_main.h" |
14 | 15 |
| 16 class BrowserProcessImpl; |
15 class FieldTrialSynchronizer; | 17 class FieldTrialSynchronizer; |
16 class HistogramSynchronizer; | 18 class HistogramSynchronizer; |
17 class MetricsService; | 19 class MetricsService; |
18 class PrefService; | 20 class PrefService; |
| 21 class ProcessSingleton; |
| 22 class Profile; |
19 class ShutdownWatcherHelper; | 23 class ShutdownWatcherHelper; |
| 24 class TranslateManager; |
20 | 25 |
21 namespace chrome_browser { | 26 namespace chrome_browser { |
22 // For use by ShowMissingLocaleMessageBox. | 27 // For use by ShowMissingLocaleMessageBox. |
23 extern const char kMissingLocaleDataTitle[]; | 28 extern const char kMissingLocaleDataTitle[]; |
24 extern const char kMissingLocaleDataMessage[]; | 29 extern const char kMissingLocaleDataMessage[]; |
25 } | 30 } |
26 | 31 |
27 class ChromeBrowserMainParts : public content::BrowserMainParts { | 32 class ChromeBrowserMainParts : public content::BrowserMainParts { |
28 public: | 33 public: |
29 virtual ~ChromeBrowserMainParts(); | 34 virtual ~ChromeBrowserMainParts(); |
30 | 35 |
31 // Constructs HistogramSynchronizer which gets released early (before | |
32 // main_message_loop_). | |
33 void SetupHistogramSynchronizer(); | |
34 | |
35 // Constructs metrics service and does related initialization, including | 36 // Constructs metrics service and does related initialization, including |
36 // creation of field trials. Call only after labs have been converted to | 37 // creation of field trials. Call only after labs have been converted to |
37 // switches. | 38 // switches. |
38 MetricsService* SetupMetricsAndFieldTrials( | 39 MetricsService* SetupMetricsAndFieldTrials( |
39 const CommandLine& parsed_command_line, | 40 const CommandLine& parsed_command_line, |
40 PrefService* local_state); | 41 PrefService* local_state); |
41 | 42 |
42 protected: | 43 protected: |
43 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); | 44 explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); |
44 | 45 |
45 virtual void PostMainMessageLoopStart() OVERRIDE; | 46 virtual void PostMainMessageLoopStart() OVERRIDE; |
| 47 virtual void PreMainMessageLoopRun() OVERRIDE; |
| 48 int PreMainMessageLoopRunInternal(); |
| 49 virtual void MainMessageLoopRun() OVERRIDE; |
| 50 virtual void PostMainMessageLoopRun() OVERRIDE; |
46 virtual void ToolkitInitialized() OVERRIDE; | 51 virtual void ToolkitInitialized() OVERRIDE; |
47 | 52 |
48 virtual int TemporaryContinue() OVERRIDE; | |
49 | |
50 private: | 53 private: |
51 // Methods for |EarlyInitialization()| --------------------------------------- | 54 // Methods for |EarlyInitialization()| --------------------------------------- |
52 | 55 |
53 // A/B test for the maximum number of persistent connections per host. | 56 // A/B test for the maximum number of persistent connections per host. |
54 void ConnectionFieldTrial(); | 57 void ConnectionFieldTrial(); |
55 | 58 |
56 // A/B test for determining a value for unused socket timeout. | 59 // A/B test for determining a value for unused socket timeout. |
57 void SocketTimeoutFieldTrial(); | 60 void SocketTimeoutFieldTrial(); |
58 | 61 |
59 // A/B test for the maximum number of connections per proxy server. | 62 // A/B test for the maximum number of connections per proxy server. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // destroyed after the main_message_loop. | 98 // destroyed after the main_message_loop. |
96 tracked_objects::AutoTracking tracking_objects_; | 99 tracked_objects::AutoTracking tracking_objects_; |
97 #endif | 100 #endif |
98 | 101 |
99 // Statistical testing infrastructure for the entire browser. NULL until | 102 // Statistical testing infrastructure for the entire browser. NULL until |
100 // SetupMetricsAndFieldTrials is called. | 103 // SetupMetricsAndFieldTrials is called. |
101 scoped_ptr<base::FieldTrialList> field_trial_list_; | 104 scoped_ptr<base::FieldTrialList> field_trial_list_; |
102 | 105 |
103 // Members initialized after / released before main_message_loop_ ------------ | 106 // Members initialized after / released before main_message_loop_ ------------ |
104 | 107 |
105 // Initialized in SetupHistogramSynchronizer. | 108 scoped_ptr<BrowserProcessImpl> browser_process_; |
106 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; | 109 scoped_refptr<HistogramSynchronizer> histogram_synchronizer_; |
| 110 scoped_ptr<ProcessSingleton> process_singleton_; |
| 111 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; |
| 112 bool record_search_engine_; |
| 113 TranslateManager* translate_manager_; |
| 114 Profile* profile_; |
| 115 bool run_message_loop_; |
107 | 116 |
108 // Initialized in SetupMetricsAndFieldTrials. | 117 // Initialized in SetupMetricsAndFieldTrials. |
109 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; | 118 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; |
110 | 119 |
111 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket); | 120 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket); |
112 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random); | 121 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random); |
113 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid); | 122 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid); |
114 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); | 123 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); |
115 }; | 124 }; |
116 | 125 |
(...skipping 13 matching lines...) Expand all Loading... |
130 // Records the time from our process' startup to the present time in | 139 // Records the time from our process' startup to the present time in |
131 // the UMA histogram |metric_name|. | 140 // the UMA histogram |metric_name|. |
132 void RecordBrowserStartupTime(); | 141 void RecordBrowserStartupTime(); |
133 | 142 |
134 // Records a time value to an UMA histogram in the context of the | 143 // Records a time value to an UMA histogram in the context of the |
135 // PreReadExperiment field-trial. This also reports to the appropriate | 144 // PreReadExperiment field-trial. This also reports to the appropriate |
136 // sub-histogram (_PreRead(Enabled|Disabled)). | 145 // sub-histogram (_PreRead(Enabled|Disabled)). |
137 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | 146 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); |
138 | 147 |
139 #endif // CHROME_BROWSER_BROWSER_MAIN_H_ | 148 #endif // CHROME_BROWSER_BROWSER_MAIN_H_ |
OLD | NEW |