| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_NET_MESSAGE_PORT_H_ | |
| 6 #define BLIMP_NET_MESSAGE_PORT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/supports_user_data.h" | |
| 12 #include "blimp/net/blimp_net_export.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class StreamSocket; | |
| 16 } | |
| 17 | |
| 18 namespace blimp { | |
| 19 | |
| 20 class PacketReader; | |
| 21 class PacketWriter; | |
| 22 | |
| 23 // A duplexed pair of a framed reader and writer. | |
| 24 class BLIMP_NET_EXPORT MessagePort { | |
| 25 public: | |
| 26 MessagePort(std::unique_ptr<PacketReader> reader, | |
| 27 std::unique_ptr<PacketWriter> writer); | |
| 28 virtual ~MessagePort(); | |
| 29 | |
| 30 static std::unique_ptr<MessagePort> CreateForStreamSocketWithCompression( | |
| 31 std::unique_ptr<net::StreamSocket> socket); | |
| 32 | |
| 33 PacketReader* reader() const { return reader_.get(); } | |
| 34 PacketWriter* writer() const { return writer_.get(); } | |
| 35 | |
| 36 private: | |
| 37 std::unique_ptr<PacketReader> reader_; | |
| 38 std::unique_ptr<PacketWriter> writer_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(MessagePort); | |
| 41 }; | |
| 42 | |
| 43 } // namespace blimp | |
| 44 | |
| 45 #endif // BLIMP_NET_MESSAGE_PORT_H_ | |
| OLD | NEW |