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

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

Issue 2576013002: Introducing WebCoalescedInputEvent and inclusion in content/common (Closed)
Patch Set: Created 4 years 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 6d9002154c117929e3d477071b01a9b8371cff31..79e370c0fac950153d008673664151390a95b55f 100644
--- a/content/common/input/event_with_latency_info.cc
+++ b/content/common/input/event_with_latency_info.cc
@@ -9,16 +9,17 @@ using blink::WebInputEvent;
namespace content {
ScopedWebInputEventWithLatencyInfo::ScopedWebInputEventWithLatencyInfo(
- ui::ScopedWebInputEvent event,
+ blink::WebCoalescedInputEvent::ScopedWebInputEvent event,
const ui::LatencyInfo& latency_info)
- : event_(std::move(event)), latency_(latency_info) {
-}
+ : event_(new blink::WebCoalescedInputEvent(std::move(event))),
+ latency_(latency_info) {}
ScopedWebInputEventWithLatencyInfo::~ScopedWebInputEventWithLatencyInfo() {}
bool ScopedWebInputEventWithLatencyInfo::CanCoalesceWith(
const ScopedWebInputEventWithLatencyInfo& other) const {
- return ui::CanCoalesce(other.event(), event());
+ return ui::CanCoalesce(other.coalescedEvent().event(),
+ coalescedEvent().event());
}
void ScopedWebInputEventWithLatencyInfo::CoalesceWith(
@@ -29,9 +30,11 @@ 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_->timeStampSeconds = time_stamp_seconds;
+ const double time_stamp_seconds =
+ other.coalescedEvent().event().timeStampSeconds;
+ event_->addCoalescedEvent(other.coalescedEvent().event());
+ ui::Coalesce(other.coalescedEvent().event(), event_->eventPointer());
+ event_->eventPointer()->timeStampSeconds = time_stamp_seconds;
// When coalescing two input events, we keep the oldest LatencyInfo
// since it will represent the longest latency.
@@ -39,11 +42,13 @@ void ScopedWebInputEventWithLatencyInfo::CoalesceWith(
other.latency_.set_coalesced();
}
-const blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() const {
+const blink::WebCoalescedInputEvent&
+ScopedWebInputEventWithLatencyInfo::coalescedEvent() const {
return *event_;
}
-blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() {
+blink::WebCoalescedInputEvent&
+ScopedWebInputEventWithLatencyInfo::coalescedEvent() {
return *event_;
}

Powered by Google App Engine
This is Rietveld 408576698