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

Unified Diff: remoting/protocol/host_event_dispatcher.cc

Issue 2413553003: Add InputEventTimestampSource interface. (Closed)
Patch Set: address feedback Created 4 years, 2 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/host_event_dispatcher.cc
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc
index 0ee78d0d59185dc0d63728b826c913bbba6b60cd..182bf912e44bd486d2ee3f0ae35a90aa12b6c4d4 100644
--- a/remoting/protocol/host_event_dispatcher.cc
+++ b/remoting/protocol/host_event_dispatcher.cc
@@ -4,6 +4,7 @@
#include "remoting/protocol/host_event_dispatcher.h"
+#include "base/memory/ref_counted.h"
#include "net/socket/stream_socket.h"
#include "remoting/base/compound_buffer.h"
#include "remoting/base/constants.h"
@@ -16,7 +17,9 @@ namespace remoting {
namespace protocol {
HostEventDispatcher::HostEventDispatcher()
- : ChannelDispatcherBase(kEventChannelName) {}
+ : ChannelDispatcherBase(kEventChannelName),
+ event_timestamps_source_(new InputEventTimestampsSourceImpl()) {}
+
HostEventDispatcher::~HostEventDispatcher() {}
void HostEventDispatcher::OnIncomingMessage(
@@ -28,8 +31,10 @@ void HostEventDispatcher::OnIncomingMessage(
if (!message)
return;
- if (!on_input_event_callback_.is_null())
- on_input_event_callback_.Run(message->timestamp());
+ event_timestamps_source_->OnEventReceived(InputEventTimestamps{
+ .client_timestamp =
+ base::TimeTicks::FromInternalValue(message->timestamp()),
+ .host_timestamp = base::TimeTicks::Now()});
if (message->has_key_event()) {
const KeyEvent& event = message->key_event();

Powered by Google App Engine
This is Rietveld 408576698