diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 13:55:21 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 13:55:21 +0000 |
commit | 1fec6435d5d98e899515a394b087236b729235f2 (patch) | |
tree | 911897d941ec4fd15a094c02e83fe38747387146 /chrome/browser/browser_main.h | |
parent | 05b0054aa9d9d48f5a7ded8d8488088e441c6fba (diff) | |
download | chromium_src-1fec6435d5d98e899515a394b087236b729235f2.zip chromium_src-1fec6435d5d98e899515a394b087236b729235f2.tar.gz chromium_src-1fec6435d5d98e899515a394b087236b729235f2.tar.bz2 |
BrowserMain() refactoring, part 2.
Add "MainMessageLoopStart()" and related platform methods to handle tasks
directly tied to the start of the main message loop.
BUG=none
TEST=everything still works
Review URL: http://codereview.chromium.org/2931007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.h')
-rw-r--r-- | chrome/browser/browser_main.h | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index 268c4b6..c7e8925 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(); |