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/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/dns/single_request_host_resolver.h" | 17 #include "net/dns/single_request_host_resolver.h" |
18 #include "net/socket/client_socket_pool.h" | 18 #include "net/socket/client_socket_pool.h" |
19 #include "net/socket/client_socket_pool_base.h" | 19 #include "net/socket/client_socket_pool_base.h" |
| 20 #include "net/socket/connection_attempts.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 class ClientSocketFactory; | 24 class ClientSocketFactory; |
24 | 25 |
25 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> | 26 typedef base::Callback<int(const AddressList&, const BoundNetLog& net_log)> |
26 OnHostResolutionCallback; | 27 OnHostResolutionCallback; |
27 | 28 |
28 class NET_EXPORT_PRIVATE TransportSocketParams | 29 class NET_EXPORT_PRIVATE TransportSocketParams |
29 : public base::RefCounted<TransportSocketParams> { | 30 : public base::RefCounted<TransportSocketParams> { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 scoped_ptr<AddressList> fallback_addresses_; | 205 scoped_ptr<AddressList> fallback_addresses_; |
205 base::TimeTicks fallback_connect_start_time_; | 206 base::TimeTicks fallback_connect_start_time_; |
206 base::OneShotTimer<TransportConnectJob> fallback_timer_; | 207 base::OneShotTimer<TransportConnectJob> fallback_timer_; |
207 | 208 |
208 // Track the interval between this connect and previous connect. | 209 // Track the interval between this connect and previous connect. |
209 ConnectInterval interval_between_connects_; | 210 ConnectInterval interval_between_connects_; |
210 | 211 |
211 int resolve_result_; | 212 int resolve_result_; |
212 int connect_result_; | 213 int connect_result_; |
213 | 214 |
| 215 // Saved when connections fail and passed up in GetAdditionalErrorState. |
| 216 ConnectionAttempts connection_attempts_; |
| 217 ConnectionAttempts fallback_connection_attempts_; |
| 218 |
214 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); | 219 DISALLOW_COPY_AND_ASSIGN(TransportConnectJob); |
215 }; | 220 }; |
216 | 221 |
217 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { | 222 class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool { |
218 public: | 223 public: |
219 typedef TransportSocketParams SocketParams; | 224 typedef TransportSocketParams SocketParams; |
220 | 225 |
221 TransportClientSocketPool( | 226 TransportClientSocketPool( |
222 int max_sockets, | 227 int max_sockets, |
223 int max_sockets_per_group, | 228 int max_sockets_per_group, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 break; | 359 break; |
355 } | 360 } |
356 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 361 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
357 | 362 |
358 return rv; | 363 return rv; |
359 } | 364 } |
360 | 365 |
361 } // namespace net | 366 } // namespace net |
362 | 367 |
363 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 368 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |