| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/profiler/scoped_tracker.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
| 17 #include "net/dns/host_resolver.h" | 17 #include "net/dns/host_resolver.h" |
| 18 #include "net/dns/single_request_host_resolver.h" | 18 #include "net/dns/single_request_host_resolver.h" |
| 19 #include "net/socket/client_socket_pool.h" | 19 #include "net/socket/client_socket_pool.h" |
| 20 #include "net/socket/client_socket_pool_base.h" | 20 #include "net/socket/client_socket_pool_base.h" |
| 21 #include "net/socket/client_socket_pool_histograms.h" | |
| 22 | 21 |
| 23 namespace net { | 22 namespace net { |
| 24 | 23 |
| 25 class ClientSocketFactory; | 24 class ClientSocketFactory; |
| 26 | 25 |
| 27 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> | 26 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> |
| 28 OnHostResolutionCallback; | 27 OnHostResolutionCallback; |
| 29 | 28 |
| 30 class NET_EXPORT_PRIVATE TransportSocketParams | 29 class NET_EXPORT_PRIVATE TransportSocketParams |
| 31 : public base::RefCounted<TransportSocketParams> { | 30 : public base::RefCounted<TransportSocketParams> { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); | 211 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); |
| 213 }; | 212 }; |
| 214 | 213 |
| 215 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { | 214 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { |
| 216 public: | 215 public: |
| 217 typedef TransportSocketParams SocketParams; | 216 typedef TransportSocketParams SocketParams; |
| 218 | 217 |
| 219 TransportClientSocketPool( | 218 TransportClientSocketPool( |
| 220 int max_sockets, | 219 int max_sockets, |
| 221 int max_sockets_per_group, | 220 int max_sockets_per_group, |
| 222 ClientSocketPoolHistograms* histograms, | |
| 223 HostResolver* host_resolver, | 221 HostResolver* host_resolver, |
| 224 ClientSocketFactory* client_socket_factory, | 222 ClientSocketFactory* client_socket_factory, |
| 225 NetLog* net_log); | 223 NetLog* net_log); |
| 226 | 224 |
| 227 ~TransportClientSocketPool() override; | 225 ~TransportClientSocketPool() override; |
| 228 | 226 |
| 229 // ClientSocketPool implementation. | 227 // ClientSocketPool implementation. |
| 230 int RequestSocket(const std::string& group_name, | 228 int RequestSocket(const std::string& group_name, |
| 231 const void* resolve_info, | 229 const void* resolve_info, |
| 232 RequestPriority priority, | 230 RequestPriority priority, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 246 void CloseIdleSockets() override; | 244 void CloseIdleSockets() override; |
| 247 int IdleSocketCount() const override; | 245 int IdleSocketCount() const override; |
| 248 int IdleSocketCountInGroup(const std::string& group_name) const override; | 246 int IdleSocketCountInGroup(const std::string& group_name) const override; |
| 249 LoadState GetLoadState(const std::string& group_name, | 247 LoadState GetLoadState(const std::string& group_name, |
| 250 const ClientSocketHandle* handle) const override; | 248 const ClientSocketHandle* handle) const override; |
| 251 base::DictionaryValue* GetInfoAsValue( | 249 base::DictionaryValue* GetInfoAsValue( |
| 252 const std::string& name, | 250 const std::string& name, |
| 253 const std::string& type, | 251 const std::string& type, |
| 254 bool include_nested_pools) const override; | 252 bool include_nested_pools) const override; |
| 255 base::TimeDelta ConnectionTimeout() const override; | 253 base::TimeDelta ConnectionTimeout() const override; |
| 256 ClientSocketPoolHistograms* histograms() const override; | |
| 257 | 254 |
| 258 // HigherLayeredPool implementation. | 255 // HigherLayeredPool implementation. |
| 259 bool IsStalled() const override; | 256 bool IsStalled() const override; |
| 260 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 257 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 261 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 258 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 262 | 259 |
| 263 protected: | 260 protected: |
| 264 // Methods shared with WebSocketTransportClientSocketPool | 261 // Methods shared with WebSocketTransportClientSocketPool |
| 265 void NetLogTcpClientSocketPoolRequestedSocket( | 262 void NetLogTcpClientSocketPoolRequestedSocket( |
| 266 const BoundNetLog& net_log, | 263 const BoundNetLog& net_log, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 break; | 362 break; |
| 366 } | 363 } |
| 367 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 364 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
| 368 | 365 |
| 369 return rv; | 366 return rv; |
| 370 } | 367 } |
| 371 | 368 |
| 372 } // namespace net | 369 } // namespace net |
| 373 | 370 |
| 374 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 371 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |