| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "net/base/ip_endpoint.h" | 20 #include "net/base/ip_endpoint.h" |
| 21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 #include "net/base/trace_constants.h" |
| 22 #include "net/log/net_log.h" | 23 #include "net/log/net_log.h" |
| 23 #include "net/log/net_log_event_type.h" | 24 #include "net/log/net_log_event_type.h" |
| 24 #include "net/log/net_log_source_type.h" | 25 #include "net/log/net_log_source_type.h" |
| 25 #include "net/log/net_log_with_source.h" | 26 #include "net/log/net_log_with_source.h" |
| 26 #include "net/socket/client_socket_factory.h" | 27 #include "net/socket/client_socket_factory.h" |
| 27 #include "net/socket/client_socket_handle.h" | 28 #include "net/socket/client_socket_handle.h" |
| 28 #include "net/socket/client_socket_pool_base.h" | 29 #include "net/socket/client_socket_pool_base.h" |
| 29 #include "net/socket/socket_net_log_params.h" | 30 #include "net/socket/socket_net_log_params.h" |
| 30 #include "net/socket/socket_performance_watcher.h" | 31 #include "net/socket/socket_performance_watcher.h" |
| 31 #include "net/socket/socket_performance_watcher_factory.h" | 32 #include "net/socket/socket_performance_watcher_factory.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 next_state_ = STATE_RESOLVE_HOST_COMPLETE; | 262 next_state_ = STATE_RESOLVE_HOST_COMPLETE; |
| 262 connect_timing_.dns_start = base::TimeTicks::Now(); | 263 connect_timing_.dns_start = base::TimeTicks::Now(); |
| 263 | 264 |
| 264 return resolver_->Resolve( | 265 return resolver_->Resolve( |
| 265 params_->destination(), priority(), &addresses_, | 266 params_->destination(), priority(), &addresses_, |
| 266 base::Bind(&TransportConnectJob::OnIOComplete, base::Unretained(this)), | 267 base::Bind(&TransportConnectJob::OnIOComplete, base::Unretained(this)), |
| 267 &request_, net_log()); | 268 &request_, net_log()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 int TransportConnectJob::DoResolveHostComplete(int result) { | 271 int TransportConnectJob::DoResolveHostComplete(int result) { |
| 271 TRACE_EVENT0("net", "TransportConnectJob::DoResolveHostComplete"); | 272 TRACE_EVENT0(kNetTracingCategory, |
| 273 "TransportConnectJob::DoResolveHostComplete"); |
| 272 connect_timing_.dns_end = base::TimeTicks::Now(); | 274 connect_timing_.dns_end = base::TimeTicks::Now(); |
| 273 // Overwrite connection start time, since for connections that do not go | 275 // Overwrite connection start time, since for connections that do not go |
| 274 // through proxies, |connect_start| should not include dns lookup time. | 276 // through proxies, |connect_start| should not include dns lookup time. |
| 275 connect_timing_.connect_start = connect_timing_.dns_end; | 277 connect_timing_.connect_start = connect_timing_.dns_end; |
| 276 resolve_result_ = result; | 278 resolve_result_ = result; |
| 277 | 279 |
| 278 if (result != OK) | 280 if (result != OK) |
| 279 return result; | 281 return result; |
| 280 | 282 |
| 281 // Invoke callback, and abort if it fails. | 283 // Invoke callback, and abort if it fails. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 HigherLayeredPool* higher_pool) { | 597 HigherLayeredPool* higher_pool) { |
| 596 base_.AddHigherLayeredPool(higher_pool); | 598 base_.AddHigherLayeredPool(higher_pool); |
| 597 } | 599 } |
| 598 | 600 |
| 599 void TransportClientSocketPool::RemoveHigherLayeredPool( | 601 void TransportClientSocketPool::RemoveHigherLayeredPool( |
| 600 HigherLayeredPool* higher_pool) { | 602 HigherLayeredPool* higher_pool) { |
| 601 base_.RemoveHigherLayeredPool(higher_pool); | 603 base_.RemoveHigherLayeredPool(higher_pool); |
| 602 } | 604 } |
| 603 | 605 |
| 604 } // namespace net | 606 } // namespace net |
| OLD | NEW |