| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/tcp_client_transport.h" | 5 #include "blimp/net/tcp_client_transport.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 DCHECK(factory); | 30 DCHECK(factory); |
| 31 socket_factory_ = factory; | 31 socket_factory_ = factory; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void TCPClientTransport::Connect(const net::CompletionCallback& callback) { | 34 void TCPClientTransport::Connect(const net::CompletionCallback& callback) { |
| 35 DCHECK(!socket_); | 35 DCHECK(!socket_); |
| 36 DCHECK(!callback.is_null()); | 36 DCHECK(!callback.is_null()); |
| 37 | 37 |
| 38 connect_callback_ = callback; | 38 connect_callback_ = callback; |
| 39 socket_ = socket_factory_->CreateTransportClientSocket( | 39 socket_ = socket_factory_->CreateTransportClientSocket( |
| 40 net::AddressList(ip_endpoint_), net_log_, net::NetLog::Source()); | 40 net::AddressList(ip_endpoint_), nullptr, net_log_, net::NetLog::Source()); |
| 41 net::CompletionCallback completion_callback = base::Bind( | 41 net::CompletionCallback completion_callback = base::Bind( |
| 42 &TCPClientTransport::OnTCPConnectComplete, base::Unretained(this)); | 42 &TCPClientTransport::OnTCPConnectComplete, base::Unretained(this)); |
| 43 | 43 |
| 44 int result = socket_->Connect(completion_callback); | 44 int result = socket_->Connect(completion_callback); |
| 45 if (result == net::ERR_IO_PENDING) { | 45 if (result == net::ERR_IO_PENDING) { |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 OnTCPConnectComplete(result); | 49 OnTCPConnectComplete(result); |
| 50 } | 50 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) { | 78 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) { |
| 79 DCHECK(socket); | 79 DCHECK(socket); |
| 80 socket_ = std::move(socket); | 80 socket_ = std::move(socket); |
| 81 } | 81 } |
| 82 | 82 |
| 83 net::ClientSocketFactory* TCPClientTransport::socket_factory() const { | 83 net::ClientSocketFactory* TCPClientTransport::socket_factory() const { |
| 84 return socket_factory_; | 84 return socket_factory_; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace blimp | 87 } // namespace blimp |
| OLD | NEW |