OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 25 matching lines...) Expand all Loading... |
36 // with broken IPv6 support). Those timeouts take 20s, so rather than make the | 36 // with broken IPv6 support). Those timeouts take 20s, so rather than make the |
37 // user wait 20s for the timeout to fire, we use a fallback timer | 37 // user wait 20s for the timeout to fire, we use a fallback timer |
38 // (kIPv6FallbackTimerInMs) and start a connect() to an IPv4 address if the | 38 // (kIPv6FallbackTimerInMs) and start a connect() to an IPv4 address if the |
39 // timer fires. Then we race the IPv4 connect(s) against the IPv6 connect(s) and | 39 // timer fires. Then we race the IPv4 connect(s) against the IPv6 connect(s) and |
40 // use the socket that completes successfully first or fails last. | 40 // use the socket that completes successfully first or fails last. |
41 class NET_EXPORT_PRIVATE WebSocketTransportConnectJob : public ConnectJob { | 41 class NET_EXPORT_PRIVATE WebSocketTransportConnectJob : public ConnectJob { |
42 public: | 42 public: |
43 WebSocketTransportConnectJob( | 43 WebSocketTransportConnectJob( |
44 const std::string& group_name, | 44 const std::string& group_name, |
45 RequestPriority priority, | 45 RequestPriority priority, |
| 46 ClientSocketPool::RespectLimits respect_limits, |
46 const scoped_refptr<TransportSocketParams>& params, | 47 const scoped_refptr<TransportSocketParams>& params, |
47 base::TimeDelta timeout_duration, | 48 base::TimeDelta timeout_duration, |
48 const CompletionCallback& callback, | 49 const CompletionCallback& callback, |
49 ClientSocketFactory* client_socket_factory, | 50 ClientSocketFactory* client_socket_factory, |
50 HostResolver* host_resolver, | 51 HostResolver* host_resolver, |
51 ClientSocketHandle* handle, | 52 ClientSocketHandle* handle, |
52 Delegate* delegate, | 53 Delegate* delegate, |
53 NetLog* pool_net_log, | 54 NetLog* pool_net_log, |
54 const BoundNetLog& request_net_log); | 55 const BoundNetLog& request_net_log); |
55 ~WebSocketTransportConnectJob() override; | 56 ~WebSocketTransportConnectJob() override; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // is connected to. Used when the WebSocket handshake completes successfully. | 128 // is connected to. Used when the WebSocket handshake completes successfully. |
128 // This only works if the socket is connected, however the caller does not | 129 // This only works if the socket is connected, however the caller does not |
129 // need to explicitly check for this. Instead, ensure that dead sockets are | 130 // need to explicitly check for this. Instead, ensure that dead sockets are |
130 // returned to ReleaseSocket() in a timely fashion. | 131 // returned to ReleaseSocket() in a timely fashion. |
131 static void UnlockEndpoint(ClientSocketHandle* handle); | 132 static void UnlockEndpoint(ClientSocketHandle* handle); |
132 | 133 |
133 // ClientSocketPool implementation. | 134 // ClientSocketPool implementation. |
134 int RequestSocket(const std::string& group_name, | 135 int RequestSocket(const std::string& group_name, |
135 const void* resolve_info, | 136 const void* resolve_info, |
136 RequestPriority priority, | 137 RequestPriority priority, |
| 138 RespectLimits respect_limits, |
137 ClientSocketHandle* handle, | 139 ClientSocketHandle* handle, |
138 const CompletionCallback& callback, | 140 const CompletionCallback& callback, |
139 const BoundNetLog& net_log) override; | 141 const BoundNetLog& net_log) override; |
140 void RequestSockets(const std::string& group_name, | 142 void RequestSockets(const std::string& group_name, |
141 const void* params, | 143 const void* params, |
142 int num_sockets, | 144 int num_sockets, |
143 const BoundNetLog& net_log) override; | 145 const BoundNetLog& net_log) override; |
144 void CancelRequest(const std::string& group_name, | 146 void CancelRequest(const std::string& group_name, |
145 ClientSocketHandle* handle) override; | 147 ClientSocketHandle* handle) override; |
146 void ReleaseSocket(const std::string& group_name, | 148 void ReleaseSocket(const std::string& group_name, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool flushing_; | 235 bool flushing_; |
234 | 236 |
235 base::WeakPtrFactory<WebSocketTransportClientSocketPool> weak_factory_; | 237 base::WeakPtrFactory<WebSocketTransportClientSocketPool> weak_factory_; |
236 | 238 |
237 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportClientSocketPool); | 239 DISALLOW_COPY_AND_ASSIGN(WebSocketTransportClientSocketPool); |
238 }; | 240 }; |
239 | 241 |
240 } // namespace net | 242 } // namespace net |
241 | 243 |
242 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 244 #endif // NET_SOCKET_WEBSOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |