OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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.h" | 5 #include "net/socket/tcp_client_socket.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/socket/socket_performance_watcher.h" | 17 #include "net/socket/socket_performance_watcher.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
| 21 class NetLogWithSource; |
| 22 |
21 TCPClientSocket::TCPClientSocket( | 23 TCPClientSocket::TCPClientSocket( |
22 const AddressList& addresses, | 24 const AddressList& addresses, |
23 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 25 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
24 net::NetLog* net_log, | 26 net::NetLog* net_log, |
25 const net::NetLog::Source& source) | 27 const net::NetLogSource& source) |
26 : socket_performance_watcher_(socket_performance_watcher.get()), | 28 : socket_performance_watcher_(socket_performance_watcher.get()), |
27 socket_(new TCPSocket(std::move(socket_performance_watcher), | 29 socket_(new TCPSocket(std::move(socket_performance_watcher), |
28 net_log, | 30 net_log, |
29 source)), | 31 source)), |
30 addresses_(addresses), | 32 addresses_(addresses), |
31 current_address_index_(-1), | 33 current_address_index_(-1), |
32 next_connect_state_(CONNECT_STATE_NONE), | 34 next_connect_state_(CONNECT_STATE_NONE), |
33 previously_disconnected_(false), | 35 previously_disconnected_(false), |
34 total_received_bytes_(0) {} | 36 total_received_bytes_(0) {} |
35 | 37 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 void TCPClientSocket::EmitTCPMetricsHistogramsOnDisconnect() { | 389 void TCPClientSocket::EmitTCPMetricsHistogramsOnDisconnect() { |
388 base::TimeDelta rtt; | 390 base::TimeDelta rtt; |
389 if (socket_->GetEstimatedRoundTripTime(&rtt)) { | 391 if (socket_->GetEstimatedRoundTripTime(&rtt)) { |
390 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TcpRtt.AtDisconnect", rtt, | 392 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TcpRtt.AtDisconnect", rtt, |
391 base::TimeDelta::FromMilliseconds(1), | 393 base::TimeDelta::FromMilliseconds(1), |
392 base::TimeDelta::FromMinutes(10), 100); | 394 base::TimeDelta::FromMinutes(10), 100); |
393 } | 395 } |
394 } | 396 } |
395 | 397 |
396 } // namespace net | 398 } // namespace net |
OLD | NEW |