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

Unified Diff: content/browser/browser_main.cc

Issue 8302016: Make GTK and Aura parts orthogonal to OS parts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors Created 9 years, 2 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
« content/browser/browser_main.h ('K') | « content/browser/browser_main.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main.cc
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc
index 5bccf00027bca08ea502993b69ec06709f2e11e8..a7f4f0a86e50280dc674a6535aa29e7f263093cc 100644
--- a/content/browser/browser_main.cc
+++ b/content/browser/browser_main.cc
@@ -167,6 +167,31 @@ static void SetUpGLibLogHandler() {
namespace content {
+// BrowserParts
+
+BrowserParts::~BrowserParts() {
+}
+
+void BrowserParts::PreEarlyInitialization() {
+}
+
+void BrowserParts::PostEarlyInitialization() {
+}
+
+void BrowserParts::PreMainMessageLoopStart() {
+}
+
+void BrowserParts::PostMainMessageLoopStart() {
+}
+
+void BrowserParts::PreMainMessageLoopRun() {
+}
+
+void BrowserParts::PostMainMessageLoopRun() {
+}
+
+// BrowserMainParts
+
BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
: parameters_(parameters),
parsed_command_line_(parameters.command_line_),
@@ -177,13 +202,30 @@ BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
}
BrowserMainParts::~BrowserMainParts() {
+ // Destroy added parts in reverse order.
+ for (PartsList::reverse_iterator riter = added_parts_.rbegin();
+ riter != added_parts_.rend(); ++riter) {
+ delete *riter;
+ }
+ added_parts_.clear();
+
#if defined(OS_WIN)
OleUninitialize();
#endif
}
+void BrowserMainParts::AddParts(BrowserParts* parts) {
+ added_parts_.push_back(parts);
+}
+
void BrowserMainParts::EarlyInitialization() {
PreEarlyInitialization();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PreEarlyInitialization();
+ }
+
+ // Start watching for jank during shutdown. It gets disarmed when
#if defined(OS_WIN)
net::EnsureWinsockInit();
@@ -226,10 +268,18 @@ void BrowserMainParts::EarlyInitialization() {
net::set_tcp_fastopen_enabled(true);
PostEarlyInitialization();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PostEarlyInitialization();
+ }
}
void BrowserMainParts::MainMessageLoopStart() {
PreMainMessageLoopStart();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PreMainMessageLoopStart();
+ }
#if defined(OS_WIN)
// If we're running tests (ui_task is non-null), then the ResourceBundle
@@ -250,12 +300,20 @@ void BrowserMainParts::MainMessageLoopStart() {
network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
PostMainMessageLoopStart();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PostMainMessageLoopStart();
+ }
}
static bool g_exited_main_message_loop = false;
void BrowserMainParts::RunMainMessageLoopParts() {
PreMainMessageLoopRun();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PreMainMessageLoopRun();
+ }
TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, "");
// If the UI thread blocks, the whole UI is unresponsive.
@@ -267,6 +325,10 @@ void BrowserMainParts::RunMainMessageLoopParts() {
g_exited_main_message_loop = true;
PostMainMessageLoopRun();
+ for (PartsList::iterator iter = added_parts_.begin();
+ iter != added_parts_.end(); ++iter) {
+ (*iter)->PostMainMessageLoopRun();
+ }
}
void BrowserMainParts::InitializeMainThread() {
@@ -287,7 +349,8 @@ void BrowserMainParts::InitializeToolkit() {
// TODO(evan): this function is rather subtle, due to the variety
// of intersecting ifdefs we have. To keep it easy to follow, there
// are no #else branches on any #ifs.
-
+ // TODO(stevenjb): Move platform specific code into platform specific Parts
+ // (Need to add InitializeToolkit stage to BrowserParts).
#if defined(OS_LINUX)
// We want to call g_thread_init(), but in some codepaths (tests) it
// is possible it has already been called. In older versions of
@@ -333,20 +396,7 @@ void BrowserMainParts::InitializeToolkit() {
ToolkitInitialized();
}
-void BrowserMainParts::PreEarlyInitialization() {
-}
-
-void BrowserMainParts::PostEarlyInitialization() {
-}
-
-void BrowserMainParts::PreMainMessageLoopStart() {
-}
-
-void BrowserMainParts::PostMainMessageLoopStart() {
-}
-
-void BrowserMainParts::PreMainMessageLoopRun() {
-}
+// BrowserMainParts implementation
void BrowserMainParts::MainMessageLoopRun() {
if (parameters().ui_task)
@@ -359,9 +409,6 @@ void BrowserMainParts::MainMessageLoopRun() {
#endif
}
-void BrowserMainParts::PostMainMessageLoopRun() {
-}
-
void BrowserMainParts::ToolkitInitialized() {
}
« content/browser/browser_main.h ('K') | « content/browser/browser_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698