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

Unified Diff: remoting/protocol/message_pipe.h

Issue 2146213002: Add support for dynamic channels in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/ice_connection_to_host.cc ('k') | remoting/protocol/message_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/message_pipe.h
diff --git a/remoting/protocol/message_pipe.h b/remoting/protocol/message_pipe.h
index 6d8eeebbfe051c2d508e5976059a4a7f5d7ec316..3b4d41c4e2f658ae5ce86f37146e8eca1923c2ff 100644
--- a/remoting/protocol/message_pipe.h
+++ b/remoting/protocol/message_pipe.h
@@ -24,13 +24,23 @@ namespace protocol {
// Represents a bi-directional pipe that allows to send and receive messages.
class MessagePipe {
public:
- typedef base::Callback<void(std::unique_ptr<CompoundBuffer> message)>
- MessageReceivedCallback;
+ class EventHandler {
+ public:
+ // Called when a message is received.
+ virtual void OnMessageReceived(std::unique_ptr<CompoundBuffer> message) = 0;
+
+ // Called when the channel is closed.
+ virtual void OnMessagePipeClosed() = 0;
+
+ protected:
+ virtual ~EventHandler() {}
+ };
virtual ~MessagePipe() {}
- // Starts receiving incoming messages and calls |callback| for each message.
- virtual void StartReceiving(const MessageReceivedCallback& callback) = 0;
+ // Starts the channel. |event_handler| will be called to notify when a message
+ // is received or the pipe is closed.
+ virtual void Start(EventHandler* event_handler) = 0;
// Sends a message. |done| is called when the message has been sent to the
// client, but it doesn't mean that the client has received it. |done| is
« no previous file with comments | « remoting/protocol/ice_connection_to_host.cc ('k') | remoting/protocol/message_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698