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

Side by Side Diff: blimp/net/tcp_client_transport.cc

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Added missing Engine Transport Created 4 years, 1 month 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
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "blimp/net/message_port.h" 14 #include "blimp/net/message_port.h"
15 #include "blimp/net/stream_socket_connection.h" 15 #include "blimp/net/tcp_connection.h"
16 #include "net/log/net_log_source.h" 16 #include "net/log/net_log_source.h"
17 #include "net/socket/client_socket_factory.h" 17 #include "net/socket/client_socket_factory.h"
18 #include "net/socket/stream_socket.h" 18 #include "net/socket/stream_socket.h"
19 #include "net/socket/tcp_client_socket.h" 19 #include "net/socket/tcp_client_socket.h"
20 20
21 namespace blimp { 21 namespace blimp {
22 22
23 TCPClientTransport::TCPClientTransport(const net::IPEndPoint& ip_endpoint, 23 TCPClientTransport::TCPClientTransport(const net::IPEndPoint& ip_endpoint,
24 net::NetLog* net_log) 24 net::NetLog* net_log)
25 : ip_endpoint_(ip_endpoint), 25 : ip_endpoint_(ip_endpoint),
(...skipping 25 matching lines...) Expand all
51 51
52 OnTCPConnectComplete(result); 52 OnTCPConnectComplete(result);
53 } 53 }
54 54
55 std::unique_ptr<MessagePort> TCPClientTransport::TakeMessagePort() { 55 std::unique_ptr<MessagePort> TCPClientTransport::TakeMessagePort() {
56 DCHECK(connect_callback_.is_null()); 56 DCHECK(connect_callback_.is_null());
57 DCHECK(socket_); 57 DCHECK(socket_);
58 return MessagePort::CreateForStreamSocketWithCompression(std::move(socket_)); 58 return MessagePort::CreateForStreamSocketWithCompression(std::move(socket_));
59 } 59 }
60 60
61 std::unique_ptr<BlimpConnection> TCPClientTransport::MakeConnection() {
Wez 2016/11/09 22:47:17 nit: Please reflect the header ordering in the .cc
62 return base::MakeUnique<TCPConnection>(TakeMessagePort());
63 }
64
61 const char* TCPClientTransport::GetName() const { 65 const char* TCPClientTransport::GetName() const {
62 return "TCP"; 66 return "TCP";
63 } 67 }
64 68
65 void TCPClientTransport::OnTCPConnectComplete(int result) { 69 void TCPClientTransport::OnTCPConnectComplete(int result) {
66 DCHECK_NE(net::ERR_IO_PENDING, result); 70 DCHECK_NE(net::ERR_IO_PENDING, result);
67 OnConnectComplete(result); 71 OnConnectComplete(result);
68 } 72 }
69 73
70 void TCPClientTransport::OnConnectComplete(int result) { 74 void TCPClientTransport::OnConnectComplete(int result) {
(...skipping 10 matching lines...) Expand all
81 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) { 85 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) {
82 DCHECK(socket); 86 DCHECK(socket);
83 socket_ = std::move(socket); 87 socket_ = std::move(socket);
84 } 88 }
85 89
86 net::ClientSocketFactory* TCPClientTransport::socket_factory() const { 90 net::ClientSocketFactory* TCPClientTransport::socket_factory() const {
87 return socket_factory_; 91 return socket_factory_;
88 } 92 }
89 93
90 } // namespace blimp 94 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698