summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_main.h
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 18:03:30 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 18:03:30 +0000
commitb48c918f8397747d9a157a87a5cfc63eeed74710 (patch)
tree20bf06e2bb203915d5e135498538550d6b891e4f /content/browser/browser_main.h
parent45952868429c278087b68d0e0e96f33ec70388fa (diff)
downloadchromium_src-b48c918f8397747d9a157a87a5cfc63eeed74710.zip
chromium_src-b48c918f8397747d9a157a87a5cfc63eeed74710.tar.gz
chromium_src-b48c918f8397747d9a157a87a5cfc63eeed74710.tar.bz2
Make GTK and Aura parts orthogonal to OS parts
This CL moves GTK and Aura "Parts" out of the primary BrowserMainParts tree and into orthogonal parts that can be added independently. This was done in a way that will facilitate adding additional parts if (when) we need them. The motivation for this was to a) eliminate the existing typedef in chrome_browser_main_chromeos.h b) reduce the number of #ifdefs required in the setup / parts code For an outline of the new parts see: https://docs.google.com/drawings/d/1-gIMl-81c4SvcMrT1xaxnDGibDe7VQfMkFT1bMnIvrg/edit?hl=en_US Please consider this a proposal; I am entirely open to feedback. BUG=none TEST=Chrome compiles and passes tests on all platfroms. Review URL: http://codereview.chromium.org/8302016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_main.h')
-rw-r--r--content/browser/browser_main.h112
1 files changed, 0 insertions, 112 deletions
diff --git a/content/browser/browser_main.h b/content/browser/browser_main.h
index ec1121f..86370bb 100644
--- a/content/browser/browser_main.h
+++ b/content/browser/browser_main.h
@@ -7,124 +7,12 @@
#pragma once
#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
-class BrowserThread;
-class CommandLine;
-class HighResolutionTimerManager;
-class MessageLoop;
struct MainFunctionParams;
-namespace base {
-class SystemMonitor;
-}
-
-namespace net {
-class NetworkChangeNotifier;
-}
-
namespace content {
-// BrowserMainParts:
-// This class contains different "stages" to be executed in |BrowserMain()|,
-// mostly initialization. This is made into a class rather than just functions
-// so each stage can create and maintain state. Each part is represented by a
-// single method (e.g., "EarlyInitialization()"), which does the following:
-// - calls a method (e.g., "PreEarlyInitialization()") which individual
-// platforms can override to provide platform-specific code which is to be
-// executed before the common code;
-// - calls various methods for things common to all platforms (for that given
-// stage); and
-// - calls a method (e.g., "PostEarlyInitialization()") for platform-specific
-// code to be called after the common code.
-// As indicated above, platforms should override the default "Pre...()" and
-// "Post...()" methods when necessary; they need not call the superclass's
-// implementation (which is empty).
-//
-// Parts:
-// - 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)
-//
-// How to add stuff (to existing parts):
-// - Figure out when your new code should be executed. What must happen
-// before/after your code is executed? Are there performance reasons for
-// running your code at a particular time? Document these things!
-// - Split out any platform-specific bits. Please avoid #ifdefs it at all
-// possible. You have two choices for platform-specific code: (1) Execute it
-// from one of the platform-specific |Pre/Post...()| methods; do this if the
-// code is unique to a platform type. Or (2) execute it from one of the
-// "parts" (e.g., |EarlyInitialization()|) and provide platform-specific
-// implementations of your code (in a virtual method); do this if you need to
-// provide different implementations across most/all platforms.
-// - Unless your new code is just one or two lines, put it into a separate
-// method with a well-defined purpose. (Likewise, if you're adding to an
-// existing chunk which makes it longer than one or two lines, please move
-// the code out into a separate method.)
-class CONTENT_EXPORT BrowserMainParts {
- public:
- explicit BrowserMainParts(const MainFunctionParams& parameters);
- virtual ~BrowserMainParts();
-
- // Parts to be called by |BrowserMain()|.
- void EarlyInitialization();
- void InitializeToolkit();
- void MainMessageLoopStart();
- void RunMainMessageLoopParts();
-
- int result_code() const { return result_code_; }
-
- protected:
- // 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();
- virtual void PreMainMessageLoopRun();
- virtual void MainMessageLoopRun();
- virtual void PostMainMessageLoopRun();
-
- // Allows an embedder to do any extra toolkit initialization.
- virtual void ToolkitInitialized();
-
- // Accessors for data members (below) ----------------------------------------
- const MainFunctionParams& parameters() const {
- return parameters_;
- }
- const CommandLine& parsed_command_line() const {
- return parsed_command_line_;
- }
- MessageLoop& main_message_loop() const {
- return *main_message_loop_;
- }
- void set_result_code(int result_code) { result_code_ = result_code; }
-
- private:
- void InitializeMainThread();
-
- // Members initialized on construction ---------------------------------------
-
- const MainFunctionParams& parameters_;
- const CommandLine& parsed_command_line_;
- int result_code_;
-
- // Members initialized in |MainMessageLoopStart()| ---------------------------
- scoped_ptr<MessageLoop> main_message_loop_;
- scoped_ptr<base::SystemMonitor> system_monitor_;
- scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_;
- scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
- scoped_ptr<BrowserThread> main_thread_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserMainParts);
-};
-
bool ExitedMainMessageLoop();
} // namespace content