Chromium Code Reviews| Index: remoting/protocol/channel_dispatcher_base.h |
| diff --git a/remoting/protocol/channel_dispatcher_base.h b/remoting/protocol/channel_dispatcher_base.h |
| index eca2d12d9892e4962e7b059cf857ddcf2481479c..626bc3eccb0051bf2cf52bd74a5ea0f12099a1f3 100644 |
| --- a/remoting/protocol/channel_dispatcher_base.h |
| +++ b/remoting/protocol/channel_dispatcher_base.h |
| @@ -12,11 +12,15 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "remoting/base/buffered_socket_writer.h" |
| #include "remoting/protocol/errors.h" |
| -#include "remoting/protocol/message_reader.h" |
| namespace remoting { |
| + |
| +class CompoundBuffer; |
| + |
| namespace protocol { |
| +class MessagePipe; |
| +class P2PStreamSocket; |
| class StreamChannelFactory; |
| // Base class for channel message dispatchers. It's responsible for |
| @@ -49,27 +53,25 @@ 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(); } |
|
Jamie
2016/02/02 22:43:10
I think the previous "!= nullptr" was clearer.
Sergey Ulanov
2016/02/03 18:45:27
Done.
|
| protected: |
| explicit ChannelDispatcherBase(const char* channel_name); |
| - BufferedSocketWriter* writer() { return &writer_; } |
| + MessagePipe* message_pipe() { return message_pipe_.get(); } |
| // Child classes must override this method to handle incoming messages. |
| virtual void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) = 0; |
| 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_; |
| + scoped_ptr<MessagePipe> message_pipe_; |
| DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); |
| }; |