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/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/trace_event/trace_event.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "net/base/ip_endpoint.h" | 21 #include "net/base/ip_endpoint.h" |
21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
22 #include "net/log/net_log.h" | 23 #include "net/log/net_log.h" |
23 #include "net/socket/client_socket_factory.h" | 24 #include "net/socket/client_socket_factory.h" |
24 #include "net/socket/client_socket_handle.h" | 25 #include "net/socket/client_socket_handle.h" |
25 #include "net/socket/client_socket_pool_base.h" | 26 #include "net/socket/client_socket_pool_base.h" |
26 #include "net/socket/socket_net_log_params.h" | 27 #include "net/socket/socket_net_log_params.h" |
27 #include "net/socket/tcp_client_socket.h" | 28 #include "net/socket/tcp_client_socket.h" |
28 | 29 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 next_state_ = STATE_RESOLVE_HOST_COMPLETE; | 109 next_state_ = STATE_RESOLVE_HOST_COMPLETE; |
109 connect_timing_->dns_start = base::TimeTicks::Now(); | 110 connect_timing_->dns_start = base::TimeTicks::Now(); |
110 | 111 |
111 return resolver_.Resolve( | 112 return resolver_.Resolve( |
112 params_->destination(), priority, &addresses_, on_io_complete_, net_log); | 113 params_->destination(), priority, &addresses_, on_io_complete_, net_log); |
113 } | 114 } |
114 | 115 |
115 int TransportConnectJobHelper::DoResolveHostComplete( | 116 int TransportConnectJobHelper::DoResolveHostComplete( |
116 int result, | 117 int result, |
117 const BoundNetLog& net_log) { | 118 const BoundNetLog& net_log) { |
| 119 TRACE_EVENT0("net", "TransportConnectJobHelper::DoResolveHostComplete"); |
118 connect_timing_->dns_end = base::TimeTicks::Now(); | 120 connect_timing_->dns_end = base::TimeTicks::Now(); |
119 // Overwrite connection start time, since for connections that do not go | 121 // Overwrite connection start time, since for connections that do not go |
120 // through proxies, |connect_start| should not include dns lookup time. | 122 // through proxies, |connect_start| should not include dns lookup time. |
121 connect_timing_->connect_start = connect_timing_->dns_end; | 123 connect_timing_->connect_start = connect_timing_->dns_end; |
122 | 124 |
123 if (result == OK) { | 125 if (result == OK) { |
124 // Invoke callback, and abort if it fails. | 126 // Invoke callback, and abort if it fails. |
125 if (!params_->host_resolution_callback().is_null()) | 127 if (!params_->host_resolution_callback().is_null()) |
126 result = params_->host_resolution_callback().Run(addresses_, net_log); | 128 result = params_->host_resolution_callback().Run(addresses_, net_log); |
127 | 129 |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 HigherLayeredPool* higher_pool) { | 621 HigherLayeredPool* higher_pool) { |
620 base_.AddHigherLayeredPool(higher_pool); | 622 base_.AddHigherLayeredPool(higher_pool); |
621 } | 623 } |
622 | 624 |
623 void TransportClientSocketPool::RemoveHigherLayeredPool( | 625 void TransportClientSocketPool::RemoveHigherLayeredPool( |
624 HigherLayeredPool* higher_pool) { | 626 HigherLayeredPool* higher_pool) { |
625 base_.RemoveHigherLayeredPool(higher_pool); | 627 base_.RemoveHigherLayeredPool(higher_pool); |
626 } | 628 } |
627 | 629 |
628 } // namespace net | 630 } // namespace net |
OLD | NEW |