| 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 #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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 BlimpTransport { |
| 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 std::unique_ptr<MessagePort> TakeMessagePort(); |
| 38 const char* GetName() const override; | 39 const char* GetName() const override; |
| 39 | 40 |
| 40 int GetLocalAddress(net::IPEndPoint* address) const; | 41 int GetLocalAddress(net::IPEndPoint* address) const; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 void OnTCPConnectAccepted(int result); | 44 void OnTCPConnectAccepted(int result); |
| 44 | 45 |
| 45 const net::IPEndPoint address_; | 46 const net::IPEndPoint address_; |
| 46 net::NetLog* net_log_; | 47 net::NetLog* net_log_; |
| 47 std::unique_ptr<net::ServerSocket> server_socket_; | 48 std::unique_ptr<net::ServerSocket> server_socket_; |
| 48 std::unique_ptr<net::StreamSocket> accepted_socket_; | 49 std::unique_ptr<net::StreamSocket> accepted_socket_; |
| 49 net::CompletionCallback connect_callback_; | 50 net::CompletionCallback connect_callback_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(TCPEngineTransport); | 52 DISALLOW_COPY_AND_ASSIGN(TCPEngineTransport); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace blimp | 55 } // namespace blimp |
| 55 | 56 |
| 56 #endif // BLIMP_NET_TCP_ENGINE_TRANSPORT_H_ | 57 #endif // BLIMP_NET_TCP_ENGINE_TRANSPORT_H_ |
| OLD | NEW |