Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: net/socket/tcp_client_socket.cc

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/tcp_client_socket.h ('k') | net/socket/tcp_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « net/socket/tcp_client_socket.h ('k') | net/socket/tcp_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698