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

Unified Diff: remoting/protocol/channel_dispatcher_base.cc

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.cc
diff --git a/remoting/protocol/channel_dispatcher_base.cc b/remoting/protocol/channel_dispatcher_base.cc
index 36d60dde564fe4d65cc19ccb77e1d8bd46c0b1c0..64d29a77f50c8eaba55dfbe472a3624143559103 100644
--- a/remoting/protocol/channel_dispatcher_base.cc
+++ b/remoting/protocol/channel_dispatcher_base.cc
@@ -41,16 +41,11 @@ void ChannelDispatcherBase::OnChannelReady(
}
channel_factory_ = nullptr;
- channel_ = std::move(socket);
- writer_.Start(
- base::Bind(&P2PStreamSocket::Write, base::Unretained(channel_.get())),
- base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
- base::Unretained(this)));
- reader_.StartReading(channel_.get(),
- base::Bind(&ChannelDispatcherBase::OnIncomingMessage,
- base::Unretained(this)),
- base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
- base::Unretained(this)));
+ message_pipe_.Initialize(
+ std::move(socket),
+ base::Bind(&ChannelDispatcherBase::OnPipeError, base::Unretained(this)));
+ message_pipe_.StartReceiving(base::Bind(
+ &ChannelDispatcherBase::OnIncomingMessage, base::Unretained(this)));
event_handler_->OnChannelInitialized(this);
}
@@ -62,7 +57,7 @@ void ChannelDispatcherBase::OnIncomingMessage(
LOG(ERROR) << "Received unexpected message on " << channel_name();
}
-void ChannelDispatcherBase::OnReadWriteFailed(int error) {
+void ChannelDispatcherBase::OnPipeError(int error) {
event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
}

Powered by Google App Engine
This is Rietveld 408576698