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

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
Index: remoting/protocol/message_pipe.h
diff --git a/remoting/protocol/message_pipe.h b/remoting/protocol/message_pipe.h
index 6d8eeebbfe051c2d508e5976059a4a7f5d7ec316..bab42667a4dbdee9b451a8ffada82a346e047507 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_handle| will be called to notify when a message
Jamie 2016/07/19 18:24:47 s/handle/handler/
Sergey Ulanov 2016/07/19 23:38:43 Done.
+ // is received of the pipe is closed.
Jamie 2016/07/19 18:24:47 s/of/or/
Sergey Ulanov 2016/07/19 23:38:43 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698