OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 9 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ | 10 #define NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
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/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/template_util.h" | 18 #include "base/template_util.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
20 #include "net/base/cert_database.h" | 20 #include "net/base/cert_database.h" |
21 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
22 #include "net/base/net_api.h" | 22 #include "net/base/net_export.h" |
23 #include "net/base/request_priority.h" | 23 #include "net/base/request_priority.h" |
24 #include "net/socket/client_socket_pool_histograms.h" | 24 #include "net/socket/client_socket_pool_histograms.h" |
25 | 25 |
26 class GURL; | 26 class GURL; |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class Value; | 29 class Value; |
30 } | 30 } |
31 | 31 |
32 namespace net { | 32 namespace net { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( | 104 SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( |
105 const HostPortPair& socks_proxy); | 105 const HostPortPair& socks_proxy); |
106 | 106 |
107 HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( | 107 HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( |
108 const HostPortPair& http_proxy); | 108 const HostPortPair& http_proxy); |
109 | 109 |
110 SSLClientSocketPool* GetSocketPoolForSSLWithProxy( | 110 SSLClientSocketPool* GetSocketPoolForSSLWithProxy( |
111 const HostPortPair& proxy_server); | 111 const HostPortPair& proxy_server); |
112 | 112 |
113 NET_API static int max_sockets_per_group(); | 113 NET_EXPORT static int max_sockets_per_group(); |
114 NET_API static void set_max_sockets_per_group(int socket_count); | 114 NET_EXPORT static void set_max_sockets_per_group(int socket_count); |
115 NET_API static void set_max_sockets_per_proxy_server(int socket_count); | 115 NET_EXPORT static void set_max_sockets_per_proxy_server(int socket_count); |
116 | 116 |
117 // A helper method that uses the passed in proxy information to initialize a | 117 // A helper method that uses the passed in proxy information to initialize a |
118 // ClientSocketHandle with the relevant socket pool. Use this method for | 118 // ClientSocketHandle with the relevant socket pool. Use this method for |
119 // HTTP/HTTPS requests. |ssl_config_for_origin| is only used if the request | 119 // HTTP/HTTPS requests. |ssl_config_for_origin| is only used if the request |
120 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS. | 120 // uses SSL and |ssl_config_for_proxy| is used if the proxy server is HTTPS. |
121 static int InitSocketHandleForHttpRequest( | 121 static int InitSocketHandleForHttpRequest( |
122 const GURL& request_url, | 122 const GURL& request_url, |
123 const HttpRequestHeaders& request_extra_headers, | 123 const HttpRequestHeaders& request_extra_headers, |
124 int request_load_flags, | 124 int request_load_flags, |
125 RequestPriority request_priority, | 125 RequestPriority request_priority, |
126 HttpNetworkSession* session, | 126 HttpNetworkSession* session, |
127 const ProxyInfo& proxy_info, | 127 const ProxyInfo& proxy_info, |
128 bool force_spdy_over_ssl, | 128 bool force_spdy_over_ssl, |
129 bool want_spdy_over_npn, | 129 bool want_spdy_over_npn, |
130 const SSLConfig& ssl_config_for_origin, | 130 const SSLConfig& ssl_config_for_origin, |
131 const SSLConfig& ssl_config_for_proxy, | 131 const SSLConfig& ssl_config_for_proxy, |
132 const BoundNetLog& net_log, | 132 const BoundNetLog& net_log, |
133 ClientSocketHandle* socket_handle, | 133 ClientSocketHandle* socket_handle, |
134 CompletionCallback* callback); | 134 CompletionCallback* callback); |
135 | 135 |
136 // A helper method that uses the passed in proxy information to initialize a | 136 // A helper method that uses the passed in proxy information to initialize a |
137 // ClientSocketHandle with the relevant socket pool. Use this method for | 137 // ClientSocketHandle with the relevant socket pool. Use this method for |
138 // a raw socket connection to a host-port pair (that needs to tunnel through | 138 // a raw socket connection to a host-port pair (that needs to tunnel through |
139 // the proxies). | 139 // the proxies). |
140 NET_API static int InitSocketHandleForRawConnect( | 140 NET_EXPORT static int InitSocketHandleForRawConnect( |
141 const HostPortPair& host_port_pair, | 141 const HostPortPair& host_port_pair, |
142 HttpNetworkSession* session, | 142 HttpNetworkSession* session, |
143 const ProxyInfo& proxy_info, | 143 const ProxyInfo& proxy_info, |
144 const SSLConfig& ssl_config_for_origin, | 144 const SSLConfig& ssl_config_for_origin, |
145 const SSLConfig& ssl_config_for_proxy, | 145 const SSLConfig& ssl_config_for_proxy, |
146 const BoundNetLog& net_log, | 146 const BoundNetLog& net_log, |
147 ClientSocketHandle* socket_handle, | 147 ClientSocketHandle* socket_handle, |
148 CompletionCallback* callback); | 148 CompletionCallback* callback); |
149 | 149 |
150 // Similar to InitSocketHandleForHttpRequest except that it initiates the | 150 // Similar to InitSocketHandleForHttpRequest except that it initiates the |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; | 223 ClientSocketPoolHistograms ssl_socket_pool_for_proxies_histograms_; |
224 SSLSocketPoolMap ssl_socket_pools_for_proxies_; | 224 SSLSocketPoolMap ssl_socket_pools_for_proxies_; |
225 | 225 |
226 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); | 226 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolManager); |
227 }; | 227 }; |
228 | 228 |
229 } // namespace net | 229 } // namespace net |
230 | 230 |
231 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ | 231 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
OLD | NEW |