Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/chrome_browser_main.h

Issue 8477004: Have content/ create and destroy its own threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Temporary - look at browser_list, browser_main_loop, content/p/b/browser_shutdown Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/tracked_objects.h" 14 #include "base/tracked_objects.h"
15 #include "chrome/browser/first_run/first_run.h" 15 #include "chrome/browser/first_run/first_run.h"
16 #include "chrome/browser/process_singleton.h" 16 #include "chrome/browser/process_singleton.h"
17 #include "chrome/browser/ui/browser_init.h"
17 #include "content/public/browser/browser_main_parts.h" 18 #include "content/public/browser/browser_main_parts.h"
19 #include "content/public/browser/browser_thread.h"
18 20
19 class BrowserInit; 21 class BrowserInit;
20 class BrowserProcessImpl; 22 class BrowserProcessImpl;
21 class ChromeBrowserMainExtraParts; 23 class ChromeBrowserMainExtraParts;
22 class FieldTrialSynchronizer; 24 class FieldTrialSynchronizer;
23 class HistogramSynchronizer; 25 class HistogramSynchronizer;
24 class MetricsService; 26 class MetricsService;
25 class PrefService; 27 class PrefService;
26 class Profile; 28 class Profile;
27 class ShutdownWatcherHelper; 29 class ShutdownWatcherHelper;
(...skipping 24 matching lines...) Expand all
52 explicit ChromeBrowserMainParts( 54 explicit ChromeBrowserMainParts(
53 const content::MainFunctionParams& parameters); 55 const content::MainFunctionParams& parameters);
54 56
55 // content::BrowserMainParts overrides. 57 // content::BrowserMainParts overrides.
56 virtual void PreEarlyInitialization() OVERRIDE; 58 virtual void PreEarlyInitialization() OVERRIDE;
57 virtual void PostEarlyInitialization() OVERRIDE; 59 virtual void PostEarlyInitialization() OVERRIDE;
58 virtual void ToolkitInitialized() OVERRIDE; 60 virtual void ToolkitInitialized() OVERRIDE;
59 virtual void PreMainMessageLoopStart() OVERRIDE; 61 virtual void PreMainMessageLoopStart() OVERRIDE;
60 virtual void PostMainMessageLoopStart() OVERRIDE; 62 virtual void PostMainMessageLoopStart() OVERRIDE;
61 virtual void PreMainMessageLoopRun() OVERRIDE; 63 virtual void PreMainMessageLoopRun() OVERRIDE;
64 virtual void PreMainMessageLoopRunThreadsCreated() OVERRIDE;
62 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; 65 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
63 virtual void PostMainMessageLoopRun() OVERRIDE; 66 virtual void PostMainMessageLoopRun() OVERRIDE;
67 virtual void PreStopThread(content::BrowserThread::ID identifier) OVERRIDE;
68 virtual void PostStopThread(content::BrowserThread::ID identifier) OVERRIDE;
69 virtual void FinalCleanup() OVERRIDE;
64 70
65 // Displays a warning message that we can't find any locale data files. 71 // Displays a warning message that we can't find any locale data files.
66 virtual void ShowMissingLocaleMessageBox() = 0; 72 virtual void ShowMissingLocaleMessageBox() = 0;
67 73
68 const content::MainFunctionParams& parameters() const { 74 const content::MainFunctionParams& parameters() const {
69 return parameters_; 75 return parameters_;
70 } 76 }
71 const CommandLine& parsed_command_line() const { 77 const CommandLine& parsed_command_line() const {
72 return parsed_command_line_; 78 return parsed_command_line_;
73 } 79 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const CommandLine& parsed_command_line, 121 const CommandLine& parsed_command_line,
116 const PrefService* local_state); 122 const PrefService* local_state);
117 123
118 // Add an invocation of your field trial init function to this method. 124 // Add an invocation of your field trial init function to this method.
119 void SetupFieldTrials(bool metrics_recording_enabled, 125 void SetupFieldTrials(bool metrics_recording_enabled,
120 bool proxy_policy_is_set); 126 bool proxy_policy_is_set);
121 127
122 // Methods for Main Message Loop ------------------------------------------- 128 // Methods for Main Message Loop -------------------------------------------
123 129
124 int PreMainMessageLoopRunImpl(); 130 int PreMainMessageLoopRunImpl();
131 int PreMainMessageLoopRunThreadsCreatedImpl();
125 132
126 // Members initialized on construction --------------------------------------- 133 // Members initialized on construction ---------------------------------------
127 134
128 const content::MainFunctionParams& parameters_; 135 const content::MainFunctionParams& parameters_;
129 const CommandLine& parsed_command_line_; 136 const CommandLine& parsed_command_line_;
130 int result_code_; 137 int result_code_;
131 138
132 // Create ShutdownWatcherHelper object for watching jank during shutdown. 139 // Create ShutdownWatcherHelper object for watching jank during shutdown.
133 // Please keep |shutdown_watcher| as the first object constructed, and hence 140 // Please keep |shutdown_watcher| as the first object constructed, and hence
134 // it is destroyed last. 141 // it is destroyed last.
(...skipping 23 matching lines...) Expand all
158 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; 165 scoped_ptr<FirstRun::MasterPrefs> master_prefs_;
159 bool record_search_engine_; 166 bool record_search_engine_;
160 TranslateManager* translate_manager_; 167 TranslateManager* translate_manager_;
161 Profile* profile_; 168 Profile* profile_;
162 bool run_message_loop_; 169 bool run_message_loop_;
163 ProcessSingleton::NotifyResult notify_result_; 170 ProcessSingleton::NotifyResult notify_result_;
164 171
165 // Initialized in SetupMetricsAndFieldTrials. 172 // Initialized in SetupMetricsAndFieldTrials.
166 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; 173 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_;
167 174
175 // Members initialized in PreMainMessageLoopRun, needed in
176 // PreMainMessageLoopRunThreadsCreated.
177 bool is_first_run_;
178 bool first_run_ui_bypass_;
179 MetricsService* metrics_;
180 PrefService* local_state_;
181 FilePath user_data_dir_;
182
183 // Members needed across shutdown methods.
184 bool restart_last_session_;
185
168 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket); 186 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket);
169 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random); 187 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Random);
170 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid); 188 FRIEND_TEST(BrowserMainTest, WarmConnectionFieldTrial_Invalid);
171 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); 189 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts);
172 }; 190 };
173 191
174 // Records the conditions that can prevent Breakpad from generating and 192 // Records the conditions that can prevent Breakpad from generating and
175 // sending crash reports. The presence of a Breakpad handler (after 193 // sending crash reports. The presence of a Breakpad handler (after
176 // attempting to initialize crash reporting) and the presence of a debugger 194 // attempting to initialize crash reporting) and the presence of a debugger
177 // are registered with the UMA metrics service. 195 // are registered with the UMA metrics service.
178 void RecordBreakpadStatusUMA(MetricsService* metrics); 196 void RecordBreakpadStatusUMA(MetricsService* metrics);
179 197
180 // Displays a warning message if some minimum level of OS support is not 198 // Displays a warning message if some minimum level of OS support is not
181 // present on the current platform. 199 // present on the current platform.
182 void WarnAboutMinimumSystemRequirements(); 200 void WarnAboutMinimumSystemRequirements();
183 201
184 // Records the time from our process' startup to the present time in 202 // Records the time from our process' startup to the present time in
185 // the UMA histogram |metric_name|. 203 // the UMA histogram |metric_name|.
186 void RecordBrowserStartupTime(); 204 void RecordBrowserStartupTime();
187 205
188 // Records a time value to an UMA histogram in the context of the 206 // Records a time value to an UMA histogram in the context of the
189 // PreReadExperiment field-trial. This also reports to the appropriate 207 // PreReadExperiment field-trial. This also reports to the appropriate
190 // sub-histogram (_PreRead(Enabled|Disabled)). 208 // sub-histogram (_PreRead(Enabled|Disabled)).
191 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); 209 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time);
192 210
193 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ 211 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698