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

Unified Diff: chrome/browser/browser_main.h

Issue 2931007: BrowserMain() refactoring, part 2. (Closed)
Patch Set: Updated per brettw and merged ToT. Created 10 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browser_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_main.h
diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h
index 268c4b610d8c16cf4840c86ac8a4fb10972ce32c..c7e892585232fe7b5e4d587c66f3505468cff234 100644
--- a/chrome/browser/browser_main.h
+++ b/chrome/browser/browser_main.h
@@ -8,11 +8,20 @@
#include "base/basictypes.h"
#include "base/field_trial.h"
+#include "base/scoped_ptr.h"
#include "base/tracked_objects.h"
+class ChromeThread;
class CommandLine;
+class HighResolutionTimerManager;
struct MainFunctionParams;
+class MessageLoop;
class MetricsService;
+class SystemMonitor;
+
+namespace net {
+class NetworkChangeNotifier;
+}
// BrowserMainParts:
// This class contains different "stages" to be executed in |BrowserMain()|,
@@ -34,6 +43,10 @@ class MetricsService;
// - EarlyInitialization: things which should be done as soon as possible on
// program start (such as setting up signal handlers) and things to be done
// at some generic time before the start of the main message loop.
+// - MainMessageLoopStart: things beginning with the start of the main message
+// loop and ending with initialization of the main thread; platform-specific
+// things which should be done immediately before the start of the main
+// message loop should go in |PreMainMessageLoopStart()|.
// - (more to come)
class BrowserMainParts {
public:
@@ -42,14 +55,11 @@ class BrowserMainParts {
static BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters);
+ virtual ~BrowserMainParts();
+
// Parts to be called by |BrowserMain()|.
void EarlyInitialization();
-
- // TODO(viettrungluu): This currently contains (POSIX) initialization done
- // later than "EarlyInitialization()" but dependent on it. Once the
- // refactoring includes that later stage, this should be put in some more
- // generic platform-dependent method.
- virtual void TemporaryPosix_1() {}
+ void MainMessageLoopStart();
protected:
explicit BrowserMainParts(const MainFunctionParams& parameters);
@@ -61,13 +71,18 @@ class BrowserMainParts {
const CommandLine& parsed_command_line() const {
return parsed_command_line_;
}
+ MessageLoop& main_message_loop() const {
+ return *main_message_loop_;
+ }
- private:
// Methods to be overridden to provide platform-specific code; these
// correspond to the "parts" above.
virtual void PreEarlyInitialization() {}
virtual void PostEarlyInitialization() {}
+ virtual void PreMainMessageLoopStart() {}
+ virtual void PostMainMessageLoopStart() {}
+ private:
// Methods for |EarlyInitialization()| ---------------------------------------
// A/B test for the maximum number of persistent connections per host.
@@ -82,6 +97,10 @@ class BrowserMainParts {
// Used to initialize NSPR where appropriate.
void InitializeSSL();
+ // Methods for |MainMessageLoopStart()| --------------------------------------
+
+ void InitializeMainThread();
+
// Members initialized on construction ---------------------------------------
const MainFunctionParams& parameters_;
@@ -97,14 +116,17 @@ class BrowserMainParts {
// Statistical testing infrastructure for the entire browser.
FieldTrialList field_trial_;
+ // Members initialized in |MainMessageLoopStart()| ---------------------------
+ scoped_ptr<MessageLoop> main_message_loop_;
+ scoped_ptr<SystemMonitor> system_monitor_;
+ scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_;
+ scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
+ scoped_ptr<ChromeThread> main_thread_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserMainParts);
};
-// Perform platform-specific work that needs to be done before the main
-// message loop is created, initialized, and entered.
-void WillInitializeMainMessageLoop(const MainFunctionParams& parameters);
-
// Perform platform-specific work that needs to be done after the main event
// loop has ended.
void DidEndMainMessageLoop();
« no previous file with comments | « no previous file | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698