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