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

Unified Diff: remoting/protocol/client_control_dispatcher.cc

Issue 1654513003: Simplify message parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_done
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
« no previous file with comments | « remoting/protocol/client_control_dispatcher.h ('k') | remoting/protocol/client_event_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/client_control_dispatcher.cc
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc
index 3ce2f95d619667ff340599cdbf985a5897881f6a..6ee42564f70c9bd4c132c0badeb720704f5a21c3 100644
--- a/remoting/protocol/client_control_dispatcher.cc
+++ b/remoting/protocol/client_control_dispatcher.cc
@@ -59,13 +59,7 @@ bool CursorShapeIsValid(const CursorShapeInfo& cursor_shape) {
} // namespace
ClientControlDispatcher::ClientControlDispatcher()
- : ChannelDispatcherBase(kControlChannelName),
- client_stub_(nullptr),
- clipboard_stub_(nullptr),
- parser_(base::Bind(&ClientControlDispatcher::OnMessageReceived,
- base::Unretained(this)),
- reader()) {}
-
+ : ChannelDispatcherBase(kControlChannelName) {}
ClientControlDispatcher::~ClientControlDispatcher() {}
void ClientControlDispatcher::InjectClipboardEvent(
@@ -115,11 +109,16 @@ void ClientControlDispatcher::DeliverClientMessage(
writer()->Write(SerializeAndFrameMessage(control_message), base::Closure());
}
-void ClientControlDispatcher::OnMessageReceived(
- scoped_ptr<ControlMessage> message) {
+void ClientControlDispatcher::OnIncomingMessage(
+ scoped_ptr<CompoundBuffer> buffer) {
DCHECK(client_stub_);
DCHECK(clipboard_stub_);
+ scoped_ptr<ControlMessage> message =
+ ParseMessage<ControlMessage>(buffer.get());
+ if (!message)
+ return;
+
if (message->has_clipboard_event()) {
clipboard_stub_->InjectClipboardEvent(message->clipboard_event());
} else if (message->has_capabilities()) {
« no previous file with comments | « remoting/protocol/client_control_dispatcher.h ('k') | remoting/protocol/client_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698