| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 COMBINE_CONNECT_AND_WRITE_PROHIBITED // Do not combine. | 43 COMBINE_CONNECT_AND_WRITE_PROHIBITED // Do not combine. |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // |host_resolution_callback| will be invoked after the the hostname is | 46 // |host_resolution_callback| will be invoked after the the hostname is |
| 47 // resolved. If |host_resolution_callback| does not return OK, then the | 47 // resolved. If |host_resolution_callback| does not return OK, then the |
| 48 // connection will be aborted with that value. |combine_connect_and_write| | 48 // connection will be aborted with that value. |combine_connect_and_write| |
| 49 // defines the policy for use of TCP FastOpen on this socket. | 49 // defines the policy for use of TCP FastOpen on this socket. |
| 50 TransportSocketParams( | 50 TransportSocketParams( |
| 51 const HostPortPair& host_port_pair, | 51 const HostPortPair& host_port_pair, |
| 52 bool disable_resolver_cache, | 52 bool disable_resolver_cache, |
| 53 bool ignore_limits, | |
| 54 const OnHostResolutionCallback& host_resolution_callback, | 53 const OnHostResolutionCallback& host_resolution_callback, |
| 55 CombineConnectAndWritePolicy combine_connect_and_write); | 54 CombineConnectAndWritePolicy combine_connect_and_write); |
| 56 | 55 |
| 57 const HostResolver::RequestInfo& destination() const { return destination_; } | 56 const HostResolver::RequestInfo& destination() const { return destination_; } |
| 58 bool ignore_limits() const { return ignore_limits_; } | |
| 59 const OnHostResolutionCallback& host_resolution_callback() const { | 57 const OnHostResolutionCallback& host_resolution_callback() const { |
| 60 return host_resolution_callback_; | 58 return host_resolution_callback_; |
| 61 } | 59 } |
| 62 | 60 |
| 63 CombineConnectAndWritePolicy combine_connect_and_write() const { | 61 CombineConnectAndWritePolicy combine_connect_and_write() const { |
| 64 return combine_connect_and_write_; | 62 return combine_connect_and_write_; |
| 65 } | 63 } |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 friend class base::RefCounted<TransportSocketParams>; | 66 friend class base::RefCounted<TransportSocketParams>; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // logic for IPv6 connect() timeouts (which may happen due to networks / routers | 149 // logic for IPv6 connect() timeouts (which may happen due to networks / routers |
| 152 // with broken IPv6 support). Those timeouts take 20s, so rather than make the | 150 // with broken IPv6 support). Those timeouts take 20s, so rather than make the |
| 153 // user wait 20s for the timeout to fire, we use a fallback timer | 151 // user wait 20s for the timeout to fire, we use a fallback timer |
| 154 // (kIPv6FallbackTimerInMs) and start a connect() to a IPv4 address if the timer | 152 // (kIPv6FallbackTimerInMs) and start a connect() to a IPv4 address if the timer |
| 155 // fires. Then we race the IPv4 connect() against the IPv6 connect() (which has | 153 // fires. Then we race the IPv4 connect() against the IPv6 connect() (which has |
| 156 // a headstart) and return the one that completes first to the socket pool. | 154 // a headstart) and return the one that completes first to the socket pool. |
| 157 class NET_EXPORT_PRIVATE TransportConnectJob : public ConnectJob { | 155 class NET_EXPORT_PRIVATE TransportConnectJob : public ConnectJob { |
| 158 public: | 156 public: |
| 159 TransportConnectJob(const std::string& group_name, | 157 TransportConnectJob(const std::string& group_name, |
| 160 RequestPriority priority, | 158 RequestPriority priority, |
| 159 bool ignore_limits, |
| 161 const scoped_refptr<TransportSocketParams>& params, | 160 const scoped_refptr<TransportSocketParams>& params, |
| 162 base::TimeDelta timeout_duration, | 161 base::TimeDelta timeout_duration, |
| 163 ClientSocketFactory* client_socket_factory, | 162 ClientSocketFactory* client_socket_factory, |
| 164 HostResolver* host_resolver, | 163 HostResolver* host_resolver, |
| 165 Delegate* delegate, | 164 Delegate* delegate, |
| 166 NetLog* net_log); | 165 NetLog* net_log); |
| 167 ~TransportConnectJob() override; | 166 ~TransportConnectJob() override; |
| 168 | 167 |
| 169 // ConnectJob methods. | 168 // ConnectJob methods. |
| 170 LoadState GetLoadState() const override; | 169 LoadState GetLoadState() const override; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 HostResolver* host_resolver, | 233 HostResolver* host_resolver, |
| 235 ClientSocketFactory* client_socket_factory, | 234 ClientSocketFactory* client_socket_factory, |
| 236 NetLog* net_log); | 235 NetLog* net_log); |
| 237 | 236 |
| 238 ~TransportClientSocketPool() override; | 237 ~TransportClientSocketPool() override; |
| 239 | 238 |
| 240 // ClientSocketPool implementation. | 239 // ClientSocketPool implementation. |
| 241 int RequestSocket(const std::string& group_name, | 240 int RequestSocket(const std::string& group_name, |
| 242 const void* resolve_info, | 241 const void* resolve_info, |
| 243 RequestPriority priority, | 242 RequestPriority priority, |
| 243 bool ignore_limits, |
| 244 ClientSocketHandle* handle, | 244 ClientSocketHandle* handle, |
| 245 const CompletionCallback& callback, | 245 const CompletionCallback& callback, |
| 246 const BoundNetLog& net_log) override; | 246 const BoundNetLog& net_log) override; |
| 247 void RequestSockets(const std::string& group_name, | 247 void RequestSockets(const std::string& group_name, |
| 248 const void* params, | 248 const void* params, |
| 249 int num_sockets, | 249 int num_sockets, |
| 250 const BoundNetLog& net_log) override; | 250 const BoundNetLog& net_log) override; |
| 251 void CancelRequest(const std::string& group_name, | 251 void CancelRequest(const std::string& group_name, |
| 252 ClientSocketHandle* handle) override; | 252 ClientSocketHandle* handle) override; |
| 253 void ReleaseSocket(const std::string& group_name, | 253 void ReleaseSocket(const std::string& group_name, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 break; | 364 break; |
| 365 } | 365 } |
| 366 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 366 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
| 367 | 367 |
| 368 return rv; | 368 return rv; |
| 369 } | 369 } |
| 370 | 370 |
| 371 } // namespace net | 371 } // namespace net |
| 372 | 372 |
| 373 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 373 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |