| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 enum State { | 66 enum State { |
| 67 STATE_RESOLVE_HOST, | 67 STATE_RESOLVE_HOST, |
| 68 STATE_RESOLVE_HOST_COMPLETE, | 68 STATE_RESOLVE_HOST_COMPLETE, |
| 69 STATE_TCP_CONNECT, | 69 STATE_TCP_CONNECT, |
| 70 STATE_TCP_CONNECT_COMPLETE, | 70 STATE_TCP_CONNECT_COMPLETE, |
| 71 STATE_NONE, | 71 STATE_NONE, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // Begins the host resolution and the TCP connect. Returns OK on success | |
| 75 // and ERR_IO_PENDING if it cannot immediately service the request. | |
| 76 // Otherwise, it returns a net error code. | |
| 77 virtual int ConnectInternal(); | |
| 78 | |
| 79 void OnIOComplete(int result); | 74 void OnIOComplete(int result); |
| 80 | 75 |
| 81 // Runs the state transition loop. | 76 // Runs the state transition loop. |
| 82 int DoLoop(int result); | 77 int DoLoop(int result); |
| 83 | 78 |
| 84 int DoResolveHost(); | 79 int DoResolveHost(); |
| 85 int DoResolveHostComplete(int result); | 80 int DoResolveHostComplete(int result); |
| 86 int DoTCPConnect(); | 81 int DoTCPConnect(); |
| 87 int DoTCPConnectComplete(int result); | 82 int DoTCPConnectComplete(int result); |
| 88 | 83 |
| 84 // Begins the host resolution and the TCP connect. Returns OK on success |
| 85 // and ERR_IO_PENDING if it cannot immediately service the request. |
| 86 // Otherwise, it returns a net error code. |
| 87 virtual int ConnectInternal(); |
| 88 |
| 89 scoped_refptr<TCPSocketParams> params_; | 89 scoped_refptr<TCPSocketParams> params_; |
| 90 ClientSocketFactory* const client_socket_factory_; | 90 ClientSocketFactory* const client_socket_factory_; |
| 91 CompletionCallbackImpl<TCPConnectJob> callback_; | 91 CompletionCallbackImpl<TCPConnectJob> callback_; |
| 92 SingleRequestHostResolver resolver_; | 92 SingleRequestHostResolver resolver_; |
| 93 AddressList addresses_; | 93 AddressList addresses_; |
| 94 State next_state_; | 94 State next_state_; |
| 95 | 95 |
| 96 // The time Connect() was called. | 96 // The time Connect() was called. |
| 97 base::TimeTicks start_time_; | 97 base::TimeTicks start_time_; |
| 98 | 98 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 PoolBase base_; | 189 PoolBase base_; |
| 190 | 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 191 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams); | 194 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams); |
| 195 | 195 |
| 196 } // namespace net | 196 } // namespace net |
| 197 | 197 |
| 198 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 198 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |