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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.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 | 13 |
14 class BrowserThread; | 14 class BrowserThread; |
15 class CommandLine; | 15 class CommandLine; |
16 class FieldTrialSynchronizer; | |
17 class HighResolutionTimerManager; | 16 class HighResolutionTimerManager; |
18 struct MainFunctionParams; | 17 struct MainFunctionParams; |
19 class MessageLoop; | 18 class MessageLoop; |
20 class MetricsService; | 19 class MetricsService; |
21 class PrefService; | |
22 | 20 |
23 namespace net { | 21 namespace net { |
24 class NetworkChangeNotifier; | 22 class NetworkChangeNotifier; |
25 } | 23 } |
26 | 24 |
27 namespace ui { | 25 namespace ui { |
28 class SystemMonitor; | 26 class SystemMonitor; |
29 } | 27 } |
30 | 28 |
31 // BrowserMainParts: | 29 // BrowserMainParts: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // instantiate the appropriate subclass. | 73 // instantiate the appropriate subclass. |
76 static BrowserMainParts* CreateBrowserMainParts( | 74 static BrowserMainParts* CreateBrowserMainParts( |
77 const MainFunctionParams& parameters); | 75 const MainFunctionParams& parameters); |
78 | 76 |
79 virtual ~BrowserMainParts(); | 77 virtual ~BrowserMainParts(); |
80 | 78 |
81 // Parts to be called by |BrowserMain()|. | 79 // Parts to be called by |BrowserMain()|. |
82 void EarlyInitialization(); | 80 void EarlyInitialization(); |
83 void MainMessageLoopStart(); | 81 void MainMessageLoopStart(); |
84 | 82 |
85 // Constructs metrics service and does related initialization, including | 83 void SetupFieldTrials(); |
86 // creation of field trials. Call only after labs have been converted to | |
87 // switches. | |
88 MetricsService* SetupMetricsAndFieldTrials( | |
89 const CommandLine& parsed_command_line, | |
90 PrefService* local_state); | |
91 | 84 |
92 protected: | 85 protected: |
93 explicit BrowserMainParts(const MainFunctionParams& parameters); | 86 explicit BrowserMainParts(const MainFunctionParams& parameters); |
94 | 87 |
95 // Accessors for data members (below) ---------------------------------------- | 88 // Accessors for data members (below) ---------------------------------------- |
96 const MainFunctionParams& parameters() const { | 89 const MainFunctionParams& parameters() const { |
97 return parameters_; | 90 return parameters_; |
98 } | 91 } |
99 const CommandLine& parsed_command_line() const { | 92 const CommandLine& parsed_command_line() const { |
100 return parsed_command_line_; | 93 return parsed_command_line_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // A/B test for SSL False Start. | 125 // A/B test for SSL False Start. |
133 void SSLFalseStartFieldTrial(); | 126 void SSLFalseStartFieldTrial(); |
134 | 127 |
135 // Used to initialize NSPR where appropriate. | 128 // Used to initialize NSPR where appropriate. |
136 virtual void InitializeSSL() = 0; | 129 virtual void InitializeSSL() = 0; |
137 | 130 |
138 // Methods for |MainMessageLoopStart()| -------------------------------------- | 131 // Methods for |MainMessageLoopStart()| -------------------------------------- |
139 | 132 |
140 void InitializeMainThread(); | 133 void InitializeMainThread(); |
141 | 134 |
142 // Methods for |SetupMetricsAndFieldTrials()| -------------------------------- | |
143 | |
144 static MetricsService* InitializeMetrics( | |
145 const CommandLine& parsed_command_line, | |
146 const PrefService* local_state); | |
147 | |
148 // Add an invocation of your field trial init function to this method. | |
149 void SetupFieldTrials(); | |
150 | |
151 // Members initialized on construction --------------------------------------- | 135 // Members initialized on construction --------------------------------------- |
152 | 136 |
153 const MainFunctionParams& parameters_; | 137 const MainFunctionParams& parameters_; |
154 const CommandLine& parsed_command_line_; | 138 const CommandLine& parsed_command_line_; |
155 | 139 |
156 #if defined(TRACK_ALL_TASK_OBJECTS) | 140 #if defined(TRACK_ALL_TASK_OBJECTS) |
157 // Creating this object starts tracking the creation and deletion of Task | 141 // Creating this object starts tracking the creation and deletion of Task |
158 // instance. This MUST be done before main_message_loop, so that it is | 142 // instance. This MUST be done before main_message_loop, so that it is |
159 // destroyed after the main_message_loop. | 143 // destroyed after the main_message_loop. |
160 tracked_objects::AutoTracking tracking_objects_; | 144 tracked_objects::AutoTracking tracking_objects_; |
161 #endif | 145 #endif |
162 | 146 |
163 // Statistical testing infrastructure for the entire browser. NULL until | 147 // Statistical testing infrastructure for the entire browser. |
164 // SetupMetricsAndFieldTrials is called. | 148 base::FieldTrialList field_trial_; |
165 scoped_ptr<base::FieldTrialList> field_trial_list_; | |
166 | 149 |
167 // Members initialized in |MainMessageLoopStart()| --------------------------- | 150 // Members initialized in |MainMessageLoopStart()| --------------------------- |
168 scoped_ptr<MessageLoop> main_message_loop_; | 151 scoped_ptr<MessageLoop> main_message_loop_; |
169 scoped_ptr<ui::SystemMonitor> system_monitor_; | 152 scoped_ptr<ui::SystemMonitor> system_monitor_; |
170 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; | 153 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; |
171 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 154 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
172 scoped_ptr<BrowserThread> main_thread_; | 155 scoped_ptr<BrowserThread> main_thread_; |
173 | 156 |
174 // Initialized in SetupMetricsAndFieldTrials. | |
175 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; | |
176 | |
177 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); | 157 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); |
178 }; | 158 }; |
179 | 159 |
180 | 160 |
181 // Perform platform-specific work that needs to be done after the main event | 161 // Perform platform-specific work that needs to be done after the main event |
182 // loop has ended. | 162 // loop has ended. |
183 void DidEndMainMessageLoop(); | 163 void DidEndMainMessageLoop(); |
184 | 164 |
185 // Records the conditions that can prevent Breakpad from generating and | 165 // Records the conditions that can prevent Breakpad from generating and |
186 // sending crash reports. The presence of a Breakpad handler (after | 166 // sending crash reports. The presence of a Breakpad handler (after |
187 // attempting to initialize crash reporting) and the presence of a debugger | 167 // attempting to initialize crash reporting) and the presence of a debugger |
188 // are registered with the UMA metrics service. | 168 // are registered with the UMA metrics service. |
189 void RecordBreakpadStatusUMA(MetricsService* metrics); | 169 void RecordBreakpadStatusUMA(MetricsService* metrics); |
190 | 170 |
191 // Displays a warning message if some minimum level of OS support is not | 171 // Displays a warning message if some minimum level of OS support is not |
192 // present on the current platform. | 172 // present on the current platform. |
193 void WarnAboutMinimumSystemRequirements(); | 173 void WarnAboutMinimumSystemRequirements(); |
194 | 174 |
195 // Records the time from our process' startup to the present time in | 175 // Records the time from our process' startup to the present time in |
196 // the UMA histogram |metric_name|. | 176 // the UMA histogram |metric_name|. |
197 void RecordBrowserStartupTime(); | 177 void RecordBrowserStartupTime(); |
198 | 178 |
199 #endif // CHROME_BROWSER_BROWSER_MAIN_H_ | 179 #endif // CHROME_BROWSER_BROWSER_MAIN_H_ |
OLD | NEW |