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

Unified Diff: chrome/browser/io_thread.cc

Issue 8477004: Have content/ create and destroy its own threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: With this patchset, Chrome runs and exits normally on Linux. 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
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index c86f21ec0c45ba51671c5f54c8bc78edae5c968f..3518bcbe4692357fbcc2b721017ce20d99ba2244 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -14,6 +14,7 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -311,7 +312,8 @@ class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
SystemURLRequestContextGetter::SystemURLRequestContextGetter(
IOThread* io_thread)
: io_thread_(io_thread),
- io_message_loop_proxy_(io_thread->message_loop_proxy()) {
+ io_message_loop_proxy_(
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) {
}
SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {}
@@ -346,8 +348,7 @@ IOThread::IOThread(
PrefService* local_state,
ChromeNetLog* net_log,
ExtensionEventRouterForwarder* extension_event_router_forwarder)
- : content::BrowserProcessSubThread(BrowserThread::IO),
- net_log_(net_log),
+ : net_log_(net_log),
extension_event_router_forwarder_(extension_event_router_forwarder),
globals_(NULL),
sdch_manager_(NULL),
@@ -378,9 +379,6 @@ IOThread::IOThread(
IOThread::~IOThread() {
if (pref_proxy_config_tracker_.get())
pref_proxy_config_tracker_->DetachFromPrefService();
- // We cannot rely on our base class to stop the thread since we want our
- // CleanUp function to run.
- Stop();
DCHECK(!globals_);
}
@@ -406,9 +404,7 @@ void IOThread::Init() {
// messages around; it shouldn't be allowed to perform any blocking disk I/O.
base::ThreadRestrictions::SetIOAllowed(false);
- content::BrowserProcessSubThread::Init();
-
- DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type());
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
#if defined(USE_NSS)
net::SetMessageLoopForOCSP();
@@ -519,10 +515,6 @@ void IOThread::CleanUp() {
base::debug::LeakTracker<net::URLRequest>::CheckForLeaks();
base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks();
-
- // This will delete the |notification_service_|. Make sure it's done after
- // anything else can reference it.
- content::BrowserProcessSubThread::CleanUp();
}
// static
@@ -573,6 +565,11 @@ void IOThread::ClearHostCache() {
host_cache->clear();
}
+MessageLoop* IOThread::message_loop() const {
+ return BrowserThread::UnsafeGetBrowserThread(
+ BrowserThread::IO)->message_loop();
+}
+
net::SSLConfigService* IOThread::GetSSLConfigService() {
return ssl_config_service_manager_->Get();
}

Powered by Google App Engine
This is Rietveld 408576698