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

Unified Diff: remoting/protocol/host_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/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/host_control_dispatcher.cc
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc
index 2b067d74cdf2d171ed4e6e6afc4467838259673a..fb8aee94188bc111745ec09d893eef012fd2c32e 100644
--- a/remoting/protocol/host_control_dispatcher.cc
+++ b/remoting/protocol/host_control_dispatcher.cc
@@ -17,16 +17,8 @@ namespace remoting {
namespace protocol {
HostControlDispatcher::HostControlDispatcher()
- : ChannelDispatcherBase(kControlChannelName),
- clipboard_stub_(nullptr),
- host_stub_(nullptr),
- parser_(base::Bind(&HostControlDispatcher::OnMessageReceived,
- base::Unretained(this)),
- reader()) {
-}
-
-HostControlDispatcher::~HostControlDispatcher() {
-}
+ : ChannelDispatcherBase(kControlChannelName) {}
+HostControlDispatcher::~HostControlDispatcher() {}
void HostControlDispatcher::SetCapabilities(
const Capabilities& capabilities) {
@@ -62,11 +54,16 @@ void HostControlDispatcher::SetCursorShape(
writer()->Write(SerializeAndFrameMessage(message), base::Closure());
}
-void HostControlDispatcher::OnMessageReceived(
- scoped_ptr<ControlMessage> message) {
+void HostControlDispatcher::OnIncomingMessage(
+ scoped_ptr<CompoundBuffer> buffer) {
DCHECK(clipboard_stub_);
DCHECK(host_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_client_resolution()) {
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698