Index: chrome/browser/io_thread.h |
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h |
index b8be74b5faed773757a252136f9d8e8fc4a3e84d..88078328b65b7757d855546b2a8b1b2fea8a89b0 100644 |
--- a/chrome/browser/io_thread.h |
+++ b/chrome/browser/io_thread.h |
@@ -9,13 +9,24 @@ |
#include <string> |
#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "chrome/browser/net/ssl_config_service_manager.h" |
#include "chrome/browser/prefs/pref_member.h" |
-#include "content/browser/browser_process_sub_thread.h" |
#include "net/base/network_change_notifier.h" |
+// TODO(joi): Remove these in a follow-up change and IWYU in files |
+// that were getting them directly or indirectly from here. |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/message_loop.h" |
+#include "base/message_loop_proxy.h" |
+#include "base/synchronization/lock.h" |
+#include "base/threading/thread.h" |
+ |
+class BrowserProcessImpl; |
class ChromeNetLog; |
class ExtensionEventRouterForwarder; |
class MediaInternals; |
@@ -43,7 +54,10 @@ class URLRequestContextGetter; |
class URLSecurityManager; |
} // namespace net |
-class IOThread : public content::BrowserProcessSubThread { |
+// Contains state associated with, initialized and cleaned up on, and |
+// primarily used on, the IO thread. Also acts as a convenience |
+// accessor to the Thread object for the IO thread. |
+class IOThread : public MessageLoop::DestructionObserver { |
public: |
struct Globals { |
Globals(); |
@@ -109,29 +123,44 @@ class IOThread : public content::BrowserProcessSubThread { |
// called on the IO thread. |
void ClearHostCache(); |
- protected: |
- virtual void Init() OVERRIDE; |
- virtual void CleanUp() OVERRIDE; |
+ // Convenience method similar to base::Thread, giving access to the |
+ // actual IO thread. |
+ // TODO(joi): Remove this in follow-up changes. |
+ MessageLoop* message_loop() const; |
private: |
+ // For InitializeGlobalState/TearDownGlobalState. |
+ friend class BrowserProcessImpl; |
+ |
// Provide SystemURLRequestContextGetter with access to |
// InitSystemRequestContext(). |
friend class SystemURLRequestContextGetter; |
- static void RegisterPrefs(PrefService* local_state); |
- |
- net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
- net::HostResolver* resolver); |
+ // This is posted as the very first task to the IO thread. This is |
+ // the responsibility of BrowserProcessImpl. |
+ void InitializeGlobalState(); |
+ // Global state must be initialized on the IO thread, then this |
+ // method must be invoked on the UI thread. |
void InitSystemRequestContext(); |
// Lazy initialization of system request context for |
- // SystemURLRequestContextGetter. To be called on IO thread. |
+ // SystemURLRequestContextGetter. To be called on IO thread only |
+ // after global state has been initialized on the IO thread, and |
+ // SystemRequestContext state has been initialized on the UI thread. |
void InitSystemRequestContextOnIOThread(); |
+ static void RegisterPrefs(PrefService* local_state); |
+ |
+ net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
+ net::HostResolver* resolver); |
+ |
// Returns an SSLConfigService instance. |
net::SSLConfigService* GetSSLConfigService(); |
+ // MessageLoop::DestructionObserver implementation. |
+ virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
+ |
// The NetLog is owned by the browser process, to allow logging from other |
// threads during shutdown, but is used most frequently on the IOThread. |
ChromeNetLog* net_log_; |