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

Unified Diff: content/common/input/event_with_latency_info.cc

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Rebase Created 3 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
Index: content/common/input/event_with_latency_info.cc
diff --git a/content/common/input/event_with_latency_info.cc b/content/common/input/event_with_latency_info.cc
index 79084e5aa128bc67706f566581f503bb56748337..2d6dddc1dde0d36ec0b58d13c9a6f5cf61e39351 100644
--- a/content/common/input/event_with_latency_info.cc
+++ b/content/common/input/event_with_latency_info.cc
@@ -11,7 +11,8 @@ namespace content {
ScopedWebInputEventWithLatencyInfo::ScopedWebInputEventWithLatencyInfo(
blink::WebScopedInputEvent event,
const ui::LatencyInfo& latency_info)
- : event_(std::move(event)), latency_(latency_info) {}
+ : event_(new blink::WebCoalescedInputEvent(std::move(event))),
dcheng 2017/01/23 19:38:58 Not required in this CL, but maybe WebCoalescedInp
Navid Zolghadr 2017/01/23 21:42:04 Acknowledged.
+ latency_(latency_info) {}
ScopedWebInputEventWithLatencyInfo::~ScopedWebInputEventWithLatencyInfo() {}
@@ -29,8 +30,9 @@ void ScopedWebInputEventWithLatencyInfo::CoalesceWith(
// New events get coalesced into older events, and the newer timestamp
// should always be preserved.
const double time_stamp_seconds = other.event().timeStampSeconds();
- ui::Coalesce(other.event(), event_.get());
- event_->setTimeStampSeconds(time_stamp_seconds);
+ ui::Coalesce(other.event(), event_->eventPointer());
+ event_->eventPointer()->setTimeStampSeconds(time_stamp_seconds);
+ event_->addCoalescedEvent(other.event());
// When coalescing two input events, we keep the oldest LatencyInfo
// since it will represent the longest latency.
@@ -39,10 +41,15 @@ void ScopedWebInputEventWithLatencyInfo::CoalesceWith(
}
const blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() const {
- return *event_;
+ return event_->event();
}
blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() {
+ return *event_->eventPointer();
+}
+
+const blink::WebCoalescedInputEvent&
+ScopedWebInputEventWithLatencyInfo::coalescedEvent() const {
return *event_;
}

Powered by Google App Engine
This is Rietveld 408576698