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

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

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 #ifndef BLIMP_NET_TCP_ENGINE_TRANSPORT_H_ 5 #ifndef BLIMP_NET_TCP_ENGINE_TRANSPORT_H_
6 #define BLIMP_NET_TCP_ENGINE_TRANSPORT_H_ 6 #define BLIMP_NET_TCP_ENGINE_TRANSPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "blimp/net/blimp_engine_transport.h"
12 #include "blimp/net/blimp_net_export.h" 13 #include "blimp/net/blimp_net_export.h"
13 #include "blimp/net/blimp_transport.h"
14 #include "net/base/ip_endpoint.h" 14 #include "net/base/ip_endpoint.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 16
17 namespace net { 17 namespace net {
18 class NetLog; 18 class NetLog;
19 class ServerSocket; 19 class ServerSocket;
20 class StreamSocket; 20 class StreamSocket;
21 } // namespace net 21 } // namespace net
22 22
23 namespace blimp { 23 namespace blimp {
24 24
25 class MessagePort; 25 class MessagePort;
26 26
27 // BlimpTransport which listens for a TCP connection at |address|. 27 // |BlimpTransport| which listens for a TCP connection at |address|.
28 class BLIMP_NET_EXPORT TCPEngineTransport : public BlimpTransport { 28 class BLIMP_NET_EXPORT TCPEngineTransport : public BlimpEngineTransport {
29 public: 29 public:
30 // Caller retains the ownership of |net_log|. 30 // Caller retains the ownership of |net_log|.
31 TCPEngineTransport(const net::IPEndPoint& address, 31 TCPEngineTransport(const net::IPEndPoint& address,
32 net::NetLog* net_log); 32 net::NetLog* net_log);
33 ~TCPEngineTransport() override; 33 ~TCPEngineTransport() override;
34 34
35 // BlimpTransport implementation. 35 // BlimpTransport implementation.
36 void Connect(const net::CompletionCallback& callback) override; 36 void Connect(const net::CompletionCallback& callback) override;
37 std::unique_ptr<MessagePort> TakeMessagePort() override; 37 std::unique_ptr<BlimpConnection> MakeConnection() override;
38 const char* GetName() const override; 38 const char* GetName() const override;
39 void GetLocalAddress(net::IPEndPoint* address) const override;
Wez 2016/11/09 22:57:27 If we're not allowing for failure then simply retu
39 40
40 int GetLocalAddress(net::IPEndPoint* address) const; 41 // Internal use only except tests.
Wez 2016/11/09 22:47:17 You can move this to be provide and provide a Take
42 std::unique_ptr<MessagePort> TakeMessagePort();
41 43
42 private: 44 private:
43 void OnTCPConnectAccepted(int result); 45 void OnTCPConnectAccepted(int result);
44 46
45 const net::IPEndPoint address_; 47 const net::IPEndPoint address_;
46 net::NetLog* net_log_; 48 net::NetLog* net_log_;
47 std::unique_ptr<net::ServerSocket> server_socket_; 49 std::unique_ptr<net::ServerSocket> server_socket_;
48 std::unique_ptr<net::StreamSocket> accepted_socket_; 50 std::unique_ptr<net::StreamSocket> accepted_socket_;
49 net::CompletionCallback connect_callback_; 51 net::CompletionCallback connect_callback_;
50 52
51 DISALLOW_COPY_AND_ASSIGN(TCPEngineTransport); 53 DISALLOW_COPY_AND_ASSIGN(TCPEngineTransport);
52 }; 54 };
53 55
54 } // namespace blimp 56 } // namespace blimp
55 57
56 #endif // BLIMP_NET_TCP_ENGINE_TRANSPORT_H_ 58 #endif // BLIMP_NET_TCP_ENGINE_TRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698