| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/time.h" | 10 #include "base/time.h" |
| 11 #include "net/base/load_log.h" |
| 11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 12 #include "net/socket/client_socket_factory.h" | 13 #include "net/socket/client_socket_factory.h" |
| 13 #include "net/socket/client_socket_handle.h" | 14 #include "net/socket/client_socket_handle.h" |
| 14 #include "net/socket/client_socket_pool_base.h" | 15 #include "net/socket/client_socket_pool_base.h" |
| 15 #include "net/socket/tcp_client_socket.h" | 16 #include "net/socket/tcp_client_socket.h" |
| 16 | 17 |
| 17 using base::TimeDelta; | 18 using base::TimeDelta; |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 int TCPConnectJob::DoResolveHostComplete(int result) { | 117 int TCPConnectJob::DoResolveHostComplete(int result) { |
| 117 if (result == OK) | 118 if (result == OK) |
| 118 next_state_ = kStateTCPConnect; | 119 next_state_ = kStateTCPConnect; |
| 119 return result; | 120 return result; |
| 120 } | 121 } |
| 121 | 122 |
| 122 int TCPConnectJob::DoTCPConnect() { | 123 int TCPConnectJob::DoTCPConnect() { |
| 123 next_state_ = kStateTCPConnectComplete; | 124 next_state_ = kStateTCPConnectComplete; |
| 124 set_socket(client_socket_factory_->CreateTCPClientSocket(addresses_)); | 125 set_socket(client_socket_factory_->CreateTCPClientSocket(addresses_)); |
| 125 connect_start_time_ = base::TimeTicks::Now(); | 126 connect_start_time_ = base::TimeTicks::Now(); |
| 126 // TODO(eroman): Socket::Connect() should take a LoadLog. | 127 return socket()->Connect(&callback_, load_log()); |
| 127 return socket()->Connect(&callback_); | |
| 128 } | 128 } |
| 129 | 129 |
| 130 int TCPConnectJob::DoTCPConnectComplete(int result) { | 130 int TCPConnectJob::DoTCPConnectComplete(int result) { |
| 131 if (result == OK) { | 131 if (result == OK) { |
| 132 DCHECK(connect_start_time_ != base::TimeTicks()); | 132 DCHECK(connect_start_time_ != base::TimeTicks()); |
| 133 base::TimeDelta connect_duration = | 133 base::TimeDelta connect_duration = |
| 134 base::TimeTicks::Now() - connect_start_time_; | 134 base::TimeTicks::Now() - connect_start_time_; |
| 135 | 135 |
| 136 UMA_HISTOGRAM_CLIPPED_TIMES("Net.TCP_Connection_Latency", | 136 UMA_HISTOGRAM_CLIPPED_TIMES("Net.TCP_Connection_Latency", |
| 137 connect_duration, | 137 connect_duration, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const std::string& group_name) const { | 202 const std::string& group_name) const { |
| 203 return base_.IdleSocketCountInGroup(group_name); | 203 return base_.IdleSocketCountInGroup(group_name); |
| 204 } | 204 } |
| 205 | 205 |
| 206 LoadState TCPClientSocketPool::GetLoadState( | 206 LoadState TCPClientSocketPool::GetLoadState( |
| 207 const std::string& group_name, const ClientSocketHandle* handle) const { | 207 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 208 return base_.GetLoadState(group_name, handle); | 208 return base_.GetLoadState(group_name, handle); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace net | 211 } // namespace net |
| OLD | NEW |