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

Unified Diff: content/browser/browser_main_loop.cc

Issue 8488015: Revert 110327 - Add ChromeBrowserParts for non main parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | « content/browser/browser_main_loop.h ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main_loop.cc
===================================================================
--- content/browser/browser_main_loop.cc (revision 110349)
+++ content/browser/browser_main_loop.cc (working copy)
@@ -158,8 +158,10 @@
}
BrowserMainLoop::~BrowserMainLoop() {
- // Release and destroy |parts_| before destroying other members.
- parts_.reset();
+ // Destroy added parts in reverse order.
+ for (int i = static_cast<int>(parts_list_.size())-1; i >= 0; --i)
+ delete parts_list_[i];
+ parts_list_.clear();
#if defined(OS_WIN)
OleUninitialize();
@@ -167,15 +169,15 @@
}
void BrowserMainLoop::Init() {
- parts_.reset(
- GetContentClient()->browser()->CreateBrowserMainParts(parameters_));
+ GetContentClient()->browser()->CreateBrowserMainParts(
+ parameters_, &parts_list_);
}
// BrowserMainLoop stages ==================================================
void BrowserMainLoop::EarlyInitialization() {
- if (parts_.get())
- parts_->PreEarlyInitialization();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PreEarlyInitialization();
#if defined(OS_WIN)
net::EnsureWinsockInit();
@@ -221,13 +223,13 @@
if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen))
net::set_tcp_fastopen_enabled(true);
- if (parts_.get())
- parts_->PostEarlyInitialization();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PostEarlyInitialization();
}
void BrowserMainLoop::MainMessageLoopStart() {
- if (parts_.get())
- parts_->PreMainMessageLoopStart();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PreMainMessageLoopStart();
#if defined(OS_WIN)
// If we're running tests (ui_task is non-null), then the ResourceBundle
@@ -258,24 +260,31 @@
system_message_window_.reset(new SystemMessageWindowWin);
#endif
- if (parts_.get())
- parts_->PostMainMessageLoopStart();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PostMainMessageLoopStart();
}
void BrowserMainLoop::RunMainMessageLoopParts(
bool* completed_main_message_loop) {
- if (parts_.get())
- parts_->PreMainMessageLoopRun();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PreMainMessageLoopRun();
TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, "");
// If the UI thread blocks, the whole UI is unresponsive.
// Do not allow disk IO from the UI thread.
base::ThreadRestrictions::SetIOAllowed(false);
+ // Iterate through each of the parts. If any of them ran the main
+ // message loop then they should return |true|. Otherwise
+ // BrowserMainLoop::MainMessageLoopRun loop will be run.
bool ran_main_loop = false;
- if (parts_.get())
- ran_main_loop = parts_->MainMessageLoopRun(&result_code_);
-
+ for (size_t i = 0; i < parts_list_.size(); ++i) {
+ int result_code = result_code_;
+ if (parts_list_[i]->MainMessageLoopRun(&result_code)) {
+ ran_main_loop = true;
+ result_code_ = result_code;
+ }
+ }
if (!ran_main_loop)
MainMessageLoopRun();
@@ -284,8 +293,8 @@
if (completed_main_message_loop)
*completed_main_message_loop = true;
- if (parts_.get())
- parts_->PostMainMessageLoopRun();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->PostMainMessageLoopRun();
}
void BrowserMainLoop::InitializeMainThread() {
@@ -334,8 +343,8 @@
LOG_GETLASTERROR(FATAL);
#endif
- if (parts_.get())
- parts_->ToolkitInitialized();
+ for (size_t i = 0; i < parts_list_.size(); ++i)
+ parts_list_[i]->ToolkitInitialized();
}
void BrowserMainLoop::MainMessageLoopRun() {
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698