| 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" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 enum State { | 88 enum State { |
| 89 STATE_RESOLVE_HOST, | 89 STATE_RESOLVE_HOST, |
| 90 STATE_RESOLVE_HOST_COMPLETE, | 90 STATE_RESOLVE_HOST_COMPLETE, |
| 91 STATE_TRANSPORT_CONNECT, | 91 STATE_TRANSPORT_CONNECT, |
| 92 STATE_TRANSPORT_CONNECT_COMPLETE, | 92 STATE_TRANSPORT_CONNECT_COMPLETE, |
| 93 STATE_NONE, | 93 STATE_NONE, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 enum ConnectInterval { |
| 97 CONNECT_INTERVAL_LE_10MS, |
| 98 CONNECT_INTERVAL_LE_20MS, |
| 99 CONNECT_INTERVAL_GT_20MS, |
| 100 }; |
| 101 |
| 96 void OnIOComplete(int result); | 102 void OnIOComplete(int result); |
| 97 | 103 |
| 98 // Runs the state transition loop. | 104 // Runs the state transition loop. |
| 99 int DoLoop(int result); | 105 int DoLoop(int result); |
| 100 | 106 |
| 101 int DoResolveHost(); | 107 int DoResolveHost(); |
| 102 int DoResolveHostComplete(int result); | 108 int DoResolveHostComplete(int result); |
| 103 int DoTransportConnect(); | 109 int DoTransportConnect(); |
| 104 int DoTransportConnectComplete(int result); | 110 int DoTransportConnectComplete(int result); |
| 105 | 111 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 118 AddressList addresses_; | 124 AddressList addresses_; |
| 119 State next_state_; | 125 State next_state_; |
| 120 | 126 |
| 121 scoped_ptr<StreamSocket> transport_socket_; | 127 scoped_ptr<StreamSocket> transport_socket_; |
| 122 | 128 |
| 123 scoped_ptr<StreamSocket> fallback_transport_socket_; | 129 scoped_ptr<StreamSocket> fallback_transport_socket_; |
| 124 scoped_ptr<AddressList> fallback_addresses_; | 130 scoped_ptr<AddressList> fallback_addresses_; |
| 125 base::TimeTicks fallback_connect_start_time_; | 131 base::TimeTicks fallback_connect_start_time_; |
| 126 base::OneShotTimer<TransportConnectJob> fallback_timer_; | 132 base::OneShotTimer<TransportConnectJob> fallback_timer_; |
| 127 | 133 |
| 128 // If the interval between this connect and previous connect is less than | 134 // Track the interval between this connect and previous connect. |
| 129 // 20ms, then |less_than_20ms_since_connect_| is set to true. | 135 ConnectInterval interval_between_connects_; |
| 130 bool less_than_20ms_since_connect_; | |
| 131 | 136 |
| 132 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); | 137 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); |
| 133 }; | 138 }; |
| 134 | 139 |
| 135 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { | 140 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { |
| 136 public: | 141 public: |
| 137 typedef TransportSocketParams SocketParams; | 142 typedef TransportSocketParams SocketParams; |
| 138 | 143 |
| 139 TransportClientSocketPool( | 144 TransportClientSocketPool( |
| 140 int max_sockets, | 145 int max_sockets, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 PoolBase base_; | 222 PoolBase base_; |
| 218 | 223 |
| 219 DISALLOW_COPY_AND_ASSIGN(TransportClientSocketPool); | 224 DISALLOW_COPY_AND_ASSIGN(TransportClientSocketPool); |
| 220 }; | 225 }; |
| 221 | 226 |
| 222 } // namespace net | 227 } // namespace net |
| 223 | 228 |
| 224 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 229 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |