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

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, 9 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/common/net/predictor_common.h" 15 #include "chrome/common/net/predictor_common.h"
16 #include "net/base/network_change_notifier.h" 16 #include "net/base/network_change_notifier.h"
17 17
18 class ChromeNetLog; 18 class ChromeNetLog;
19 class ChromeURLRequestContextGetter; 19 class ChromeURLRequestContextGetter;
20 class ExtensionEventRouterForwarder; 20 class ExtensionEventRouterForwarder;
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;
35 class NetworkDelegate; 38 class NetworkDelegate;
39 class ProxyConfigService;
36 class ProxyScriptFetcher; 40 class ProxyScriptFetcher;
37 class ProxyService; 41 class ProxyService;
38 class SSLConfigService; 42 class SSLConfigService;
39 class URLRequestContext; 43 class URLRequestContext;
40 class URLSecurityManager; 44 class URLSecurityManager;
41 } // namespace net 45 } // namespace net
42 46
43 class IOThread : public BrowserProcessSubThread { 47 class IOThread : public BrowserProcessSubThread {
44 public: 48 public:
45 struct Globals { 49 struct Globals {
46 Globals(); 50 Globals();
47 ~Globals(); 51 ~Globals();
48 52
49 // The "system" NetworkDelegate, used for Profile-agnostic network events. 53 // The "system" NetworkDelegate, used for Profile-agnostic network events.
50 scoped_ptr<net::NetworkDelegate> system_network_delegate; 54 scoped_ptr<net::NetworkDelegate> system_network_delegate;
51 scoped_ptr<net::HostResolver> host_resolver; 55 scoped_ptr<net::HostResolver> host_resolver;
52 scoped_ptr<net::CertVerifier> cert_verifier; 56 scoped_ptr<net::CertVerifier> cert_verifier;
53 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; 57 scoped_ptr<net::DnsRRResolver> dnsrr_resolver;
54 scoped_refptr<net::SSLConfigService> ssl_config_service; 58 scoped_refptr<net::SSLConfigService> ssl_config_service;
55 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; 59 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory;
56 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; 60 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service;
57 scoped_ptr<net::HttpTransactionFactory> 61 scoped_ptr<net::HttpTransactionFactory>
58 proxy_script_fetcher_http_transaction_factory; 62 proxy_script_fetcher_http_transaction_factory;
59 scoped_ptr<net::URLSecurityManager> url_security_manager; 63 scoped_ptr<net::URLSecurityManager> url_security_manager;
60 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; 64 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context;
65 scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory;
66 scoped_refptr<net::ProxyService> system_proxy_service;
67 // NOTE(willchan): This request context is unusable until a system
68 // SSLConfigService is provided that doesn't rely on
69 // Profiles. Do NOT use this yet.
70 scoped_refptr<net::URLRequestContext> system_request_context;
61 scoped_refptr<ExtensionEventRouterForwarder> 71 scoped_refptr<ExtensionEventRouterForwarder>
62 extension_event_router_forwarder; 72 extension_event_router_forwarder;
63 }; 73 };
64 74
65 // |net_log| must either outlive the IOThread or be NULL. 75 // |net_log| must either outlive the IOThread or be NULL.
66 IOThread(PrefService* local_state, 76 IOThread(PrefService* local_state,
67 ChromeNetLog* net_log, 77 ChromeNetLog* net_log,
68 ExtensionEventRouterForwarder* extension_event_router_forwarder); 78 ExtensionEventRouterForwarder* extension_event_router_forwarder);
69 79
70 virtual ~IOThread(); 80 virtual ~IOThread();
(...skipping 26 matching lines...) Expand all
97 ChromeURLRequestContextGetter* url_request_context_getter); 107 ChromeURLRequestContextGetter* url_request_context_getter);
98 108
99 // Unregisters |url_request_context_getter| from the IO thread. Only called 109 // Unregisters |url_request_context_getter| from the IO thread. Only called
100 // on the IO thread. 110 // on the IO thread.
101 void UnregisterURLRequestContextGetter( 111 void UnregisterURLRequestContextGetter(
102 ChromeURLRequestContextGetter* url_request_context_getter); 112 ChromeURLRequestContextGetter* url_request_context_getter);
103 113
104 // Handles changing to On The Record mode, discarding confidential data. 114 // Handles changing to On The Record mode, discarding confidential data.
105 void ChangedToOnTheRecord(); 115 void ChangedToOnTheRecord();
106 116
117 // Returns a getter for the URLRequestContext. Only called on the UI thread.
118 URLRequestContextGetter* system_url_request_context_getter();
119
107 // Clear all network stack history, including the host cache, as well as 120 // Clear all network stack history, including the host cache, as well as
108 // speculative data about subresources of visited sites, and startup-time 121 // speculative data about subresources of visited sites, and startup-time
109 // navigations. 122 // navigations.
110 void ClearNetworkingHistory(); 123 void ClearNetworkingHistory();
111 124
112 protected: 125 protected:
113 virtual void Init(); 126 virtual void Init();
114 virtual void CleanUp(); 127 virtual void CleanUp();
115 128
116 private: 129 private:
130 // Provide SystemURLRequestContextGetter with access to
131 // InitSystemRequestContext().
132 friend class SystemURLRequestContextGetter;
133
117 static void RegisterPrefs(PrefService* local_state); 134 static void RegisterPrefs(PrefService* local_state);
118 135
119 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( 136 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory(
120 net::HostResolver* resolver); 137 net::HostResolver* resolver);
121 138
139 // Lazy initialization of system request context for
140 // SystemURLRequestContextGetter. To be called on IO thread.
141 void InitSystemRequestContext();
142
122 void InitNetworkPredictorOnIOThread( 143 void InitNetworkPredictorOnIOThread(
123 bool prefetching_enabled, 144 bool prefetching_enabled,
124 base::TimeDelta max_dns_queue_delay, 145 base::TimeDelta max_dns_queue_delay,
125 size_t max_speculative_parallel_resolves, 146 size_t max_speculative_parallel_resolves,
126 const chrome_common_net::UrlList& startup_urls, 147 const chrome_common_net::UrlList& startup_urls,
127 ListValue* referral_list, 148 ListValue* referral_list,
128 bool preconnect_enabled); 149 bool preconnect_enabled);
129 150
130 void ChangedToOnTheRecordOnIOThread(); 151 void ChangedToOnTheRecordOnIOThread();
131 152
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // these observers would be used accidentally after we have begun to tear 193 // these observers would be used accidentally after we have begun to tear
173 // down. 194 // down.
174 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; 195 chrome_browser_net::ConnectInterceptor* speculative_interceptor_;
175 chrome_browser_net::Predictor* predictor_; 196 chrome_browser_net::Predictor* predictor_;
176 197
177 // Keeps track of all live ChromeURLRequestContextGetters, so the 198 // Keeps track of all live ChromeURLRequestContextGetters, so the
178 // ChromeURLRequestContexts can be released during 199 // ChromeURLRequestContexts can be released during
179 // IOThread::CleanUp(). 200 // IOThread::CleanUp().
180 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; 201 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_;
181 202
203 scoped_refptr<URLRequestContextGetter> system_url_request_context_getter_;
willchan no longer on Chromium 2011/03/14 19:32:39 Member variable ordering should be longest-lived o
battre 2011/03/15 18:14:40 Done.
204
205 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_;
206
207 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
208
182 DISALLOW_COPY_AND_ASSIGN(IOThread); 209 DISALLOW_COPY_AND_ASSIGN(IOThread);
183 }; 210 };
184 211
185 #endif // CHROME_BROWSER_IO_THREAD_H_ 212 #endif // CHROME_BROWSER_IO_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698