| 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 20 matching lines...) Expand all Loading... |
| 31 public: | 31 public: |
| 32 // |host_resolution_callback| will be invoked after the the hostname is | 32 // |host_resolution_callback| will be invoked after the the hostname is |
| 33 // resolved. If |host_resolution_callback| does not return OK, then the | 33 // resolved. If |host_resolution_callback| does not return OK, then the |
| 34 // connection will be aborted with that value. | 34 // connection will be aborted with that value. |
| 35 TransportSocketParams( | 35 TransportSocketParams( |
| 36 const HostPortPair& host_port_pair, | 36 const HostPortPair& host_port_pair, |
| 37 bool disable_resolver_cache, | 37 bool disable_resolver_cache, |
| 38 bool ignore_limits, | 38 bool ignore_limits, |
| 39 const OnHostResolutionCallback& host_resolution_callback); | 39 const OnHostResolutionCallback& host_resolution_callback); |
| 40 | 40 |
| 41 // Same as above with one additional boolean to enable use of TCP FastOpen. |
| 42 TransportSocketParams( |
| 43 const HostPortPair& host_port_pair, |
| 44 bool disable_resolver_cache, |
| 45 bool ignore_limits, |
| 46 const OnHostResolutionCallback& host_resolution_callback, |
| 47 bool use_tcp_fastopen_if_supported); |
| 48 |
| 41 const HostResolver::RequestInfo& destination() const { return destination_; } | 49 const HostResolver::RequestInfo& destination() const { return destination_; } |
| 42 bool ignore_limits() const { return ignore_limits_; } | 50 bool ignore_limits() const { return ignore_limits_; } |
| 43 const OnHostResolutionCallback& host_resolution_callback() const { | 51 const OnHostResolutionCallback& host_resolution_callback() const { |
| 44 return host_resolution_callback_; | 52 return host_resolution_callback_; |
| 45 } | 53 } |
| 54 void enable_use_tcp_fastopen_if_supported() { |
| 55 use_tcp_fastopen_if_supported_ = true; |
| 56 } |
| 57 bool use_tcp_fastopen_if_supported() const { |
| 58 return use_tcp_fastopen_if_supported_; |
| 59 } |
| 46 | 60 |
| 47 private: | 61 private: |
| 48 friend class base::RefCounted<TransportSocketParams>; | 62 friend class base::RefCounted<TransportSocketParams>; |
| 49 ~TransportSocketParams(); | 63 ~TransportSocketParams(); |
| 50 | 64 |
| 51 HostResolver::RequestInfo destination_; | 65 HostResolver::RequestInfo destination_; |
| 52 bool ignore_limits_; | 66 bool ignore_limits_; |
| 53 const OnHostResolutionCallback host_resolution_callback_; | 67 const OnHostResolutionCallback host_resolution_callback_; |
| 68 bool use_tcp_fastopen_if_supported_; |
| 54 | 69 |
| 55 DISALLOW_COPY_AND_ASSIGN(TransportSocketParams); | 70 DISALLOW_COPY_AND_ASSIGN(TransportSocketParams); |
| 56 }; | 71 }; |
| 57 | 72 |
| 58 // Common data and logic shared between TransportConnectJob and | 73 // Common data and logic shared between TransportConnectJob and |
| 59 // WebSocketTransportConnectJob. | 74 // WebSocketTransportConnectJob. |
| 60 class NET_EXPORT_PRIVATE TransportConnectJobHelper { | 75 class NET_EXPORT_PRIVATE TransportConnectJobHelper { |
| 61 public: | 76 public: |
| 62 enum State { | 77 enum State { |
| 63 STATE_RESOLVE_HOST, | 78 STATE_RESOLVE_HOST, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 ~TransportConnectJobHelper(); | 98 ~TransportConnectJobHelper(); |
| 84 | 99 |
| 85 ClientSocketFactory* client_socket_factory() { | 100 ClientSocketFactory* client_socket_factory() { |
| 86 return client_socket_factory_; | 101 return client_socket_factory_; |
| 87 } | 102 } |
| 88 | 103 |
| 89 const AddressList& addresses() const { return addresses_; } | 104 const AddressList& addresses() const { return addresses_; } |
| 90 State next_state() const { return next_state_; } | 105 State next_state() const { return next_state_; } |
| 91 void set_next_state(State next_state) { next_state_ = next_state; } | 106 void set_next_state(State next_state) { next_state_ = next_state; } |
| 92 CompletionCallback on_io_complete() const { return on_io_complete_; } | 107 CompletionCallback on_io_complete() const { return on_io_complete_; } |
| 108 const TransportSocketParams* params() { return params_.get(); } |
| 93 | 109 |
| 94 int DoResolveHost(RequestPriority priority, const BoundNetLog& net_log); | 110 int DoResolveHost(RequestPriority priority, const BoundNetLog& net_log); |
| 95 int DoResolveHostComplete(int result, const BoundNetLog& net_log); | 111 int DoResolveHostComplete(int result, const BoundNetLog& net_log); |
| 96 | 112 |
| 97 template <class T> | 113 template <class T> |
| 98 int DoConnectInternal(T* job); | 114 int DoConnectInternal(T* job); |
| 99 | 115 |
| 100 template <class T> | 116 template <class T> |
| 101 void SetOnIOComplete(T* job); | 117 void SetOnIOComplete(T* job); |
| 102 | 118 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 break; | 349 break; |
| 334 } | 350 } |
| 335 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 351 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
| 336 | 352 |
| 337 return rv; | 353 return rv; |
| 338 } | 354 } |
| 339 | 355 |
| 340 } // namespace net | 356 } // namespace net |
| 341 | 357 |
| 342 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 358 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |