| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TCP_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // TCPConnectJob handles the host resolution necessary for socket creation | 43 // TCPConnectJob handles the host resolution necessary for socket creation |
| 44 // and the tcp connect. | 44 // and the tcp connect. |
| 45 class TCPConnectJob : public ConnectJob { | 45 class TCPConnectJob : public ConnectJob { |
| 46 public: | 46 public: |
| 47 TCPConnectJob(const std::string& group_name, | 47 TCPConnectJob(const std::string& group_name, |
| 48 const TCPSocketParams& params, | 48 const TCPSocketParams& params, |
| 49 base::TimeDelta timeout_duration, | 49 base::TimeDelta timeout_duration, |
| 50 ClientSocketFactory* client_socket_factory, | 50 ClientSocketFactory* client_socket_factory, |
| 51 HostResolver* host_resolver, | 51 HostResolver* host_resolver, |
| 52 Delegate* delegate, | 52 Delegate* delegate, |
| 53 LoadLog* load_log); | 53 const BoundNetLog& net_log); |
| 54 virtual ~TCPConnectJob(); | 54 virtual ~TCPConnectJob(); |
| 55 | 55 |
| 56 // ConnectJob methods. | 56 // ConnectJob methods. |
| 57 virtual LoadState GetLoadState() const; | 57 virtual LoadState GetLoadState() const; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 enum State { | 60 enum State { |
| 61 kStateResolveHost, | 61 kStateResolveHost, |
| 62 kStateResolveHostComplete, | 62 kStateResolveHostComplete, |
| 63 kStateTCPConnect, | 63 kStateTCPConnect, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ClientSocketFactory* client_socket_factory, | 105 ClientSocketFactory* client_socket_factory, |
| 106 NetworkChangeNotifier* network_change_notifier); | 106 NetworkChangeNotifier* network_change_notifier); |
| 107 | 107 |
| 108 // ClientSocketPool methods: | 108 // ClientSocketPool methods: |
| 109 | 109 |
| 110 virtual int RequestSocket(const std::string& group_name, | 110 virtual int RequestSocket(const std::string& group_name, |
| 111 const void* resolve_info, | 111 const void* resolve_info, |
| 112 RequestPriority priority, | 112 RequestPriority priority, |
| 113 ClientSocketHandle* handle, | 113 ClientSocketHandle* handle, |
| 114 CompletionCallback* callback, | 114 CompletionCallback* callback, |
| 115 LoadLog* load_log); | 115 const BoundNetLog& net_log); |
| 116 | 116 |
| 117 virtual void CancelRequest(const std::string& group_name, | 117 virtual void CancelRequest(const std::string& group_name, |
| 118 const ClientSocketHandle* handle); | 118 const ClientSocketHandle* handle); |
| 119 | 119 |
| 120 virtual void ReleaseSocket(const std::string& group_name, | 120 virtual void ReleaseSocket(const std::string& group_name, |
| 121 ClientSocket* socket); | 121 ClientSocket* socket); |
| 122 | 122 |
| 123 virtual void CloseIdleSockets(); | 123 virtual void CloseIdleSockets(); |
| 124 | 124 |
| 125 virtual int IdleSocketCount() const { | 125 virtual int IdleSocketCount() const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 146 host_resolver_(host_resolver) {} | 146 host_resolver_(host_resolver) {} |
| 147 | 147 |
| 148 virtual ~TCPConnectJobFactory() {} | 148 virtual ~TCPConnectJobFactory() {} |
| 149 | 149 |
| 150 // ClientSocketPoolBase::ConnectJobFactory methods. | 150 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 151 | 151 |
| 152 virtual ConnectJob* NewConnectJob( | 152 virtual ConnectJob* NewConnectJob( |
| 153 const std::string& group_name, | 153 const std::string& group_name, |
| 154 const PoolBase::Request& request, | 154 const PoolBase::Request& request, |
| 155 ConnectJob::Delegate* delegate, | 155 ConnectJob::Delegate* delegate, |
| 156 LoadLog* load_log) const; | 156 const BoundNetLog& net_log) const; |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 ClientSocketFactory* const client_socket_factory_; | 159 ClientSocketFactory* const client_socket_factory_; |
| 160 const scoped_refptr<HostResolver> host_resolver_; | 160 const scoped_refptr<HostResolver> host_resolver_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(TCPConnectJobFactory); | 162 DISALLOW_COPY_AND_ASSIGN(TCPConnectJobFactory); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 PoolBase base_; | 165 PoolBase base_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 167 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams) | 170 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams) |
| 171 | 171 |
| 172 } // namespace net | 172 } // namespace net |
| 173 | 173 |
| 174 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 174 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |