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 // 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 | 11 |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 #include "net/base/request_priority.h" | 14 #include "net/base/request_priority.h" |
15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class Value; | 20 class Value; |
21 } | 21 } |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> | 25 typedef base::Callback<int(const AddressList&, const NetLogWithSource& net_log)> |
26 OnHostResolutionCallback; | 26 OnHostResolutionCallback; |
27 | 27 |
28 class BoundNetLog; | 28 class NetLogWithSource; |
29 class ClientSocketHandle; | 29 class ClientSocketHandle; |
30 class HostPortPair; | 30 class HostPortPair; |
31 class HttpNetworkSession; | 31 class HttpNetworkSession; |
32 class HttpProxyClientSocketPool; | 32 class HttpProxyClientSocketPool; |
33 class HttpRequestHeaders; | 33 class HttpRequestHeaders; |
34 class ProxyInfo; | 34 class ProxyInfo; |
35 class TransportClientSocketPool; | 35 class TransportClientSocketPool; |
36 class SOCKSClientSocketPool; | 36 class SOCKSClientSocketPool; |
37 class SSLClientSocketPool; | 37 class SSLClientSocketPool; |
38 | 38 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const HostPortPair& endpoint, | 101 const HostPortPair& endpoint, |
102 const HttpRequestHeaders& request_extra_headers, | 102 const HttpRequestHeaders& request_extra_headers, |
103 int request_load_flags, | 103 int request_load_flags, |
104 RequestPriority request_priority, | 104 RequestPriority request_priority, |
105 HttpNetworkSession* session, | 105 HttpNetworkSession* session, |
106 const ProxyInfo& proxy_info, | 106 const ProxyInfo& proxy_info, |
107 bool expect_spdy, | 107 bool expect_spdy, |
108 const SSLConfig& ssl_config_for_origin, | 108 const SSLConfig& ssl_config_for_origin, |
109 const SSLConfig& ssl_config_for_proxy, | 109 const SSLConfig& ssl_config_for_proxy, |
110 PrivacyMode privacy_mode, | 110 PrivacyMode privacy_mode, |
111 const BoundNetLog& net_log, | 111 const NetLogWithSource& net_log, |
112 ClientSocketHandle* socket_handle, | 112 ClientSocketHandle* socket_handle, |
113 const OnHostResolutionCallback& resolution_callback, | 113 const OnHostResolutionCallback& resolution_callback, |
114 const CompletionCallback& callback); | 114 const CompletionCallback& callback); |
115 | 115 |
116 // A helper method that uses the passed in proxy information to initialize a | 116 // A helper method that uses the passed in proxy information to initialize a |
117 // ClientSocketHandle with the relevant socket pool. Use this method for | 117 // ClientSocketHandle with the relevant socket pool. Use this method for |
118 // HTTP/HTTPS requests for WebSocket handshake. | 118 // HTTP/HTTPS requests for WebSocket handshake. |
119 // |ssl_config_for_origin| is only used if the request | 119 // |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 // |resolution_callback| will be invoked after the the hostname is | 121 // |resolution_callback| will be invoked after the the hostname is |
122 // resolved. If |resolution_callback| does not return OK, then the | 122 // resolved. If |resolution_callback| does not return OK, then the |
123 // connection will be aborted with that value. | 123 // connection will be aborted with that value. |
124 // This function uses WEBSOCKET_SOCKET_POOL socket pools. | 124 // This function uses WEBSOCKET_SOCKET_POOL socket pools. |
125 int InitSocketHandleForWebSocketRequest( | 125 int InitSocketHandleForWebSocketRequest( |
126 ClientSocketPoolManager::SocketGroupType group_type, | 126 ClientSocketPoolManager::SocketGroupType group_type, |
127 const HostPortPair& endpoint, | 127 const HostPortPair& endpoint, |
128 const HttpRequestHeaders& request_extra_headers, | 128 const HttpRequestHeaders& request_extra_headers, |
129 int request_load_flags, | 129 int request_load_flags, |
130 RequestPriority request_priority, | 130 RequestPriority request_priority, |
131 HttpNetworkSession* session, | 131 HttpNetworkSession* session, |
132 const ProxyInfo& proxy_info, | 132 const ProxyInfo& proxy_info, |
133 bool expect_spdy, | 133 bool expect_spdy, |
134 const SSLConfig& ssl_config_for_origin, | 134 const SSLConfig& ssl_config_for_origin, |
135 const SSLConfig& ssl_config_for_proxy, | 135 const SSLConfig& ssl_config_for_proxy, |
136 PrivacyMode privacy_mode, | 136 PrivacyMode privacy_mode, |
137 const BoundNetLog& net_log, | 137 const NetLogWithSource& net_log, |
138 ClientSocketHandle* socket_handle, | 138 ClientSocketHandle* socket_handle, |
139 const OnHostResolutionCallback& resolution_callback, | 139 const OnHostResolutionCallback& resolution_callback, |
140 const CompletionCallback& callback); | 140 const CompletionCallback& callback); |
141 | 141 |
142 // A helper method that uses the passed in proxy information to initialize a | 142 // A helper method that uses the passed in proxy information to initialize a |
143 // ClientSocketHandle with the relevant socket pool. Use this method for | 143 // ClientSocketHandle with the relevant socket pool. Use this method for |
144 // a raw socket connection to a host-port pair (that needs to tunnel through | 144 // a raw socket connection to a host-port pair (that needs to tunnel through |
145 // the proxies). | 145 // the proxies). |
146 NET_EXPORT int InitSocketHandleForRawConnect( | 146 NET_EXPORT int InitSocketHandleForRawConnect( |
147 const HostPortPair& host_port_pair, | 147 const HostPortPair& host_port_pair, |
148 HttpNetworkSession* session, | 148 HttpNetworkSession* session, |
149 const ProxyInfo& proxy_info, | 149 const ProxyInfo& proxy_info, |
150 const SSLConfig& ssl_config_for_origin, | 150 const SSLConfig& ssl_config_for_origin, |
151 const SSLConfig& ssl_config_for_proxy, | 151 const SSLConfig& ssl_config_for_proxy, |
152 PrivacyMode privacy_mode, | 152 PrivacyMode privacy_mode, |
153 const BoundNetLog& net_log, | 153 const NetLogWithSource& net_log, |
154 ClientSocketHandle* socket_handle, | 154 ClientSocketHandle* socket_handle, |
155 const CompletionCallback& callback); | 155 const CompletionCallback& callback); |
156 | 156 |
157 // A helper method that uses the passed in proxy information to initialize a | 157 // A helper method that uses the passed in proxy information to initialize a |
158 // ClientSocketHandle with the relevant socket pool. Use this method for | 158 // ClientSocketHandle with the relevant socket pool. Use this method for |
159 // a raw socket connection with TLS negotiation to a host-port pair (that needs | 159 // a raw socket connection with TLS negotiation to a host-port pair (that needs |
160 // to tunnel through the proxies). | 160 // to tunnel through the proxies). |
161 NET_EXPORT int InitSocketHandleForTlsConnect( | 161 NET_EXPORT int InitSocketHandleForTlsConnect( |
162 const HostPortPair& host_port_pair, | 162 const HostPortPair& host_port_pair, |
163 HttpNetworkSession* session, | 163 HttpNetworkSession* session, |
164 const ProxyInfo& proxy_info, | 164 const ProxyInfo& proxy_info, |
165 const SSLConfig& ssl_config_for_origin, | 165 const SSLConfig& ssl_config_for_origin, |
166 const SSLConfig& ssl_config_for_proxy, | 166 const SSLConfig& ssl_config_for_proxy, |
167 PrivacyMode privacy_mode, | 167 PrivacyMode privacy_mode, |
168 const BoundNetLog& net_log, | 168 const NetLogWithSource& net_log, |
169 ClientSocketHandle* socket_handle, | 169 ClientSocketHandle* socket_handle, |
170 const CompletionCallback& callback); | 170 const CompletionCallback& callback); |
171 | 171 |
172 // Similar to InitSocketHandleForHttpRequest except that it initiates the | 172 // Similar to InitSocketHandleForHttpRequest except that it initiates the |
173 // desired number of preconnect streams from the relevant socket pool. | 173 // desired number of preconnect streams from the relevant socket pool. |
174 int PreconnectSocketsForHttpRequest( | 174 int PreconnectSocketsForHttpRequest( |
175 ClientSocketPoolManager::SocketGroupType group_type, | 175 ClientSocketPoolManager::SocketGroupType group_type, |
176 const HostPortPair& endpoint, | 176 const HostPortPair& endpoint, |
177 const HttpRequestHeaders& request_extra_headers, | 177 const HttpRequestHeaders& request_extra_headers, |
178 int request_load_flags, | 178 int request_load_flags, |
179 RequestPriority request_priority, | 179 RequestPriority request_priority, |
180 HttpNetworkSession* session, | 180 HttpNetworkSession* session, |
181 const ProxyInfo& proxy_info, | 181 const ProxyInfo& proxy_info, |
182 bool expect_spdy, | 182 bool expect_spdy, |
183 const SSLConfig& ssl_config_for_origin, | 183 const SSLConfig& ssl_config_for_origin, |
184 const SSLConfig& ssl_config_for_proxy, | 184 const SSLConfig& ssl_config_for_proxy, |
185 PrivacyMode privacy_mode, | 185 PrivacyMode privacy_mode, |
186 const BoundNetLog& net_log, | 186 const NetLogWithSource& net_log, |
187 int num_preconnect_streams); | 187 int num_preconnect_streams); |
188 | 188 |
189 } // namespace net | 189 } // namespace net |
190 | 190 |
191 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ | 191 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_MANAGER_H_ |
OLD | NEW |