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

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

Issue 2008283004: Revert of Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « blimp/net/tcp_client_transport.h ('k') | blimp/net/tcp_engine_transport.h » ('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 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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "blimp/net/blimp_connection_statistics.h"
14 #include "blimp/net/stream_socket_connection.h" 13 #include "blimp/net/stream_socket_connection.h"
15 #include "net/socket/client_socket_factory.h" 14 #include "net/socket/client_socket_factory.h"
16 #include "net/socket/stream_socket.h" 15 #include "net/socket/stream_socket.h"
17 #include "net/socket/tcp_client_socket.h" 16 #include "net/socket/tcp_client_socket.h"
18 17
19 namespace blimp { 18 namespace blimp {
20 19
21 TCPClientTransport::TCPClientTransport(const net::IPEndPoint& ip_endpoint, 20 TCPClientTransport::TCPClientTransport(const net::IPEndPoint& ip_endpoint,
22 BlimpConnectionStatistics* statistics,
23 net::NetLog* net_log) 21 net::NetLog* net_log)
24 : ip_endpoint_(ip_endpoint), 22 : ip_endpoint_(ip_endpoint),
25 blimp_connection_statistics_(statistics),
26 net_log_(net_log), 23 net_log_(net_log),
27 socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) { 24 socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) {}
28 DCHECK(blimp_connection_statistics_);
29 }
30 25
31 TCPClientTransport::~TCPClientTransport() {} 26 TCPClientTransport::~TCPClientTransport() {}
32 27
33 void TCPClientTransport::SetClientSocketFactoryForTest( 28 void TCPClientTransport::SetClientSocketFactoryForTest(
34 net::ClientSocketFactory* factory) { 29 net::ClientSocketFactory* factory) {
35 DCHECK(factory); 30 DCHECK(factory);
36 socket_factory_ = factory; 31 socket_factory_ = factory;
37 } 32 }
38 33
39 void TCPClientTransport::Connect(const net::CompletionCallback& callback) { 34 void TCPClientTransport::Connect(const net::CompletionCallback& callback) {
(...skipping 10 matching lines...) Expand all
50 if (result == net::ERR_IO_PENDING) { 45 if (result == net::ERR_IO_PENDING) {
51 return; 46 return;
52 } 47 }
53 48
54 OnTCPConnectComplete(result); 49 OnTCPConnectComplete(result);
55 } 50 }
56 51
57 std::unique_ptr<BlimpConnection> TCPClientTransport::TakeConnection() { 52 std::unique_ptr<BlimpConnection> TCPClientTransport::TakeConnection() {
58 DCHECK(connect_callback_.is_null()); 53 DCHECK(connect_callback_.is_null());
59 DCHECK(socket_); 54 DCHECK(socket_);
60 return base::WrapUnique(new StreamSocketConnection( 55 return base::WrapUnique(new StreamSocketConnection(std::move(socket_)));
61 std::move(socket_), blimp_connection_statistics_));
62 } 56 }
63 57
64 const char* TCPClientTransport::GetName() const { 58 const char* TCPClientTransport::GetName() const {
65 return "TCP"; 59 return "TCP";
66 } 60 }
67 61
68 void TCPClientTransport::OnTCPConnectComplete(int result) { 62 void TCPClientTransport::OnTCPConnectComplete(int result) {
69 DCHECK_NE(net::ERR_IO_PENDING, result); 63 DCHECK_NE(net::ERR_IO_PENDING, result);
70 OnConnectComplete(result); 64 OnConnectComplete(result);
71 } 65 }
(...skipping 12 matching lines...) Expand all
84 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) { 78 void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) {
85 DCHECK(socket); 79 DCHECK(socket);
86 socket_ = std::move(socket); 80 socket_ = std::move(socket);
87 } 81 }
88 82
89 net::ClientSocketFactory* TCPClientTransport::socket_factory() const { 83 net::ClientSocketFactory* TCPClientTransport::socket_factory() const {
90 return socket_factory_; 84 return socket_factory_;
91 } 85 }
92 86
93 } // namespace blimp 87 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/tcp_client_transport.h ('k') | blimp/net/tcp_engine_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698