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 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/dns/host_resolver.h" | 16 #include "net/dns/host_resolver.h" |
17 #include "net/socket/client_socket_pool.h" | 17 #include "net/socket/client_socket_pool.h" |
18 #include "net/socket/client_socket_pool_base.h" | 18 #include "net/socket/client_socket_pool_base.h" |
19 #include "net/socket/connection_attempts.h" | 19 #include "net/socket/connection_attempts.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class ClientSocketFactory; | 23 class ClientSocketFactory; |
24 class SocketPerformanceWatcherFactory; | 24 class SocketPerformanceWatcherFactory; |
25 | 25 |
26 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> | 26 typedef base::Callback<int(const AddressList&, const NetLogWithSource& net_log)> |
27 OnHostResolutionCallback; | 27 OnHostResolutionCallback; |
28 | 28 |
29 class NET_EXPORT_PRIVATE TransportSocketParams | 29 class NET_EXPORT_PRIVATE TransportSocketParams |
30 : public base::RefCounted<TransportSocketParams> { | 30 : public base::RefCounted<TransportSocketParams> { |
31 public: | 31 public: |
32 // CombineConnectAndWrite currently translates to using TCP FastOpen. | 32 // CombineConnectAndWrite currently translates to using TCP FastOpen. |
33 // TCP FastOpen should not be used if the first write to the socket may | 33 // TCP FastOpen should not be used if the first write to the socket may |
34 // be non-idempotent, as the underlying socket could retransmit the data | 34 // be non-idempotent, as the underlying socket could retransmit the data |
35 // on failure of the first transmission. | 35 // on failure of the first transmission. |
36 // NOTE: Currently, COMBINE_CONNECT_AND_WRITE_DESIRED is used if the data in | 36 // NOTE: Currently, COMBINE_CONNECT_AND_WRITE_DESIRED is used if the data in |
37 // the write is known to be idempotent, and COMBINE_CONNECT_AND_WRITE_DEFAULT | 37 // the write is known to be idempotent, and COMBINE_CONNECT_AND_WRITE_DEFAULT |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 ~TransportClientSocketPool() override; | 209 ~TransportClientSocketPool() override; |
210 | 210 |
211 // ClientSocketPool implementation. | 211 // ClientSocketPool implementation. |
212 int RequestSocket(const std::string& group_name, | 212 int RequestSocket(const std::string& group_name, |
213 const void* resolve_info, | 213 const void* resolve_info, |
214 RequestPriority priority, | 214 RequestPriority priority, |
215 RespectLimits respect_limits, | 215 RespectLimits respect_limits, |
216 ClientSocketHandle* handle, | 216 ClientSocketHandle* handle, |
217 const CompletionCallback& callback, | 217 const CompletionCallback& callback, |
218 const BoundNetLog& net_log) override; | 218 const NetLogWithSource& net_log) override; |
219 void RequestSockets(const std::string& group_name, | 219 void RequestSockets(const std::string& group_name, |
220 const void* params, | 220 const void* params, |
221 int num_sockets, | 221 int num_sockets, |
222 const BoundNetLog& net_log) override; | 222 const NetLogWithSource& net_log) override; |
223 void CancelRequest(const std::string& group_name, | 223 void CancelRequest(const std::string& group_name, |
224 ClientSocketHandle* handle) override; | 224 ClientSocketHandle* handle) override; |
225 void ReleaseSocket(const std::string& group_name, | 225 void ReleaseSocket(const std::string& group_name, |
226 std::unique_ptr<StreamSocket> socket, | 226 std::unique_ptr<StreamSocket> socket, |
227 int id) override; | 227 int id) override; |
228 void FlushWithError(int error) override; | 228 void FlushWithError(int error) override; |
229 void CloseIdleSockets() override; | 229 void CloseIdleSockets() override; |
230 int IdleSocketCount() const override; | 230 int IdleSocketCount() const override; |
231 int IdleSocketCountInGroup(const std::string& group_name) const override; | 231 int IdleSocketCountInGroup(const std::string& group_name) const override; |
232 LoadState GetLoadState(const std::string& group_name, | 232 LoadState GetLoadState(const std::string& group_name, |
233 const ClientSocketHandle* handle) const override; | 233 const ClientSocketHandle* handle) const override; |
234 std::unique_ptr<base::DictionaryValue> GetInfoAsValue( | 234 std::unique_ptr<base::DictionaryValue> GetInfoAsValue( |
235 const std::string& name, | 235 const std::string& name, |
236 const std::string& type, | 236 const std::string& type, |
237 bool include_nested_pools) const override; | 237 bool include_nested_pools) const override; |
238 base::TimeDelta ConnectionTimeout() const override; | 238 base::TimeDelta ConnectionTimeout() const override; |
239 | 239 |
240 // HigherLayeredPool implementation. | 240 // HigherLayeredPool implementation. |
241 bool IsStalled() const override; | 241 bool IsStalled() const override; |
242 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 242 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
243 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 243 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
244 | 244 |
245 protected: | 245 protected: |
246 // Methods shared with WebSocketTransportClientSocketPool | 246 // Methods shared with WebSocketTransportClientSocketPool |
247 void NetLogTcpClientSocketPoolRequestedSocket( | 247 void NetLogTcpClientSocketPoolRequestedSocket( |
248 const BoundNetLog& net_log, | 248 const NetLogWithSource& net_log, |
249 const scoped_refptr<TransportSocketParams>* casted_params); | 249 const scoped_refptr<TransportSocketParams>* casted_params); |
250 | 250 |
251 private: | 251 private: |
252 typedef ClientSocketPoolBase<TransportSocketParams> PoolBase; | 252 typedef ClientSocketPoolBase<TransportSocketParams> PoolBase; |
253 | 253 |
254 class TransportConnectJobFactory | 254 class TransportConnectJobFactory |
255 : public PoolBase::ConnectJobFactory { | 255 : public PoolBase::ConnectJobFactory { |
256 public: | 256 public: |
257 TransportConnectJobFactory( | 257 TransportConnectJobFactory( |
258 ClientSocketFactory* client_socket_factory, | 258 ClientSocketFactory* client_socket_factory, |
(...skipping 27 matching lines...) Expand all Loading... |
286 }; | 286 }; |
287 | 287 |
288 PoolBase base_; | 288 PoolBase base_; |
289 | 289 |
290 DISALLOW_COPY_AND_ASSIGN(TransportClientSocketPool); | 290 DISALLOW_COPY_AND_ASSIGN(TransportClientSocketPool); |
291 }; | 291 }; |
292 | 292 |
293 } // namespace net | 293 } // namespace net |
294 | 294 |
295 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 295 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |