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

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

Issue 6292017: Extended: Add "system" URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 10 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/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "chrome/browser/browser_process_sub_thread.h" 14 #include "chrome/browser/browser_process_sub_thread.h"
15 #include "chrome/browser/net/chrome_network_delegate.h" 15 #include "chrome/browser/net/chrome_network_delegate.h"
16 #include "chrome/common/net/predictor_common.h" 16 #include "chrome/common/net/predictor_common.h"
17 #include "net/base/network_change_notifier.h" 17 #include "net/base/network_change_notifier.h"
18 18
19 class ChromeNetLog; 19 class ChromeNetLog;
20 class ChromeURLRequestContextGetter; 20 class ChromeURLRequestContextGetter;
21 class ListValue; 21 class ListValue;
22 class PrefProxyConfigTracker;
22 class PrefService; 23 class PrefService;
24 class SystemURLRequestContextGetter;
25 class URLRequestContextGetter;
23 26
24 namespace chrome_browser_net { 27 namespace chrome_browser_net {
25 class ConnectInterceptor; 28 class ConnectInterceptor;
26 class Predictor; 29 class Predictor;
27 } // namespace chrome_browser_net 30 } // namespace chrome_browser_net
28 31
29 namespace net { 32 namespace net {
30 class CertVerifier; 33 class CertVerifier;
31 class DnsRRResolver; 34 class DnsRRResolver;
32 class HostResolver; 35 class HostResolver;
33 class HttpAuthHandlerFactory; 36 class HttpAuthHandlerFactory;
34 class HttpTransactionFactory; 37 class HttpTransactionFactory;
38 class ProxyConfigService;
35 class ProxyScriptFetcher; 39 class ProxyScriptFetcher;
36 class ProxyService; 40 class ProxyService;
37 class SSLConfigService; 41 class SSLConfigService;
38 class URLRequestContext; 42 class URLRequestContext;
39 class URLSecurityManager; 43 class URLSecurityManager;
40 } // namespace net 44 } // namespace net
41 45
42 class IOThread : public BrowserProcessSubThread { 46 class IOThread : public BrowserProcessSubThread {
43 public: 47 public:
44 struct Globals { 48 struct Globals {
45 Globals(); 49 Globals();
46 ~Globals(); 50 ~Globals();
47 51
48 scoped_ptr<net::HostResolver> host_resolver; 52 scoped_ptr<net::HostResolver> host_resolver;
49 scoped_ptr<net::CertVerifier> cert_verifier; 53 scoped_ptr<net::CertVerifier> cert_verifier;
50 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; 54 scoped_ptr<net::DnsRRResolver> dnsrr_resolver;
51 scoped_refptr<net::SSLConfigService> ssl_config_service; 55 scoped_refptr<net::SSLConfigService> ssl_config_service;
52 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; 56 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory;
53 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; 57 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service;
54 scoped_ptr<net::HttpTransactionFactory> 58 scoped_ptr<net::HttpTransactionFactory>
55 proxy_script_fetcher_http_transaction_factory; 59 proxy_script_fetcher_http_transaction_factory;
56 scoped_ptr<net::URLSecurityManager> url_security_manager; 60 scoped_ptr<net::URLSecurityManager> url_security_manager;
57 ChromeNetworkDelegate network_delegate; 61 ChromeNetworkDelegate network_delegate;
58 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; 62 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context;
63 scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory;
64 scoped_refptr<net::ProxyService> system_proxy_service;
65 // NOTE(willchan): This request context is unusable until a system
66 // SSLConfigService is provided that doesn't rely on
67 // Profiles. Do NOT use this yet.
68 scoped_refptr<net::URLRequestContext> system_request_context;
59 }; 69 };
60 70
61 // |net_log| must either outlive the IOThread or be NULL. 71 // |net_log| must either outlive the IOThread or be NULL.
62 IOThread(PrefService* local_state, ChromeNetLog* net_log); 72 IOThread(PrefService* local_state, ChromeNetLog* net_log);
63 73
64 virtual ~IOThread(); 74 virtual ~IOThread();
65 75
66 // Can only be called on the IO thread. 76 // Can only be called on the IO thread.
67 Globals* globals(); 77 Globals* globals();
68 78
(...skipping 22 matching lines...) Expand all
91 ChromeURLRequestContextGetter* url_request_context_getter); 101 ChromeURLRequestContextGetter* url_request_context_getter);
92 102
93 // Unregisters |url_request_context_getter| from the IO thread. Only called 103 // Unregisters |url_request_context_getter| from the IO thread. Only called
94 // on the IO thread. 104 // on the IO thread.
95 void UnregisterURLRequestContextGetter( 105 void UnregisterURLRequestContextGetter(
96 ChromeURLRequestContextGetter* url_request_context_getter); 106 ChromeURLRequestContextGetter* url_request_context_getter);
97 107
98 // Handles changing to On The Record mode, discarding confidential data. 108 // Handles changing to On The Record mode, discarding confidential data.
99 void ChangedToOnTheRecord(); 109 void ChangedToOnTheRecord();
100 110
111 // Returns a getter for the URLRequestContext. Only called on the UI thread.
112 scoped_refptr<URLRequestContextGetter> system_url_request_context_getter();
113
101 // Clear all network stack history, including the host cache, as well as 114 // Clear all network stack history, including the host cache, as well as
102 // speculative data about subresources of visited sites, and startup-time 115 // speculative data about subresources of visited sites, and startup-time
103 // navigations. 116 // navigations.
104 void ClearNetworkingHistory(); 117 void ClearNetworkingHistory();
105 118
106 protected: 119 protected:
107 virtual void Init(); 120 virtual void Init();
108 virtual void CleanUp(); 121 virtual void CleanUp();
109 virtual void CleanUpAfterMessageLoopDestruction(); 122 virtual void CleanUpAfterMessageLoopDestruction();
110 123
111 private: 124 private:
125 friend class SystemURLRequestContextGetter;
126
112 static void RegisterPrefs(PrefService* local_state); 127 static void RegisterPrefs(PrefService* local_state);
113 128
114 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( 129 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory(
115 net::HostResolver* resolver); 130 net::HostResolver* resolver);
116 131
132 // Lazy initialization of system request context for
133 // SystemURLRequestContextGetter. To be called on IO thread.
134 void InitSystemRequestContext();
135
117 void InitNetworkPredictorOnIOThread( 136 void InitNetworkPredictorOnIOThread(
118 bool prefetching_enabled, 137 bool prefetching_enabled,
119 base::TimeDelta max_dns_queue_delay, 138 base::TimeDelta max_dns_queue_delay,
120 size_t max_speculative_parallel_resolves, 139 size_t max_speculative_parallel_resolves,
121 const chrome_common_net::UrlList& startup_urls, 140 const chrome_common_net::UrlList& startup_urls,
122 ListValue* referral_list, 141 ListValue* referral_list,
123 bool preconnect_enabled); 142 bool preconnect_enabled);
124 143
125 void ChangedToOnTheRecordOnIOThread(); 144 void ChangedToOnTheRecordOnIOThread();
126 145
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // these observers would be used accidentally after we have begun to tear 181 // these observers would be used accidentally after we have begun to tear
163 // down. 182 // down.
164 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; 183 chrome_browser_net::ConnectInterceptor* speculative_interceptor_;
165 chrome_browser_net::Predictor* predictor_; 184 chrome_browser_net::Predictor* predictor_;
166 185
167 // Keeps track of all live ChromeURLRequestContextGetters, so the 186 // Keeps track of all live ChromeURLRequestContextGetters, so the
168 // ChromeURLRequestContexts can be released during 187 // ChromeURLRequestContexts can be released during
169 // IOThread::CleanUpAfterMessageLoopDestruction(). 188 // IOThread::CleanUpAfterMessageLoopDestruction().
170 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; 189 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_;
171 190
191 scoped_refptr<URLRequestContextGetter> system_url_request_context_getter_;
192
193 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_;
194
195 PrefProxyConfigTracker* pref_proxy_config_tracker_; // Weak pointer.
196
197 // Weak pointer owned by BrowserProcessImpl, outlives IOThread.
198 PrefService* local_state_;
199
172 DISALLOW_COPY_AND_ASSIGN(IOThread); 200 DISALLOW_COPY_AND_ASSIGN(IOThread);
173 }; 201 };
174 202
175 #endif // CHROME_BROWSER_IO_THREAD_H_ 203 #endif // CHROME_BROWSER_IO_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698