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

Unified Diff: remoting/protocol/channel_dispatcher_base.h

Issue 1649063003: Add MessagePipe interface. Use it in ChannelDispatcherBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_parser
Patch Set: Created 4 years, 11 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/channel_dispatcher_base.h
diff --git a/remoting/protocol/channel_dispatcher_base.h b/remoting/protocol/channel_dispatcher_base.h
index c8eedebfa9901f61584dadc068f31ed25f0715d2..c09f97e9043e379e694f346ad96b153d6b356fad 100644
--- a/remoting/protocol/channel_dispatcher_base.h
+++ b/remoting/protocol/channel_dispatcher_base.h
@@ -12,7 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "remoting/base/buffered_socket_writer.h"
#include "remoting/protocol/errors.h"
-#include "remoting/protocol/message_reader.h"
+#include "remoting/protocol/stream_message_pipe_adapter.h"
namespace remoting {
namespace protocol {
@@ -49,27 +49,24 @@ class ChannelDispatcherBase {
const std::string& channel_name() { return channel_name_; }
// Returns true if the channel is currently connected.
- bool is_connected() { return channel_ != nullptr; }
+ bool is_connected() { return message_pipe() != nullptr; }
Jamie 2016/02/01 22:48:20 message_pipe() can never return null with this imp
Sergey Ulanov 2016/02/02 21:16:42 Replaced message_pipe_ with a scoped_ptr.
protected:
explicit ChannelDispatcherBase(const char* channel_name);
- BufferedSocketWriter* writer() { return &writer_; }
+ MessagePipe* message_pipe() { return &message_pipe_; }
- // Should be overridden in child classes to handle incoming messages.
virtual void OnIncomingMessage(scoped_ptr<CompoundBuffer> message);
private:
void OnChannelReady(scoped_ptr<P2PStreamSocket> socket);
- void OnReadWriteFailed(int error);
+ void OnPipeError(int error);
std::string channel_name_;
StreamChannelFactory* channel_factory_;
EventHandler* event_handler_;
- scoped_ptr<P2PStreamSocket> channel_;
- BufferedSocketWriter writer_;
- MessageReader reader_;
+ StreamMessagePipeAdapter message_pipe_;
DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase);
};

Powered by Google App Engine
This is Rietveld 408576698