| 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(); |
| 193 } | 199 } |
| 194 | 200 |
| 195 // Gets the URLRequest objects that hold a reference to this | 201 // Gets the URLRequest objects that hold a reference to this |
| 196 // URLRequestContext. | 202 // URLRequestContext. |
| 197 std::set<const URLRequest*>* url_requests() const { | 203 std::set<const URLRequest*>* url_requests() const { |
| 198 return url_requests_.get(); | 204 return url_requests_.get(); |
| 199 } | 205 } |
| 200 | 206 |
| 201 // CHECKs that no URLRequests using this context remain. Subclasses should | 207 // CHECKs that no URLRequests using this context remain. Subclasses should |
| 202 // additionally call AssertNoURLRequests() within their own destructor, | 208 // additionally call AssertNoURLRequests() within their own destructor, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 231 scoped_refptr<SSLConfigService> ssl_config_service_; | 237 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 232 NetworkDelegate* network_delegate_; | 238 NetworkDelegate* network_delegate_; |
| 233 base::WeakPtr<HttpServerProperties> http_server_properties_; | 239 base::WeakPtr<HttpServerProperties> http_server_properties_; |
| 234 HttpUserAgentSettings* http_user_agent_settings_; | 240 HttpUserAgentSettings* http_user_agent_settings_; |
| 235 scoped_refptr<CookieStore> cookie_store_; | 241 scoped_refptr<CookieStore> cookie_store_; |
| 236 TransportSecurityState* transport_security_state_; | 242 TransportSecurityState* transport_security_state_; |
| 237 CTVerifier* cert_transparency_verifier_; | 243 CTVerifier* cert_transparency_verifier_; |
| 238 HttpTransactionFactory* http_transaction_factory_; | 244 HttpTransactionFactory* http_transaction_factory_; |
| 239 const URLRequestJobFactory* job_factory_; | 245 const URLRequestJobFactory* job_factory_; |
| 240 URLRequestThrottlerManager* throttler_manager_; | 246 URLRequestThrottlerManager* throttler_manager_; |
| 241 SdchManager* sdch_manager_; | 247 // For investigation of http://crbug.com/454198; remove WeakPtr when resolved. |
| 248 bool have_sdch_manager_; |
| 249 base::WeakPtr<SdchManager> sdch_manager_; |
| 242 | 250 |
| 243 // --------------------------------------------------------------------------- | 251 // --------------------------------------------------------------------------- |
| 244 // Important: When adding any new members below, consider whether they need to | 252 // Important: When adding any new members below, consider whether they need to |
| 245 // be added to CopyFrom. | 253 // be added to CopyFrom. |
| 246 // --------------------------------------------------------------------------- | 254 // --------------------------------------------------------------------------- |
| 247 | 255 |
| 248 scoped_ptr<std::set<const URLRequest*> > url_requests_; | 256 scoped_ptr<std::set<const URLRequest*> > url_requests_; |
| 249 | 257 |
| 250 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 258 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 251 }; | 259 }; |
| 252 | 260 |
| 253 } // namespace net | 261 } // namespace net |
| 254 | 262 |
| 255 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 263 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |