OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class represents contextual information (cookies, cache, etc.) | 5 // This class represents contextual information (cookies, cache, etc.) |
6 // that's useful when processing resource requests. | 6 // that's useful when processing resource requests. |
7 // The class is reference-counted so that it can be cleaned up after any | 7 // The class is reference-counted so that it can be cleaned up after any |
8 // requests that are using it have been completed. | 8 // requests that are using it have been completed. |
9 | 9 |
10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
12 | 12 |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
22 #include "net/base/request_priority.h" | 22 #include "net/base/request_priority.h" |
| 23 #include "net/base/sdch_manager.h" |
23 #include "net/http/http_network_session.h" | 24 #include "net/http/http_network_session.h" |
24 #include "net/http/http_server_properties.h" | 25 #include "net/http/http_server_properties.h" |
25 #include "net/http/transport_security_state.h" | 26 #include "net/http/transport_security_state.h" |
26 #include "net/ssl/ssl_config_service.h" | 27 #include "net/ssl/ssl_config_service.h" |
27 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
28 | 29 |
29 namespace net { | 30 namespace net { |
30 class CertVerifier; | 31 class CertVerifier; |
31 class ChannelIDService; | 32 class ChannelIDService; |
32 class CookieStore; | 33 class CookieStore; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // May be NULL. | 180 // May be NULL. |
180 URLRequestThrottlerManager* throttler_manager() const { | 181 URLRequestThrottlerManager* throttler_manager() const { |
181 return throttler_manager_; | 182 return throttler_manager_; |
182 } | 183 } |
183 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager) { | 184 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager) { |
184 throttler_manager_ = throttler_manager; | 185 throttler_manager_ = throttler_manager; |
185 } | 186 } |
186 | 187 |
187 // May be NULL. | 188 // May be NULL. |
188 SdchManager* sdch_manager() const { | 189 SdchManager* sdch_manager() const { |
189 return sdch_manager_; | 190 // For investigation of http://crbug.com/454198; remove ?: when resolved. |
| 191 CHECK(!have_sdch_manager_ || sdch_manager_.get()); |
| 192 return have_sdch_manager_ ? sdch_manager_.get() : NULL; |
190 } | 193 } |
191 void set_sdch_manager(SdchManager* sdch_manager) { | 194 void set_sdch_manager(SdchManager* sdch_manager) { |
192 sdch_manager_ = sdch_manager; | 195 // For investigation of http://crbug.com/454198; simplify when resolved. |
| 196 have_sdch_manager_ = !!sdch_manager; |
| 197 if (have_sdch_manager_) |
| 198 sdch_manager_ = sdch_manager->GetWeakPtr(); |
| 199 else |
| 200 sdch_manager_.reset(); |
193 } | 201 } |
194 | 202 |
195 // Gets the URLRequest objects that hold a reference to this | 203 // Gets the URLRequest objects that hold a reference to this |
196 // URLRequestContext. | 204 // URLRequestContext. |
197 std::set<const URLRequest*>* url_requests() const { | 205 std::set<const URLRequest*>* url_requests() const { |
198 return url_requests_.get(); | 206 return url_requests_.get(); |
199 } | 207 } |
200 | 208 |
201 // CHECKs that no URLRequests using this context remain. Subclasses should | 209 // CHECKs that no URLRequests using this context remain. Subclasses should |
202 // additionally call AssertNoURLRequests() within their own destructor, | 210 // additionally call AssertNoURLRequests() within their own destructor, |
(...skipping 28 matching lines...) Expand all Loading... |
231 scoped_refptr<SSLConfigService> ssl_config_service_; | 239 scoped_refptr<SSLConfigService> ssl_config_service_; |
232 NetworkDelegate* network_delegate_; | 240 NetworkDelegate* network_delegate_; |
233 base::WeakPtr<HttpServerProperties> http_server_properties_; | 241 base::WeakPtr<HttpServerProperties> http_server_properties_; |
234 HttpUserAgentSettings* http_user_agent_settings_; | 242 HttpUserAgentSettings* http_user_agent_settings_; |
235 scoped_refptr<CookieStore> cookie_store_; | 243 scoped_refptr<CookieStore> cookie_store_; |
236 TransportSecurityState* transport_security_state_; | 244 TransportSecurityState* transport_security_state_; |
237 CTVerifier* cert_transparency_verifier_; | 245 CTVerifier* cert_transparency_verifier_; |
238 HttpTransactionFactory* http_transaction_factory_; | 246 HttpTransactionFactory* http_transaction_factory_; |
239 const URLRequestJobFactory* job_factory_; | 247 const URLRequestJobFactory* job_factory_; |
240 URLRequestThrottlerManager* throttler_manager_; | 248 URLRequestThrottlerManager* throttler_manager_; |
241 SdchManager* sdch_manager_; | 249 // For investigation of http://crbug.com/454198; remove WeakPtr when resolved. |
| 250 bool have_sdch_manager_; |
| 251 base::WeakPtr<SdchManager> sdch_manager_; |
242 | 252 |
243 // --------------------------------------------------------------------------- | 253 // --------------------------------------------------------------------------- |
244 // Important: When adding any new members below, consider whether they need to | 254 // Important: When adding any new members below, consider whether they need to |
245 // be added to CopyFrom. | 255 // be added to CopyFrom. |
246 // --------------------------------------------------------------------------- | 256 // --------------------------------------------------------------------------- |
247 | 257 |
248 scoped_ptr<std::set<const URLRequest*> > url_requests_; | 258 scoped_ptr<std::set<const URLRequest*> > url_requests_; |
249 | 259 |
250 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 260 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
251 }; | 261 }; |
252 | 262 |
253 } // namespace net | 263 } // namespace net |
254 | 264 |
255 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 265 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |