OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_IO_THREAD_H_ | 5 #ifndef CHROME_BROWSER_IO_THREAD_H_ |
6 #define CHROME_BROWSER_IO_THREAD_H_ | 6 #define CHROME_BROWSER_IO_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/task.h" | 15 #include "base/task.h" |
15 #include "chrome/browser/net/ssl_config_service_manager.h" | 16 #include "chrome/browser/net/ssl_config_service_manager.h" |
16 #include "chrome/browser/prefs/pref_member.h" | 17 #include "chrome/browser/prefs/pref_member.h" |
17 #include "content/browser/browser_process_sub_thread.h" | 18 #include "content/public/browser/io_thread_delegate.h" |
18 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
19 | 20 |
20 class ChromeNetLog; | 21 class ChromeNetLog; |
21 class ChromeURLRequestContextGetter; | 22 class ChromeURLRequestContextGetter; |
22 class ExtensionEventRouterForwarder; | 23 class ExtensionEventRouterForwarder; |
23 class MediaInternals; | 24 class MediaInternals; |
24 class PrefProxyConfigTrackerImpl; | 25 class PrefProxyConfigTrackerImpl; |
25 class PrefService; | 26 class PrefService; |
26 class SystemURLRequestContextGetter; | 27 class SystemURLRequestContextGetter; |
27 | 28 |
(...skipping 14 matching lines...) Expand all Loading... |
42 class OriginBoundCertService; | 43 class OriginBoundCertService; |
43 class ProxyConfigService; | 44 class ProxyConfigService; |
44 class ProxyService; | 45 class ProxyService; |
45 class SdchManager; | 46 class SdchManager; |
46 class SSLConfigService; | 47 class SSLConfigService; |
47 class URLRequestContext; | 48 class URLRequestContext; |
48 class URLRequestContextGetter; | 49 class URLRequestContextGetter; |
49 class URLSecurityManager; | 50 class URLSecurityManager; |
50 } // namespace net | 51 } // namespace net |
51 | 52 |
52 class IOThread : public content::BrowserProcessSubThread { | 53 // Contains state associated with, initialized and cleaned up on, and |
| 54 // primarily used on, the IO thread. Also acts as a convenience |
| 55 // accessor to the Thread object for the IO thread. |
| 56 class IOThread : public content::IOThreadDelegate { |
53 public: | 57 public: |
54 struct Globals { | 58 struct Globals { |
55 Globals(); | 59 Globals(); |
56 ~Globals(); | 60 ~Globals(); |
57 | 61 |
58 struct MediaGlobals { | 62 struct MediaGlobals { |
59 MediaGlobals(); | 63 MediaGlobals(); |
60 ~MediaGlobals(); | 64 ~MediaGlobals(); |
61 // MediaInternals singleton used to aggregate media information. | 65 // MediaInternals singleton used to aggregate media information. |
62 scoped_ptr<MediaInternals> media_internals; | 66 scoped_ptr<MediaInternals> media_internals; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ChromeNetLog* net_log(); | 112 ChromeNetLog* net_log(); |
109 | 113 |
110 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 114 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
111 net::URLRequestContextGetter* system_url_request_context_getter(); | 115 net::URLRequestContextGetter* system_url_request_context_getter(); |
112 | 116 |
113 // Clears the host cache. Intended to be used to prevent exposing recently | 117 // Clears the host cache. Intended to be used to prevent exposing recently |
114 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 118 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
115 // called on the IO thread. | 119 // called on the IO thread. |
116 void ClearHostCache(); | 120 void ClearHostCache(); |
117 | 121 |
| 122 // Convenience method similar to base::Thread, giving access to the |
| 123 // actual IO thread. |
| 124 // TODO(joi): Remove this in follow-up changes. |
| 125 MessageLoop* message_loop() const; |
| 126 |
118 protected: | 127 protected: |
119 virtual void Init(); | 128 virtual void Init() OVERRIDE; |
120 virtual void CleanUp(); | 129 virtual void CleanUp() OVERRIDE; |
121 | 130 |
122 private: | 131 private: |
123 // Provide SystemURLRequestContextGetter with access to | 132 // Provide SystemURLRequestContextGetter with access to |
124 // InitSystemRequestContext(). | 133 // InitSystemRequestContext(). |
125 friend class SystemURLRequestContextGetter; | 134 friend class SystemURLRequestContextGetter; |
126 | 135 |
127 static void RegisterPrefs(PrefService* local_state); | 136 static void RegisterPrefs(PrefService* local_state); |
128 | 137 |
129 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( | 138 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
130 net::HostResolver* resolver); | 139 net::HostResolver* resolver); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 system_url_request_context_getter_; | 193 system_url_request_context_getter_; |
185 | 194 |
186 net::SdchManager* sdch_manager_; | 195 net::SdchManager* sdch_manager_; |
187 | 196 |
188 ScopedRunnableMethodFactory<IOThread> method_factory_; | 197 ScopedRunnableMethodFactory<IOThread> method_factory_; |
189 | 198 |
190 DISALLOW_COPY_AND_ASSIGN(IOThread); | 199 DISALLOW_COPY_AND_ASSIGN(IOThread); |
191 }; | 200 }; |
192 | 201 |
193 #endif // CHROME_BROWSER_IO_THREAD_H_ | 202 #endif // CHROME_BROWSER_IO_THREAD_H_ |
OLD | NEW |