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

Unified Diff: remoting/protocol/channel_dispatcher_base.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 | « no previous file | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/channel_dispatcher_base.h
diff --git a/remoting/protocol/channel_dispatcher_base.h b/remoting/protocol/channel_dispatcher_base.h
index 1d97a61d9629f7a9ab5d837a0cb0b8512e883d11..b22548fabfa9d84636405f50248554df1211c2ec 100644
--- a/remoting/protocol/channel_dispatcher_base.h
+++ b/remoting/protocol/channel_dispatcher_base.h
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "remoting/protocol/errors.h"
+#include "remoting/protocol/message_pipe.h"
namespace remoting {
@@ -19,34 +20,40 @@ class CompoundBuffer;
namespace protocol {
class MessageChannelFactory;
-class MessagePipe;
// Base class for channel message dispatchers. It's responsible for
// creating the named channel. Derived dispatchers then dispatch
// incoming messages on this channel as well as send outgoing
// messages.
-class ChannelDispatcherBase {
+class ChannelDispatcherBase : public MessagePipe::EventHandler {
public:
class EventHandler {
public:
EventHandler() {}
virtual ~EventHandler() {}
+ // Called after the channel is initialized.
virtual void OnChannelInitialized(
ChannelDispatcherBase* channel_dispatcher) = 0;
+
+ // Called after the channel is closed.
+ virtual void OnChannelClosed(ChannelDispatcherBase* channel_dispatcher) = 0;
};
// The callback is called when initialization is finished. The
// parameter is set to true on success.
typedef base::Callback<void(bool)> InitializedCallback;
- virtual ~ChannelDispatcherBase();
+ ~ChannelDispatcherBase() override;
- // Creates and connects the channel in the specified
- // |session|. Caller retains ownership of the Session.
+ // Creates and connects the channel using |channel_factory|.
void Init(MessageChannelFactory* channel_factory,
EventHandler* event_handler);
+ // Initializes the channel using |message_pipe| that's already connected.
+ void Init(std::unique_ptr<MessagePipe> message_pipe,
+ EventHandler* event_handler);
+
const std::string& channel_name() { return channel_name_; }
// Returns true if the channel is currently connected.
@@ -62,7 +69,10 @@ class ChannelDispatcherBase {
private:
void OnChannelReady(std::unique_ptr<MessagePipe> message_pipe);
- void OnPipeError(int error);
+
+ // MessagePipe::EventHandler interface.
+ void OnMessageReceived(std::unique_ptr<CompoundBuffer> message) override;
+ void OnMessagePipeClosed() override;
std::string channel_name_;
MessageChannelFactory* channel_factory_ = nullptr;
« no previous file with comments | « no previous file | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698