| Index: net/socket/tcp_client_socket.cc
|
| diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc
|
| index 56238ba0d12cb5412df6fc317770ea9aa561fe24..1ae979ea3f90c1865276be3339f166ff8f925d77 100644
|
| --- a/net/socket/tcp_client_socket.cc
|
| +++ b/net/socket/tcp_client_socket.cc
|
| @@ -14,13 +14,19 @@
|
| #include "net/base/io_buffer.h"
|
| #include "net/base/ip_endpoint.h"
|
| #include "net/base/net_errors.h"
|
| +#include "net/base/socket_performance_watcher.h"
|
|
|
| namespace net {
|
|
|
| -TCPClientSocket::TCPClientSocket(const AddressList& addresses,
|
| - net::NetLog* net_log,
|
| - const net::NetLog::Source& source)
|
| - : socket_(new TCPSocket(net_log, source)),
|
| +TCPClientSocket::TCPClientSocket(
|
| + const AddressList& addresses,
|
| + scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher,
|
| + net::NetLog* net_log,
|
| + const net::NetLog::Source& source)
|
| + : socket_performance_watcher_(socket_performance_watcher.get()),
|
| + socket_(new TCPSocket(std::move(socket_performance_watcher),
|
| + net_log,
|
| + source)),
|
| addresses_(addresses),
|
| current_address_index_(-1),
|
| next_connect_state_(CONNECT_STATE_NONE),
|
| @@ -29,7 +35,8 @@ TCPClientSocket::TCPClientSocket(const AddressList& addresses,
|
|
|
| TCPClientSocket::TCPClientSocket(scoped_ptr<TCPSocket> connected_socket,
|
| const IPEndPoint& peer_address)
|
| - : socket_(std::move(connected_socket)),
|
| + : socket_performance_watcher_(nullptr),
|
| + socket_(std::move(connected_socket)),
|
| addresses_(AddressList(peer_address)),
|
| current_address_index_(0),
|
| next_connect_state_(CONNECT_STATE_NONE),
|
| @@ -152,6 +159,11 @@ int TCPClientSocket::DoConnect() {
|
| }
|
| }
|
|
|
| + // Notify |socket_performance_watcher_| only if the |socket_| is reused to
|
| + // connect to a different IP Address.
|
| + if (socket_performance_watcher_ && current_address_index_ != 0)
|
| + socket_performance_watcher_->OnConnectionChanged();
|
| +
|
| // |socket_| is owned by this class and the callback won't be run once
|
| // |socket_| is gone. Therefore, it is safe to use base::Unretained() here.
|
| return socket_->Connect(endpoint,
|
|
|