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_ |
10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ | 10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ |
(...skipping 16 matching lines...) Expand all Loading... |
27 class ClientSocketPoolHistograms; | 27 class ClientSocketPoolHistograms; |
28 class DnsRRResolver; | 28 class DnsRRResolver; |
29 class HostPortPair; | 29 class HostPortPair; |
30 class HttpProxyClientSocketPool; | 30 class HttpProxyClientSocketPool; |
31 class HostResolver; | 31 class HostResolver; |
32 class NetLog; | 32 class NetLog; |
33 class ProxyService; | 33 class ProxyService; |
34 class SOCKSClientSocketPool; | 34 class SOCKSClientSocketPool; |
35 class SSLClientSocketPool; | 35 class SSLClientSocketPool; |
36 class SSLConfigService; | 36 class SSLConfigService; |
| 37 class SSLHostInfoFactory; |
37 class TCPClientSocketPool; | 38 class TCPClientSocketPool; |
38 | 39 |
39 namespace internal { | 40 namespace internal { |
40 | 41 |
41 // A helper class for auto-deleting Values in the destructor. | 42 // A helper class for auto-deleting Values in the destructor. |
42 template <typename Key, typename Value> | 43 template <typename Key, typename Value> |
43 class OwnedPoolMap : public std::map<Key, Value> { | 44 class OwnedPoolMap : public std::map<Key, Value> { |
44 public: | 45 public: |
45 OwnedPoolMap() { | 46 OwnedPoolMap() { |
46 COMPILE_ASSERT(base::is_pointer<Value>::value, | 47 COMPILE_ASSERT(base::is_pointer<Value>::value, |
47 value_must_be_a_pointer); | 48 value_must_be_a_pointer); |
48 } | 49 } |
49 | 50 |
50 ~OwnedPoolMap() { | 51 ~OwnedPoolMap() { |
51 STLDeleteValues(this); | 52 STLDeleteValues(this); |
52 } | 53 } |
53 }; | 54 }; |
54 | 55 |
55 } // internal | 56 } // internal |
56 | 57 |
57 class ClientSocketPoolManager : public NonThreadSafe { | 58 class ClientSocketPoolManager : public NonThreadSafe { |
58 public: | 59 public: |
59 ClientSocketPoolManager(NetLog* net_log, | 60 ClientSocketPoolManager(NetLog* net_log, |
60 ClientSocketFactory* socket_factory, | 61 ClientSocketFactory* socket_factory, |
61 HostResolver* host_resolver, | 62 HostResolver* host_resolver, |
62 DnsRRResolver* dnsrr_resolver, | 63 DnsRRResolver* dnsrr_resolver, |
| 64 SSLHostInfoFactory* ssl_host_info_factory, |
63 ProxyService* proxy_service, | 65 ProxyService* proxy_service, |
64 SSLConfigService* ssl_config_service); | 66 SSLConfigService* ssl_config_service); |
65 ~ClientSocketPoolManager(); | 67 ~ClientSocketPoolManager(); |
66 | 68 |
67 void FlushSocketPools(); | 69 void FlushSocketPools(); |
68 | 70 |
69 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_.get(); } | 71 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_.get(); } |
70 | 72 |
71 SSLClientSocketPool* ssl_socket_pool() { return ssl_socket_pool_.get(); } | 73 SSLClientSocketPool* ssl_socket_pool() { return ssl_socket_pool_.get(); } |
72 | 74 |
(...skipping 22 matching lines...) Expand all Loading... |
95 typedef internal::OwnedPoolMap<HostPortPair, SOCKSClientSocketPool*> | 97 typedef internal::OwnedPoolMap<HostPortPair, SOCKSClientSocketPool*> |
96 SOCKSSocketPoolMap; | 98 SOCKSSocketPoolMap; |
97 typedef internal::OwnedPoolMap<HostPortPair, HttpProxyClientSocketPool*> | 99 typedef internal::OwnedPoolMap<HostPortPair, HttpProxyClientSocketPool*> |
98 HTTPProxySocketPoolMap; | 100 HTTPProxySocketPoolMap; |
99 typedef internal::OwnedPoolMap<HostPortPair, SSLClientSocketPool*> | 101 typedef internal::OwnedPoolMap<HostPortPair, SSLClientSocketPool*> |
100 SSLSocketPoolMap; | 102 SSLSocketPoolMap; |
101 | 103 |
102 NetLog* const net_log_; | 104 NetLog* const net_log_; |
103 ClientSocketFactory* const socket_factory_; | 105 ClientSocketFactory* const socket_factory_; |
104 HostResolver* const host_resolver_; | 106 HostResolver* const host_resolver_; |
105 DnsRRResolver* dnsrr_resolver_; | 107 DnsRRResolver* const dnsrr_resolver_; |
| 108 SSLHostInfoFactory* const ssl_host_info_factory_; |
106 const scoped_refptr<ProxyService> proxy_service_; | 109 const scoped_refptr<ProxyService> proxy_service_; |
107 const scoped_refptr<SSLConfigService> ssl_config_service_; | 110 const scoped_refptr<SSLConfigService> ssl_config_service_; |
108 | 111 |
109 // Note: this ordering is important. | 112 // Note: this ordering is important. |
110 | 113 |
111 ClientSocketPoolHistograms tcp_pool_histograms_; | 114 ClientSocketPoolHistograms tcp_pool_histograms_; |
112 scoped_ptr<TCPClientSocketPool> tcp_socket_pool_; | 115 scoped_ptr<TCPClientSocketPool> tcp_socket_pool_; |
113 | 116 |
114 ClientSocketPoolHistograms ssl_pool_histograms_; | 117 ClientSocketPoolHistograms ssl_pool_histograms_; |
115 scoped_ptr<SSLClientSocketPool> ssl_socket_pool_; | 118 scoped_ptr<SSLClientSocketPool> ssl_socket_pool_; |
(...skipping 18 matching lines...) Expand all Loading... |
134 | 137 |
135 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; | 138 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; |
136 SSLSocketPoolMap ssl_socket_pools_for_proxies_; | 139 SSLSocketPoolMap ssl_socket_pools_for_proxies_; |
137 | 140 |
138 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); | 141 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); |
139 }; | 142 }; |
140 | 143 |
141 } // namespace net | 144 } // namespace net |
142 | 145 |
143 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ | 146 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_ |
OLD | NEW |