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

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

Issue 2236093002: Decouple Blimp transport output from BlimpConnections using MessagePort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@statistics-singleton
Patch Set: Created 4 years, 4 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
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 #ifndef BLIMP_NET_TCP_CLIENT_TRANSPORT_H_ 5 #ifndef BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
6 #define BLIMP_NET_TCP_CLIENT_TRANSPORT_H_ 6 #define BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "blimp/net/blimp_net_export.h" 13 #include "blimp/net/blimp_net_export.h"
14 #include "blimp/net/blimp_transport.h" 14 #include "blimp/net/blimp_transport.h"
15 #include "net/base/address_list.h" 15 #include "net/base/address_list.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 17
18 namespace net { 18 namespace net {
19 class ClientSocketFactory; 19 class ClientSocketFactory;
20 class NetLog; 20 class NetLog;
21 class StreamSocket; 21 class StreamSocket;
22 } // namespace net 22 } // namespace net
23 23
24 namespace blimp { 24 namespace blimp {
25 25
26 class BlimpConnection; 26 class MessagePort;
27 27
28 // BlimpTransport which creates a TCP connection to one of the specified 28 // BlimpTransport which creates a TCP connection to one of the specified
29 // |addresses| on each call to Connect(). 29 // |addresses| on each call to Connect().
30 class BLIMP_NET_EXPORT TCPClientTransport : public BlimpTransport { 30 class BLIMP_NET_EXPORT TCPClientTransport : public BlimpTransport {
31 public: 31 public:
32 TCPClientTransport(const net::IPEndPoint& ip_endpoint, 32 TCPClientTransport(const net::IPEndPoint& ip_endpoint,
33 net::NetLog* net_log); 33 net::NetLog* net_log);
34 ~TCPClientTransport() override; 34 ~TCPClientTransport() override;
35 35
36 void SetClientSocketFactoryForTest(net::ClientSocketFactory* factory); 36 void SetClientSocketFactoryForTest(net::ClientSocketFactory* factory);
37 37
38 // BlimpTransport implementation. 38 // BlimpTransport implementation.
39 void Connect(const net::CompletionCallback& callback) override; 39 void Connect(const net::CompletionCallback& callback) override;
40 std::unique_ptr<BlimpConnection> TakeConnection() override; 40 std::unique_ptr<MessagePort> TakeMessagePort() override;
41 const char* GetName() const override; 41 const char* GetName() const override;
42 42
43 protected: 43 protected:
44 // Called when the TCP connection completed. 44 // Called when the TCP connection completed.
45 virtual void OnTCPConnectComplete(int result); 45 virtual void OnTCPConnectComplete(int result);
46 46
47 // Called when the connection attempt completed or failed. 47 // Called when the connection attempt completed or failed.
48 // Resets |socket_| if |result| indicates a failure (!= net::OK). 48 // Resets |socket_| if |result| indicates a failure (!= net::OK).
49 void OnConnectComplete(int result); 49 void OnConnectComplete(int result);
50 50
(...skipping 11 matching lines...) Expand all
62 net::CompletionCallback connect_callback_; 62 net::CompletionCallback connect_callback_;
63 net::ClientSocketFactory* socket_factory_ = nullptr; 63 net::ClientSocketFactory* socket_factory_ = nullptr;
64 std::unique_ptr<net::StreamSocket> socket_; 64 std::unique_ptr<net::StreamSocket> socket_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(TCPClientTransport); 66 DISALLOW_COPY_AND_ASSIGN(TCPClientTransport);
67 }; 67 };
68 68
69 } // namespace blimp 69 } // namespace blimp
70 70
71 #endif // BLIMP_NET_TCP_CLIENT_TRANSPORT_H_ 71 #endif // BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698