| 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 #include "net/url_request/url_request_context.h" | 5 #include "net/url_request/url_request_context.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "net/base/host_resolver.h" | 11 #include "net/base/host_resolver.h" |
| 12 #include "net/cookies/cookie_store.h" | 12 #include "net/cookies/cookie_store.h" |
| 13 #include "net/ftp/ftp_transaction_factory.h" | |
| 14 #include "net/http/http_transaction_factory.h" | 13 #include "net/http/http_transaction_factory.h" |
| 15 #include "net/url_request/http_user_agent_settings.h" | 14 #include "net/url_request/http_user_agent_settings.h" |
| 16 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
| 17 | 16 |
| 18 namespace net { | 17 namespace net { |
| 19 | 18 |
| 20 URLRequestContext::URLRequestContext() | 19 URLRequestContext::URLRequestContext() |
| 21 : net_log_(NULL), | 20 : net_log_(NULL), |
| 22 host_resolver_(NULL), | 21 host_resolver_(NULL), |
| 23 cert_verifier_(NULL), | 22 cert_verifier_(NULL), |
| 24 server_bound_cert_service_(NULL), | 23 server_bound_cert_service_(NULL), |
| 25 fraudulent_certificate_reporter_(NULL), | 24 fraudulent_certificate_reporter_(NULL), |
| 26 http_auth_handler_factory_(NULL), | 25 http_auth_handler_factory_(NULL), |
| 27 proxy_service_(NULL), | 26 proxy_service_(NULL), |
| 28 network_delegate_(NULL), | 27 network_delegate_(NULL), |
| 29 http_server_properties_(NULL), | 28 http_server_properties_(NULL), |
| 30 http_user_agent_settings_(NULL), | 29 http_user_agent_settings_(NULL), |
| 31 transport_security_state_(NULL), | 30 transport_security_state_(NULL), |
| 32 #if !defined(DISABLE_FTP_SUPPORT) | |
| 33 ftp_auth_cache_(new FtpAuthCache), | |
| 34 #endif | |
| 35 http_transaction_factory_(NULL), | 31 http_transaction_factory_(NULL), |
| 36 ftp_transaction_factory_(NULL), | |
| 37 job_factory_(NULL), | 32 job_factory_(NULL), |
| 38 throttler_manager_(NULL), | 33 throttler_manager_(NULL), |
| 39 url_requests_(new std::set<const URLRequest*>) { | 34 url_requests_(new std::set<const URLRequest*>) { |
| 40 } | 35 } |
| 41 | 36 |
| 42 URLRequestContext::~URLRequestContext() { | 37 URLRequestContext::~URLRequestContext() { |
| 43 AssertNoURLRequests(); | 38 AssertNoURLRequests(); |
| 44 } | 39 } |
| 45 | 40 |
| 46 void URLRequestContext::CopyFrom(const URLRequestContext* other) { | 41 void URLRequestContext::CopyFrom(const URLRequestContext* other) { |
| 47 // Copy URLRequestContext parameters. | 42 // Copy URLRequestContext parameters. |
| 48 set_net_log(other->net_log_); | 43 set_net_log(other->net_log_); |
| 49 set_host_resolver(other->host_resolver_); | 44 set_host_resolver(other->host_resolver_); |
| 50 set_cert_verifier(other->cert_verifier_); | 45 set_cert_verifier(other->cert_verifier_); |
| 51 set_server_bound_cert_service(other->server_bound_cert_service_); | 46 set_server_bound_cert_service(other->server_bound_cert_service_); |
| 52 set_fraudulent_certificate_reporter(other->fraudulent_certificate_reporter_); | 47 set_fraudulent_certificate_reporter(other->fraudulent_certificate_reporter_); |
| 53 set_http_auth_handler_factory(other->http_auth_handler_factory_); | 48 set_http_auth_handler_factory(other->http_auth_handler_factory_); |
| 54 set_proxy_service(other->proxy_service_); | 49 set_proxy_service(other->proxy_service_); |
| 55 set_ssl_config_service(other->ssl_config_service_); | 50 set_ssl_config_service(other->ssl_config_service_); |
| 56 set_network_delegate(other->network_delegate_); | 51 set_network_delegate(other->network_delegate_); |
| 57 set_http_server_properties(other->http_server_properties_); | 52 set_http_server_properties(other->http_server_properties_); |
| 58 set_cookie_store(other->cookie_store_); | 53 set_cookie_store(other->cookie_store_); |
| 59 set_transport_security_state(other->transport_security_state_); | 54 set_transport_security_state(other->transport_security_state_); |
| 60 // FTPAuthCache is unique per context. | |
| 61 set_http_transaction_factory(other->http_transaction_factory_); | 55 set_http_transaction_factory(other->http_transaction_factory_); |
| 62 set_ftp_transaction_factory(other->ftp_transaction_factory_); | |
| 63 set_job_factory(other->job_factory_); | 56 set_job_factory(other->job_factory_); |
| 64 set_throttler_manager(other->throttler_manager_); | 57 set_throttler_manager(other->throttler_manager_); |
| 65 set_http_user_agent_settings(other->http_user_agent_settings_); | 58 set_http_user_agent_settings(other->http_user_agent_settings_); |
| 66 } | 59 } |
| 67 | 60 |
| 68 const HttpNetworkSession::Params* URLRequestContext::GetNetworkSessionParams( | 61 const HttpNetworkSession::Params* URLRequestContext::GetNetworkSessionParams( |
| 69 ) const { | 62 ) const { |
| 70 HttpTransactionFactory* transaction_factory = http_transaction_factory(); | 63 HttpTransactionFactory* transaction_factory = http_transaction_factory(); |
| 71 if (!transaction_factory) | 64 if (!transaction_factory) |
| 72 return NULL; | 65 return NULL; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 base::debug::Alias(&num_requests); | 110 base::debug::Alias(&num_requests); |
| 118 base::debug::Alias(&has_delegate); | 111 base::debug::Alias(&has_delegate); |
| 119 base::debug::Alias(&load_flags); | 112 base::debug::Alias(&load_flags); |
| 120 base::debug::Alias(&stack_trace); | 113 base::debug::Alias(&stack_trace); |
| 121 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " | 114 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " |
| 122 << request->url().spec().c_str() << "."; | 115 << request->url().spec().c_str() << "."; |
| 123 } | 116 } |
| 124 } | 117 } |
| 125 | 118 |
| 126 } // namespace net | 119 } // namespace net |
| OLD | NEW |