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/base/socket_performance_watcher.h" | 17 #include "net/base/socket_performance_watcher.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 TCPClientSocket::TCPClientSocket( | 21 TCPClientSocket::TCPClientSocket( |
22 const AddressList& addresses, | 22 const AddressList& addresses, |
23 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 23 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
24 net::NetLog* net_log, | 24 net::NetLog* net_log, |
25 const net::NetLog::Source& source) | 25 const net::NetLog::Source& source) |
26 : socket_performance_watcher_(socket_performance_watcher.get()), | 26 : socket_performance_watcher_(socket_performance_watcher.get()), |
27 socket_(new TCPSocket(std::move(socket_performance_watcher), | 27 socket_(new TCPSocket(std::move(socket_performance_watcher), |
28 net_log, | 28 net_log, |
29 source)), | 29 source)), |
30 addresses_(addresses), | 30 addresses_(addresses), |
31 current_address_index_(-1), | 31 current_address_index_(-1), |
32 next_connect_state_(CONNECT_STATE_NONE), | 32 next_connect_state_(CONNECT_STATE_NONE), |
33 previously_disconnected_(false), | 33 previously_disconnected_(false), |
34 total_received_bytes_(0) {} | 34 total_received_bytes_(0) {} |
35 | 35 |
36 TCPClientSocket::TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, | 36 TCPClientSocket::TCPClientSocket(std::unique_ptr<TCPSocket> connected_socket, |
37 const IPEndPoint& peer_address) | 37 const IPEndPoint& peer_address) |
38 : socket_performance_watcher_(nullptr), | 38 : socket_performance_watcher_(nullptr), |
39 socket_(std::move(connected_socket)), | 39 socket_(std::move(connected_socket)), |
40 addresses_(AddressList(peer_address)), | 40 addresses_(AddressList(peer_address)), |
41 current_address_index_(0), | 41 current_address_index_(0), |
42 next_connect_state_(CONNECT_STATE_NONE), | 42 next_connect_state_(CONNECT_STATE_NONE), |
43 previously_disconnected_(false), | 43 previously_disconnected_(false), |
44 total_received_bytes_(0) { | 44 total_received_bytes_(0) { |
45 DCHECK(socket_); | 45 DCHECK(socket_); |
46 | 46 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 void TCPClientSocket::EmitTCPMetricsHistogramsOnDisconnect() { | 387 void TCPClientSocket::EmitTCPMetricsHistogramsOnDisconnect() { |
388 base::TimeDelta rtt; | 388 base::TimeDelta rtt; |
389 if (socket_->GetEstimatedRoundTripTime(&rtt)) { | 389 if (socket_->GetEstimatedRoundTripTime(&rtt)) { |
390 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TcpRtt.AtDisconnect", rtt, | 390 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TcpRtt.AtDisconnect", rtt, |
391 base::TimeDelta::FromMilliseconds(1), | 391 base::TimeDelta::FromMilliseconds(1), |
392 base::TimeDelta::FromMinutes(10), 100); | 392 base::TimeDelta::FromMinutes(10), 100); |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 } // namespace net | 396 } // namespace net |
OLD | NEW |