Commit 5e499839 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: make EventInjector reset time/latecy when injecting

This way telemetry only includes the time from ash, not the initial hop
from browser to ash.

BUG=759163
TEST=none

Change-Id: I65f514d6bee3346a7b828b431300e5cf3277d521
Reviewed-on: https://chromium-review.googlesource.com/c/1327416Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607320}
parent d75cb383
...@@ -133,6 +133,16 @@ void EventInjector::InjectEventNoAckImpl(int64_t display_id, ...@@ -133,6 +133,16 @@ void EventInjector::InjectEventNoAckImpl(int64_t display_id,
if (!event_and_host.window_tree_host) if (!event_and_host.window_tree_host)
return; return;
// Reset the latency time. This way telemetry doesn't include the time from
// browser to ash.
base::TimeTicks event_time = base::TimeTicks::Now();
ui::Event::DispatcherApi dispatcher_api(event_and_host.event.get());
dispatcher_api.set_time_stamp(event_time);
ui::LatencyInfo latency_info;
latency_info.AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_UI_COMPONENT, event_time, 1);
event_and_host.event->set_latency(latency_info);
EventQueue::DispatchOrQueueEvent(window_service_, EventQueue::DispatchOrQueueEvent(window_service_,
event_and_host.window_tree_host, event_and_host.window_tree_host,
event_and_host.event.get(), honor_rewriters); event_and_host.event.get(), honor_rewriters);
......
...@@ -70,6 +70,7 @@ class EVENTS_EXPORT Event { ...@@ -70,6 +70,7 @@ class EVENTS_EXPORT Event {
void set_result(int result) { void set_result(int result) {
event_->result_ = static_cast<EventResult>(result); event_->result_ = static_cast<EventResult>(result);
} }
void set_time_stamp(base::TimeTicks time) { event_->time_stamp_ = time; }
private: private:
Event* event_; Event* event_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment