| 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 #include "net/socket/transport_client_socket_pool.h" | 5 #include "net/socket/transport_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 params_(params), | 110 params_(params), |
| 111 resolver_(host_resolver), | 111 resolver_(host_resolver), |
| 112 client_socket_factory_(client_socket_factory), | 112 client_socket_factory_(client_socket_factory), |
| 113 next_state_(STATE_NONE), | 113 next_state_(STATE_NONE), |
| 114 socket_performance_watcher_factory_(socket_performance_watcher_factory), | 114 socket_performance_watcher_factory_(socket_performance_watcher_factory), |
| 115 interval_between_connects_(CONNECT_INTERVAL_GT_20MS), | 115 interval_between_connects_(CONNECT_INTERVAL_GT_20MS), |
| 116 resolve_result_(OK) {} | 116 resolve_result_(OK) {} |
| 117 | 117 |
| 118 TransportConnectJob::~TransportConnectJob() { | 118 TransportConnectJob::~TransportConnectJob() { |
| 119 // We don't worry about cancelling the host resolution and TCP connect, since | 119 // We don't worry about cancelling the host resolution and TCP connect, since |
| 120 // ~SingleRequestHostResolver and ~StreamSocket will take care of it. | 120 // ~HostResolver::Request and ~StreamSocket will take care of it. |
| 121 } | 121 } |
| 122 | 122 |
| 123 LoadState TransportConnectJob::GetLoadState() const { | 123 LoadState TransportConnectJob::GetLoadState() const { |
| 124 switch (next_state_) { | 124 switch (next_state_) { |
| 125 case STATE_RESOLVE_HOST: | 125 case STATE_RESOLVE_HOST: |
| 126 case STATE_RESOLVE_HOST_COMPLETE: | 126 case STATE_RESOLVE_HOST_COMPLETE: |
| 127 return LOAD_STATE_RESOLVING_HOST; | 127 return LOAD_STATE_RESOLVING_HOST; |
| 128 case STATE_TRANSPORT_CONNECT: | 128 case STATE_TRANSPORT_CONNECT: |
| 129 case STATE_TRANSPORT_CONNECT_COMPLETE: | 129 case STATE_TRANSPORT_CONNECT_COMPLETE: |
| 130 return LOAD_STATE_CONNECTING; | 130 return LOAD_STATE_CONNECTING; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 int TransportConnectJob::DoResolveHost() { | 262 int TransportConnectJob::DoResolveHost() { |
| 263 // TODO(ricea): Remove ScopedTracker below once crbug.com/436634 is fixed. | 263 // TODO(ricea): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 264 tracked_objects::ScopedTracker tracking_profile( | 264 tracked_objects::ScopedTracker tracking_profile( |
| 265 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 265 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 266 "436634 TransportConnectJob::DoResolveHost")); | 266 "436634 TransportConnectJob::DoResolveHost")); |
| 267 | 267 |
| 268 next_state_ = STATE_RESOLVE_HOST_COMPLETE; | 268 next_state_ = STATE_RESOLVE_HOST_COMPLETE; |
| 269 connect_timing_.dns_start = base::TimeTicks::Now(); | 269 connect_timing_.dns_start = base::TimeTicks::Now(); |
| 270 | 270 |
| 271 return resolver_.Resolve( | 271 return resolver_->Resolve( |
| 272 params_->destination(), priority(), &addresses_, | 272 params_->destination(), priority(), &addresses_, |
| 273 base::Bind(&TransportConnectJob::OnIOComplete, base::Unretained(this)), | 273 base::Bind(&TransportConnectJob::OnIOComplete, base::Unretained(this)), |
| 274 net_log()); | 274 &request_, net_log()); |
| 275 } | 275 } |
| 276 | 276 |
| 277 int TransportConnectJob::DoResolveHostComplete(int result) { | 277 int TransportConnectJob::DoResolveHostComplete(int result) { |
| 278 TRACE_EVENT0("net", "TransportConnectJob::DoResolveHostComplete"); | 278 TRACE_EVENT0("net", "TransportConnectJob::DoResolveHostComplete"); |
| 279 connect_timing_.dns_end = base::TimeTicks::Now(); | 279 connect_timing_.dns_end = base::TimeTicks::Now(); |
| 280 // Overwrite connection start time, since for connections that do not go | 280 // Overwrite connection start time, since for connections that do not go |
| 281 // through proxies, |connect_start| should not include dns lookup time. | 281 // through proxies, |connect_start| should not include dns lookup time. |
| 282 connect_timing_.connect_start = connect_timing_.dns_end; | 282 connect_timing_.connect_start = connect_timing_.dns_end; |
| 283 resolve_result_ = result; | 283 resolve_result_ = result; |
| 284 | 284 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 HigherLayeredPool* higher_pool) { | 651 HigherLayeredPool* higher_pool) { |
| 652 base_.AddHigherLayeredPool(higher_pool); | 652 base_.AddHigherLayeredPool(higher_pool); |
| 653 } | 653 } |
| 654 | 654 |
| 655 void TransportClientSocketPool::RemoveHigherLayeredPool( | 655 void TransportClientSocketPool::RemoveHigherLayeredPool( |
| 656 HigherLayeredPool* higher_pool) { | 656 HigherLayeredPool* higher_pool) { |
| 657 base_.RemoveHigherLayeredPool(higher_pool); | 657 base_.RemoveHigherLayeredPool(higher_pool); |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace net | 660 } // namespace net |
| OLD | NEW |