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

Side by Side Diff: chrome/browser/io_thread.h

Issue 7467012: Modifying prefetch to account for multi-profile. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "chrome/browser/browser_process_sub_thread.h" 15 #include "chrome/browser/browser_process_sub_thread.h"
16 #include "chrome/browser/net/ssl_config_service_manager.h" 16 #include "chrome/browser/net/ssl_config_service_manager.h"
17 #include "chrome/browser/prefs/pref_member.h" 17 #include "chrome/browser/prefs/pref_member.h"
18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/net/predictor_common.h" 19 #include "chrome/common/net/predictor_common.h"
19 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
20 21
21 class ChromeNetLog; 22 class ChromeNetLog;
22 class ChromeURLRequestContextGetter; 23 class ChromeURLRequestContextGetter;
23 class ExtensionEventRouterForwarder; 24 class ExtensionEventRouterForwarder;
24 class ListValue; 25 class ListValue;
25 class PrefProxyConfigTracker; 26 class PrefProxyConfigTracker;
26 class PrefService; 27 class PrefService;
27 class SystemURLRequestContextGetter; 28 class SystemURLRequestContextGetter;
28 29
29 namespace chrome_browser_net { 30 namespace chrome_browser_net {
30 class ConnectInterceptor;
31 class Predictor; 31 class Predictor;
32 } // namespace chrome_browser_net 32 } // namespace chrome_browser_net
33 33
34 namespace net { 34 namespace net {
35 class CertVerifier; 35 class CertVerifier;
36 class DnsRRResolver; 36 class DnsRRResolver;
37 class FtpTransactionFactory; 37 class FtpTransactionFactory;
38 class HostResolver; 38 class HostResolver;
39 class HttpAuthHandlerFactory; 39 class HttpAuthHandlerFactory;
40 class HttpTransactionFactory; 40 class HttpTransactionFactory;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Initializes the network predictor, which induces DNS pre-resolution and/or 97 // Initializes the network predictor, which induces DNS pre-resolution and/or
98 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS 98 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS
99 // prefetching should be enabled, and |preconnect_enabled| controls whether 99 // prefetching should be enabled, and |preconnect_enabled| controls whether
100 // TCP/IP preconnection is enabled. This should be called by the UI thread. 100 // TCP/IP preconnection is enabled. This should be called by the UI thread.
101 // It will post a task to the IO thread to perform the actual initialization. 101 // It will post a task to the IO thread to perform the actual initialization.
102 void InitNetworkPredictor(bool prefetching_enabled, 102 void InitNetworkPredictor(bool prefetching_enabled,
103 base::TimeDelta max_dns_queue_delay, 103 base::TimeDelta max_dns_queue_delay,
104 size_t max_speculative_parallel_resolves, 104 size_t max_speculative_parallel_resolves,
105 const chrome_common_net::UrlList& startup_urls, 105 const chrome_common_net::UrlList& startup_urls,
106 ListValue* referral_list, 106 ListValue* referral_list,
107 Profile* profile,
107 bool preconnect_enabled); 108 bool preconnect_enabled);
108 109
109 // Registers |url_request_context_getter| into the IO thread. During 110 // Registers |url_request_context_getter| into the IO thread. During
110 // IOThread::CleanUp(), IOThread will iterate through known getters and 111 // IOThread::CleanUp(), IOThread will iterate through known getters and
111 // release their URLRequestContexts. Only called on the IO thread. It does 112 // release their URLRequestContexts. Only called on the IO thread. It does
112 // not acquire a refcount for |url_request_context_getter|. If 113 // not acquire a refcount for |url_request_context_getter|. If
113 // |url_request_context_getter| is being deleted before IOThread::CleanUp() is 114 // |url_request_context_getter| is being deleted before IOThread::CleanUp() is
114 // invoked, then this needs to be balanced with a call to 115 // invoked, then this needs to be balanced with a call to
115 // UnregisterURLRequestContextGetter(). 116 // UnregisterURLRequestContextGetter().
116 void RegisterURLRequestContextGetter( 117 void RegisterURLRequestContextGetter(
117 ChromeURLRequestContextGetter* url_request_context_getter); 118 ChromeURLRequestContextGetter* url_request_context_getter);
118 119
119 // Unregisters |url_request_context_getter| from the IO thread. Only called 120 // Unregisters |url_request_context_getter| from the IO thread. Only called
120 // on the IO thread. 121 // on the IO thread.
121 void UnregisterURLRequestContextGetter( 122 void UnregisterURLRequestContextGetter(
122 ChromeURLRequestContextGetter* url_request_context_getter); 123 ChromeURLRequestContextGetter* url_request_context_getter);
123 124
124 // Handles changing to On The Record mode, discarding confidential data. 125 // Handles changing to On The Record mode, discarding confidential data.
125 void ChangedToOnTheRecord(); 126 void ChangedToOnTheRecord(Profile* profile);
126 127
127 // Returns a getter for the URLRequestContext. Only called on the UI thread. 128 // Returns a getter for the URLRequestContext. Only called on the UI thread.
128 net::URLRequestContextGetter* system_url_request_context_getter(); 129 net::URLRequestContextGetter* system_url_request_context_getter();
129 130
130 // Clear all network stack history, including the host cache, as well as 131 // Clear all network stack history, including the host cache, as well as
131 // speculative data about subresources of visited sites, and startup-time 132 // speculative data about subresources of visited sites, and startup-time
132 // navigations. 133 // navigations.
133 void ClearNetworkingHistory(); 134 void ClearNetworkingHistory(chrome_browser_net::Predictor* predictor);
134 135
135 protected: 136 protected:
136 virtual void Init(); 137 virtual void Init();
137 virtual void CleanUp(); 138 virtual void CleanUp();
138 139
139 private: 140 private:
140 // Provide SystemURLRequestContextGetter with access to 141 // Provide SystemURLRequestContextGetter with access to
141 // InitSystemRequestContext(). 142 // InitSystemRequestContext().
142 friend class SystemURLRequestContextGetter; 143 friend class SystemURLRequestContextGetter;
143 144
144 static void RegisterPrefs(PrefService* local_state); 145 static void RegisterPrefs(PrefService* local_state);
145 146
146 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( 147 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory(
147 net::HostResolver* resolver); 148 net::HostResolver* resolver);
148 149
149 void InitSystemRequestContext(); 150 void InitSystemRequestContext();
150 151
151 // Lazy initialization of system request context for 152 // Lazy initialization of system request context for
152 // SystemURLRequestContextGetter. To be called on IO thread. 153 // SystemURLRequestContextGetter. To be called on IO thread.
153 void InitSystemRequestContextOnIOThread(); 154 void InitSystemRequestContextOnIOThread();
154 155
155 void InitNetworkPredictorOnIOThread( 156 void InitNetworkPredictorOnIOThread(
156 bool prefetching_enabled, 157 bool prefetching_enabled,
157 base::TimeDelta max_dns_queue_delay, 158 base::TimeDelta max_dns_queue_delay,
158 size_t max_speculative_parallel_resolves, 159 size_t max_speculative_parallel_resolves,
159 const chrome_common_net::UrlList& startup_urls, 160 const chrome_common_net::UrlList& startup_urls,
160 ListValue* referral_list, 161 ListValue* referral_list,
161 bool preconnect_enabled); 162 bool preconnect_enabled,
163 Profile* profile);
162 164
163 void ChangedToOnTheRecordOnIOThread(); 165 void ChangedToOnTheRecordOnIOThread(Profile* profile);
164 166
165 // Clears the host cache. Intended to be used to prevent exposing recently 167 // Clears the host cache. Intended to be used to prevent exposing recently
166 // visited sites on about:net-internals/#dns and about:dns pages. Must be 168 // visited sites on about:net-internals/#dns and about:dns pages. Must be
167 // called on the IO thread. 169 // called on the IO thread.
168 void ClearHostCache(); 170 void ClearHostCache();
169 171
170 // Returns an SSLConfigService instance. 172 // Returns an SSLConfigService instance.
171 net::SSLConfigService* GetSSLConfigService(); 173 net::SSLConfigService* GetSSLConfigService();
172 174
173 // The NetLog is owned by the browser process, to allow logging from other 175 // The NetLog is owned by the browser process, to allow logging from other
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // platform and it gets SSL preferences from local_state object. 208 // platform and it gets SSL preferences from local_state object.
207 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; 209 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
208 210
209 // These member variables are initialized by a task posted to the IO thread, 211 // These member variables are initialized by a task posted to the IO thread,
210 // which gets posted by calling certain member functions of IOThread. 212 // which gets posted by calling certain member functions of IOThread.
211 213
212 // Note: we user explicit pointers rather than smart pointers to be more 214 // Note: we user explicit pointers rather than smart pointers to be more
213 // explicit about destruction order, and ensure that there is no chance that 215 // explicit about destruction order, and ensure that there is no chance that
214 // these observers would be used accidentally after we have begun to tear 216 // these observers would be used accidentally after we have begun to tear
215 // down. 217 // down.
216 chrome_browser_net::ConnectInterceptor* speculative_interceptor_;
217 chrome_browser_net::Predictor* predictor_;
218
219 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_; 218 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_;
220 219
221 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 220 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
222 221
223 scoped_refptr<net::URLRequestContextGetter> 222 scoped_refptr<net::URLRequestContextGetter>
224 system_url_request_context_getter_; 223 system_url_request_context_getter_;
225 224
226 // Keeps track of all live ChromeURLRequestContextGetters, so the 225 // Keeps track of all live ChromeURLRequestContextGetters, so the
227 // ChromeURLRequestContexts can be released during 226 // ChromeURLRequestContexts can be released during
228 // IOThread::CleanUp(). 227 // IOThread::CleanUp().
229 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; 228 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_;
230 229
231 ScopedRunnableMethodFactory<IOThread> method_factory_; 230 ScopedRunnableMethodFactory<IOThread> method_factory_;
232 231
233 DISALLOW_COPY_AND_ASSIGN(IOThread); 232 DISALLOW_COPY_AND_ASSIGN(IOThread);
234 }; 233 };
235 234
236 #endif // CHROME_BROWSER_IO_THREAD_H_ 235 #endif // CHROME_BROWSER_IO_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698