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

Side by Side Diff: remoting/protocol/fake_message_pipe.h

Issue 2907073003: [Chromoting] Add DataChannelManager to manage optional incoming data channels (Closed)
Patch Set: Resolve review comments Created 3 years, 6 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
(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 explicit FakeMessagePipe(bool asynchronous);
26 ~FakeMessagePipe() override;
27
28 // Creates an std::unique_ptr<FakeMessagePipeWrapper> instance to wrap |this|.
29 // All operations will be forwarded to |this|.
30 std::unique_ptr<FakeMessagePipeWrapper> Wrap();
31
32 // MessagePipe implementation.
33 void Start(EventHandler* event_handler) override;
34 void Send(google::protobuf::MessageLite* message,
35 const base::Closure& done) override;
36
37 // Forwards |message| to EventHandler.
38 void Receive(std::unique_ptr<CompoundBuffer> message);
39
40 // Simulates the operation to open the pipe.
41 void OpenPipe();
42
43 // Simulates the operation to close the pipe.
44 void ClosePipe();
45
46 private:
47 void SendImpl(google::protobuf::MessageLite* message,
48 const base::Closure& done);
49 void ReceiveImpl(std::unique_ptr<CompoundBuffer> message);
50 void OpenPipeImpl();
51 void ClosePipeImpl();
52
53 const bool asynchronous_;
54 bool pipe_opened_ = false;
55 EventHandler* event_handler_ = nullptr;
56 };
57
58 } // namespace protocol
59 } // namespace remoting
60
61 #endif // REMOTING_PROTOCOL_FAKE_MESSAGE_PIPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698