OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_ | |
6 #define REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "remoting/protocol/message_pipe.h" | |
11 | |
12 namespace google { | |
13 namespace protobuf { | |
14 class MessageLite; | |
15 } // namespace protobuf | |
16 } // namespace google | |
17 | |
18 namespace remoting { | |
19 namespace protocol { | |
20 | |
21 class FakeMessagePipeWrapper; | |
22 | |
23 class FakeMessagePipe final : public MessagePipe { | |
24 public: | |
25 // Sets |asynchronous| to true to make all operations asynchronizedly. | |
joedow
2017/05/30 16:24:18
I don't think this comment is needed. The param n
Hzj_jie
2017/05/31 00:11:53
Done.
| |
26 explicit FakeMessagePipe(bool asynchronous); | |
27 ~FakeMessagePipe() override; | |
28 | |
29 // Creates an std::unique_ptr<FakeMessagePipeWrapper> instance to wrap |this|. | |
30 // All operations will be forwarded to |this|. | |
31 std::unique_ptr<FakeMessagePipeWrapper> Wrap(); | |
joedow
2017/05/30 16:24:18
Why is this needed? Someone who has access to thi
Hzj_jie
2017/05/31 00:11:53
It returns an FakeMessagePipeWrapper which forward
| |
32 | |
33 // MessagePipe implementation. | |
34 void Start(EventHandler* event_handler) override; | |
35 void Send(google::protobuf::MessageLite* message, | |
36 const base::Closure& done) override; | |
37 | |
38 // Triggers EventHandler::OnMessageReceived(). | |
joedow
2017/05/30 16:24:18
I would remove the impl detail comments since they
Hzj_jie
2017/05/31 00:11:53
Done.
| |
39 void Receive(std::unique_ptr<CompoundBuffer> message); | |
40 | |
41 // Triggers EventHandler::OnMessagePipeOpen(). | |
42 void OpenPipe(); | |
43 | |
44 // Triggers EventHandler::OnMessagePipeClosed(); | |
45 void ClosePipe(); | |
46 | |
47 private: | |
48 const bool asynchronous_; | |
49 bool pipe_opened_ = false; | |
50 EventHandler* event_handler_ = nullptr; | |
51 }; | |
52 | |
53 } // namespace protocol | |
54 } // namespace remoting | |
55 | |
56 #endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_ | |
OLD | NEW |