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..ff5bccf7e310eca29ae0309509909fb0d80a9e25 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_timestamp_source_(new InputEventTimestampSourceImpl()) {} |
+ |
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_timestamp_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(); |
@@ -54,5 +59,10 @@ void HostEventDispatcher::OnIncomingMessage( |
} |
} |
+scoped_refptr<InputEventTimestampSource> |
+HostEventDispatcher::GetEventTimestampSource() { |
+ return event_timestamp_source_; |
+} |
+ |
} // namespace protocol |
} // namespace remoting |