| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tcp_client_socket_pool.h" | 5 #include "net/socket/tcp_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 int TCPConnectJob::DoResolveHostComplete(int result) { | 119 int TCPConnectJob::DoResolveHostComplete(int result) { |
| 120 if (result == OK) | 120 if (result == OK) |
| 121 next_state_ = kStateTCPConnect; | 121 next_state_ = kStateTCPConnect; |
| 122 return result; | 122 return result; |
| 123 } | 123 } |
| 124 | 124 |
| 125 int TCPConnectJob::DoTCPConnect() { | 125 int TCPConnectJob::DoTCPConnect() { |
| 126 next_state_ = kStateTCPConnectComplete; | 126 next_state_ = kStateTCPConnectComplete; |
| 127 set_socket(client_socket_factory_->CreateTCPClientSocket(addresses_)); | 127 set_socket(client_socket_factory_->CreateTCPClientSocket( |
| 128 addresses_, net_log().net_log())); |
| 128 connect_start_time_ = base::TimeTicks::Now(); | 129 connect_start_time_ = base::TimeTicks::Now(); |
| 129 return socket()->Connect(&callback_, net_log()); | 130 return socket()->Connect(&callback_); |
| 130 } | 131 } |
| 131 | 132 |
| 132 int TCPConnectJob::DoTCPConnectComplete(int result) { | 133 int TCPConnectJob::DoTCPConnectComplete(int result) { |
| 133 if (result == OK) { | 134 if (result == OK) { |
| 134 DCHECK(connect_start_time_ != base::TimeTicks()); | 135 DCHECK(connect_start_time_ != base::TimeTicks()); |
| 135 DCHECK(start_time_ != base::TimeTicks()); | 136 DCHECK(start_time_ != base::TimeTicks()); |
| 136 base::TimeTicks now = base::TimeTicks::Now(); | 137 base::TimeTicks now = base::TimeTicks::Now(); |
| 137 base::TimeDelta total_duration = now - start_time_; | 138 base::TimeDelta total_duration = now - start_time_; |
| 138 UMA_HISTOGRAM_CUSTOM_TIMES( | 139 UMA_HISTOGRAM_CUSTOM_TIMES( |
| 139 "Net.DNS_Resolution_And_TCP_Connection_Latency2", | 140 "Net.DNS_Resolution_And_TCP_Connection_Latency2", |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 const std::string& group_name) const { | 229 const std::string& group_name) const { |
| 229 return base_.IdleSocketCountInGroup(group_name); | 230 return base_.IdleSocketCountInGroup(group_name); |
| 230 } | 231 } |
| 231 | 232 |
| 232 LoadState TCPClientSocketPool::GetLoadState( | 233 LoadState TCPClientSocketPool::GetLoadState( |
| 233 const std::string& group_name, const ClientSocketHandle* handle) const { | 234 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 234 return base_.GetLoadState(group_name, handle); | 235 return base_.GetLoadState(group_name, handle); |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace net | 238 } // namespace net |
| OLD | NEW |