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

Unified Diff: content/shell/shell_browser_main.cc

Issue 8718012: Revert 111695 - Have content/ create and destroy its own threads. (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/shell/shell_browser_main.h ('k') | content/test/test_browser_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/shell_browser_main.cc
===================================================================
--- content/shell/shell_browser_main.cc (revision 111697)
+++ content/shell/shell_browser_main.cc (working copy)
@@ -40,9 +40,41 @@
}
ShellBrowserMainParts::~ShellBrowserMainParts() {
+ base::ThreadRestrictions::SetIOAllowed(true);
+ io_thread()->message_loop()->PostTask(
+ FROM_HERE, base::IgnoreReturn<bool>(
+ base::Bind(&base::ThreadRestrictions::SetIOAllowed, true)));
+
+ browser_context_.reset();
+
+ resource_dispatcher_host_->download_file_manager()->Shutdown();
+ resource_dispatcher_host_->save_file_manager()->Shutdown();
+ resource_dispatcher_host_->Shutdown();
+ io_thread_.reset();
+ cache_thread_.reset();
+ process_launcher_thread_.reset();
+ file_thread_.reset();
+ resource_dispatcher_host_.reset(); // Kills WebKit thread.
+ db_thread_.reset();
}
-void ShellBrowserMainParts::PreCreateThreads() {
+void ShellBrowserMainParts::PreMainMessageLoopRun() {
+ db_thread_.reset(new BrowserProcessSubThread(BrowserThread::DB));
+ db_thread_->Start();
+ file_thread_.reset(new BrowserProcessSubThread(BrowserThread::FILE));
+ file_thread_->Start();
+ process_launcher_thread_.reset(
+ new BrowserProcessSubThread(BrowserThread::PROCESS_LAUNCHER));
+ process_launcher_thread_->Start();
+
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_IO;
+
+ cache_thread_.reset(new BrowserProcessSubThread(BrowserThread::CACHE));
+ cache_thread_->StartWithOptions(options);
+ io_thread_.reset(new BrowserProcessSubThread(BrowserThread::IO));
+ io_thread_->StartWithOptions(options);
+
browser_context_.reset(new ShellBrowserContext(this));
Shell::PlatformInitialize();
@@ -53,24 +85,9 @@
NULL,
MSG_ROUTING_NONE,
NULL);
-}
-void ShellBrowserMainParts::PostMainMessageLoopRun() {
- browser_context_.reset();
-
- resource_dispatcher_host_->download_file_manager()->Shutdown();
- resource_dispatcher_host_->save_file_manager()->Shutdown();
- resource_dispatcher_host_->Shutdown();
}
-void ShellBrowserMainParts::PreStopThread(BrowserThread::ID id) {
- if (id == BrowserThread::WEBKIT) {
- // It remains the embedder's responsibility to kill the WebKit
- // thread. This happens when RDH is destroyed.
- resource_dispatcher_host_.reset();
- }
-}
-
bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
return false;
}
« no previous file with comments | « content/shell/shell_browser_main.h ('k') | content/test/test_browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698