OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a | 5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a |
6 // simple container for all of them. Most importantly, it handles the lifetime | 6 // simple container for all of them. Most importantly, it handles the lifetime |
7 // and destruction order properly. | 7 // and destruction order properly. |
8 | 8 |
9 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ | 9 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ | 10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
willchan no longer on Chromium
2010/12/13 09:30:53
Thanks for all the cleanup in this file! I feel a
| |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/non_thread_safe.h" | 15 #include "base/non_thread_safe.h" |
16 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
18 #include "base/template_util.h" | 18 #include "base/template_util.h" |
19 #include "base/stl_util-inl.h" | 19 #include "base/stl_util-inl.h" |
20 #include "net/socket/client_socket_pool_histograms.h" | 20 #include "net/socket/client_socket_pool_histograms.h" |
21 | 21 |
22 class Value; | 22 class Value; |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 class CertVerifier; | |
26 class ClientSocketFactory; | 27 class ClientSocketFactory; |
27 class ClientSocketPoolHistograms; | 28 class ClientSocketPoolHistograms; |
28 class DnsCertProvenanceChecker; | 29 class DnsCertProvenanceChecker; |
29 class DnsRRResolver; | 30 class DnsRRResolver; |
30 class HostPortPair; | 31 class HostPortPair; |
31 class HttpProxyClientSocketPool; | 32 class HttpProxyClientSocketPool; |
32 class HostResolver; | 33 class HostResolver; |
33 class NetLog; | 34 class NetLog; |
34 class ProxyService; | 35 class ProxyService; |
35 class SOCKSClientSocketPool; | 36 class SOCKSClientSocketPool; |
(...skipping 11 matching lines...) Expand all Loading... | |
47 OwnedPoolMap() { | 48 OwnedPoolMap() { |
48 COMPILE_ASSERT(base::is_pointer<Value>::value, | 49 COMPILE_ASSERT(base::is_pointer<Value>::value, |
49 value_must_be_a_pointer); | 50 value_must_be_a_pointer); |
50 } | 51 } |
51 | 52 |
52 ~OwnedPoolMap() { | 53 ~OwnedPoolMap() { |
53 STLDeleteValues(this); | 54 STLDeleteValues(this); |
54 } | 55 } |
55 }; | 56 }; |
56 | 57 |
57 } // internal | 58 } // namespace internal |
58 | 59 |
59 class ClientSocketPoolManager : public NonThreadSafe { | 60 class ClientSocketPoolManager : public NonThreadSafe { |
60 public: | 61 public: |
61 ClientSocketPoolManager(NetLog* net_log, | 62 ClientSocketPoolManager(NetLog* net_log, |
62 ClientSocketFactory* socket_factory, | 63 ClientSocketFactory* socket_factory, |
63 HostResolver* host_resolver, | 64 HostResolver* host_resolver, |
65 CertVerifier* cert_verifier, | |
64 DnsRRResolver* dnsrr_resolver, | 66 DnsRRResolver* dnsrr_resolver, |
65 DnsCertProvenanceChecker* dns_cert_checker, | 67 DnsCertProvenanceChecker* dns_cert_checker, |
66 SSLHostInfoFactory* ssl_host_info_factory, | 68 SSLHostInfoFactory* ssl_host_info_factory, |
67 ProxyService* proxy_service, | 69 ProxyService* proxy_service, |
68 SSLConfigService* ssl_config_service); | 70 SSLConfigService* ssl_config_service); |
69 ~ClientSocketPoolManager(); | 71 ~ClientSocketPoolManager(); |
70 | 72 |
71 void FlushSocketPools(); | 73 void FlushSocketPools(); |
72 | 74 |
73 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_.get(); } | 75 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_.get(); } |
(...skipping 25 matching lines...) Expand all Loading... | |
99 typedef internal::OwnedPoolMap<HostPortPair, SOCKSClientSocketPool*> | 101 typedef internal::OwnedPoolMap<HostPortPair, SOCKSClientSocketPool*> |
100 SOCKSSocketPoolMap; | 102 SOCKSSocketPoolMap; |
101 typedef internal::OwnedPoolMap<HostPortPair, HttpProxyClientSocketPool*> | 103 typedef internal::OwnedPoolMap<HostPortPair, HttpProxyClientSocketPool*> |
102 HTTPProxySocketPoolMap; | 104 HTTPProxySocketPoolMap; |
103 typedef internal::OwnedPoolMap<HostPortPair, SSLClientSocketPool*> | 105 typedef internal::OwnedPoolMap<HostPortPair, SSLClientSocketPool*> |
104 SSLSocketPoolMap; | 106 SSLSocketPoolMap; |
105 | 107 |
106 NetLog* const net_log_; | 108 NetLog* const net_log_; |
107 ClientSocketFactory* const socket_factory_; | 109 ClientSocketFactory* const socket_factory_; |
108 HostResolver* const host_resolver_; | 110 HostResolver* const host_resolver_; |
111 CertVerifier* const cert_verifier_; | |
109 DnsRRResolver* const dnsrr_resolver_; | 112 DnsRRResolver* const dnsrr_resolver_; |
110 DnsCertProvenanceChecker* const dns_cert_checker_; | 113 DnsCertProvenanceChecker* const dns_cert_checker_; |
111 SSLHostInfoFactory* const ssl_host_info_factory_; | 114 SSLHostInfoFactory* const ssl_host_info_factory_; |
112 const scoped_refptr<ProxyService> proxy_service_; | 115 const scoped_refptr<ProxyService> proxy_service_; |
113 const scoped_refptr<SSLConfigService> ssl_config_service_; | 116 const scoped_refptr<SSLConfigService> ssl_config_service_; |
114 | 117 |
115 // Note: this ordering is important. | 118 // Note: this ordering is important. |
116 | 119 |
117 ClientSocketPoolHistograms tcp_pool_histograms_; | 120 ClientSocketPoolHistograms tcp_pool_histograms_; |
118 scoped_ptr<TCPClientSocketPool> tcp_socket_pool_; | 121 scoped_ptr<TCPClientSocketPool> tcp_socket_pool_; |
(...skipping 20 matching lines...) Expand all Loading... | |
139 HTTPProxySocketPoolMap http_proxy_socket_pools_; | 142 HTTPProxySocketPoolMap http_proxy_socket_pools_; |
140 | 143 |
141 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; | 144 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; |
142 SSLSocketPoolMap ssl_socket_pools_for_proxies_; | 145 SSLSocketPoolMap ssl_socket_pools_for_proxies_; |
143 | 146 |
144 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); | 147 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); |
145 }; | 148 }; |
146 | 149 |
147 } // namespace net | 150 } // namespace net |
148 | 151 |
149 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ | 152 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
OLD | NEW |