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

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: Fix official build, avoid DCHECK in official Linux/ChromeOS builds. Created 9 years 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
« no previous file with comments | « chrome/browser/browser_shutdown.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
51 protected: 53 protected:
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;
63 virtual void PreCreateThreads() OVERRIDE;
64 virtual void PreStartThread(content::BrowserThread::ID identifier) OVERRIDE;
65 virtual void PostStartThread(content::BrowserThread::ID identifier) OVERRIDE;
61 virtual void PreMainMessageLoopRun() OVERRIDE; 66 virtual void PreMainMessageLoopRun() OVERRIDE;
62 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; 67 virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
63 virtual void PostMainMessageLoopRun() OVERRIDE; 68 virtual void PostMainMessageLoopRun() OVERRIDE;
69 virtual void PreStopThread(content::BrowserThread::ID identifier) OVERRIDE;
70 virtual void PostStopThread(content::BrowserThread::ID identifier) OVERRIDE;
71 virtual void PostDestroyThreads() OVERRIDE;
64 72
65 // Displays a warning message that we can't find any locale data files. 73 // Displays a warning message that we can't find any locale data files.
66 virtual void ShowMissingLocaleMessageBox() = 0; 74 virtual void ShowMissingLocaleMessageBox() = 0;
67 75
68 const content::MainFunctionParams& parameters() const { 76 const content::MainFunctionParams& parameters() const {
69 return parameters_; 77 return parameters_;
70 } 78 }
71 const CommandLine& parsed_command_line() const { 79 const CommandLine& parsed_command_line() const {
72 return parsed_command_line_; 80 return parsed_command_line_;
73 } 81 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 static MetricsService* InitializeMetrics( 122 static MetricsService* InitializeMetrics(
115 const CommandLine& parsed_command_line, 123 const CommandLine& parsed_command_line,
116 const PrefService* local_state); 124 const PrefService* local_state);
117 125
118 // Add an invocation of your field trial init function to this method. 126 // Add an invocation of your field trial init function to this method.
119 void SetupFieldTrials(bool metrics_recording_enabled, 127 void SetupFieldTrials(bool metrics_recording_enabled,
120 bool proxy_policy_is_set); 128 bool proxy_policy_is_set);
121 129
122 // Methods for Main Message Loop ------------------------------------------- 130 // Methods for Main Message Loop -------------------------------------------
123 131
132 int PreCreateThreadsImpl();
124 int PreMainMessageLoopRunImpl(); 133 int PreMainMessageLoopRunImpl();
125 134
126 // Members initialized on construction --------------------------------------- 135 // Members initialized on construction ---------------------------------------
127 136
128 const content::MainFunctionParams& parameters_; 137 const content::MainFunctionParams& parameters_;
129 const CommandLine& parsed_command_line_; 138 const CommandLine& parsed_command_line_;
130 int result_code_; 139 int result_code_;
131 140
132 // Create ShutdownWatcherHelper object for watching jank during shutdown. 141 // Create ShutdownWatcherHelper object for watching jank during shutdown.
133 // Please keep |shutdown_watcher| as the first object constructed, and hence 142 // Please keep |shutdown_watcher| as the first object constructed, and hence
(...skipping 24 matching lines...) Expand all
158 scoped_ptr<FirstRun::MasterPrefs> master_prefs_; 167 scoped_ptr<FirstRun::MasterPrefs> master_prefs_;
159 bool record_search_engine_; 168 bool record_search_engine_;
160 TranslateManager* translate_manager_; 169 TranslateManager* translate_manager_;
161 Profile* profile_; 170 Profile* profile_;
162 bool run_message_loop_; 171 bool run_message_loop_;
163 ProcessSingleton::NotifyResult notify_result_; 172 ProcessSingleton::NotifyResult notify_result_;
164 173
165 // Initialized in SetupMetricsAndFieldTrials. 174 // Initialized in SetupMetricsAndFieldTrials.
166 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_; 175 scoped_refptr<FieldTrialSynchronizer> field_trial_synchronizer_;
167 176
177 // Members initialized in PreMainMessageLoopRun, needed in
178 // PreMainMessageLoopRunThreadsCreated.
179 bool is_first_run_;
180 bool first_run_ui_bypass_;
181 MetricsService* metrics_;
182 PrefService* local_state_;
183 FilePath user_data_dir_;
184
185 // Members needed across shutdown methods.
186 bool restart_last_session_;
187
168 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, 188 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest,
169 WarmConnectionFieldTrial_WarmestSocket); 189 WarmConnectionFieldTrial_WarmestSocket);
170 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Random); 190 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Random);
171 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Invalid); 191 FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Invalid);
172 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); 192 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts);
173 }; 193 };
174 194
175 // Records the conditions that can prevent Breakpad from generating and 195 // Records the conditions that can prevent Breakpad from generating and
176 // sending crash reports. The presence of a Breakpad handler (after 196 // sending crash reports. The presence of a Breakpad handler (after
177 // attempting to initialize crash reporting) and the presence of a debugger 197 // attempting to initialize crash reporting) and the presence of a debugger
178 // are registered with the UMA metrics service. 198 // are registered with the UMA metrics service.
179 void RecordBreakpadStatusUMA(MetricsService* metrics); 199 void RecordBreakpadStatusUMA(MetricsService* metrics);
180 200
181 // Displays a warning message if some minimum level of OS support is not 201 // Displays a warning message if some minimum level of OS support is not
182 // present on the current platform. 202 // present on the current platform.
183 void WarnAboutMinimumSystemRequirements(); 203 void WarnAboutMinimumSystemRequirements();
184 204
185 // Records the time from our process' startup to the present time in 205 // Records the time from our process' startup to the present time in
186 // the UMA histogram |metric_name|. 206 // the UMA histogram |metric_name|.
187 void RecordBrowserStartupTime(); 207 void RecordBrowserStartupTime();
188 208
189 // Records a time value to an UMA histogram in the context of the 209 // Records a time value to an UMA histogram in the context of the
190 // PreReadExperiment field-trial. This also reports to the appropriate 210 // PreReadExperiment field-trial. This also reports to the appropriate
191 // sub-histogram (_PreRead(Enabled|Disabled)). 211 // sub-histogram (_PreRead(Enabled|Disabled)).
192 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); 212 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time);
193 213
194 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ 214 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_shutdown.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698