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

Unified Diff: remoting/protocol/host_event_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_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/host_event_dispatcher.cc
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc
index 36fccc76db525dd71238b0713bce655ae0804fe4..d67f6517cc85493460fc0301e727930f4f7b286b 100644
--- a/remoting/protocol/host_event_dispatcher.cc
+++ b/remoting/protocol/host_event_dispatcher.cc
@@ -9,22 +9,22 @@
#include "remoting/proto/event.pb.h"
#include "remoting/proto/internal.pb.h"
#include "remoting/protocol/input_stub.h"
+#include "remoting/protocol/message_serialization.h"
namespace remoting {
namespace protocol {
HostEventDispatcher::HostEventDispatcher()
- : ChannelDispatcherBase(kEventChannelName),
- input_stub_(nullptr),
- parser_(base::Bind(&HostEventDispatcher::OnMessageReceived,
- base::Unretained(this)),
- reader()) {}
-
+ : ChannelDispatcherBase(kEventChannelName) {}
HostEventDispatcher::~HostEventDispatcher() {}
-void HostEventDispatcher::OnMessageReceived(scoped_ptr<EventMessage> message) {
+void HostEventDispatcher::OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) {
DCHECK(input_stub_);
+ scoped_ptr<EventMessage> message = ParseMessage<EventMessage>(buffer.get());
+ if (!message)
+ return;
+
if (!on_input_event_callback_.is_null())
on_input_event_callback_.Run(message->timestamp());
« no previous file with comments | « remoting/protocol/host_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698