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

Unified Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Creating CoalescedWebInputEvent Created 4 years, 1 month 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/renderer/input/main_thread_event_queue.cc
diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc
index 45ee0814ff84418deb0e5bddfcc98afc7bde581f..87c577bb5c5487c067a4ab661a0c2db44a35a12d 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -15,7 +15,7 @@ namespace {
const size_t kTenSeconds = 10 * 1000 * 1000;
bool IsContinuousEvent(const std::unique_ptr<EventWithDispatchType>& event) {
- switch (event->event().type) {
+ switch (event->coalescedEvent().event().type) {
case blink::WebInputEvent::MouseMove:
case blink::WebInputEvent::MouseWheel:
return true;
@@ -23,7 +23,8 @@ bool IsContinuousEvent(const std::unique_ptr<EventWithDispatchType>& event) {
// TouchMoves that are blocking end up blocking scroll. Do not treat
// them as continuous events otherwise we will end up waiting up to an
// additional frame.
- return static_cast<const blink::WebTouchEvent&>(event->event())
+ return static_cast<const blink::WebTouchEvent&>(
+ event->coalescedEvent().event())
.dispatchType != blink::WebInputEvent::Blocking;
default:
return false;
@@ -33,7 +34,7 @@ bool IsContinuousEvent(const std::unique_ptr<EventWithDispatchType>& event) {
} // namespace
EventWithDispatchType::EventWithDispatchType(
- ui::ScopedWebInputEvent event,
+ blink::CoalescedWebInputEvent::ScopedWebInputEvent event,
const ui::LatencyInfo& latency,
InputEventDispatchType dispatch_type)
: ScopedWebInputEventWithLatencyInfo(std::move(event), latency),
@@ -50,8 +51,8 @@ bool EventWithDispatchType::CanCoalesceWith(
}
void EventWithDispatchType::CoalesceWith(const EventWithDispatchType& other) {
- coalesced_event_ids_.push_back(
- ui::WebInputEventTraits::GetUniqueTouchEventId(other.event()));
+ coalesced_event_ids_.push_back(ui::WebInputEventTraits::GetUniqueTouchEventId(
+ other.coalescedEvent().event()));
ScopedWebInputEventWithLatencyInfo::CoalesceWith(other);
last_coalesced_timestamp_ = base::TimeTicks::Now();
}
@@ -81,7 +82,7 @@ MainThreadEventQueue::MainThreadEventQueue(
MainThreadEventQueue::~MainThreadEventQueue() {}
bool MainThreadEventQueue::HandleEvent(
- ui::ScopedWebInputEvent event,
+ blink::CoalescedWebInputEvent::ScopedWebInputEvent event,
const ui::LatencyInfo& latency,
InputEventDispatchType original_dispatch_type,
InputEventAckState ack_result) {
@@ -172,9 +173,9 @@ void MainThreadEventQueue::DispatchInFlightEvent() {
dispatch_type = DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN;
}
- client_->HandleEventOnMainThread(routing_id_, &in_flight_event_->event(),
- in_flight_event_->latencyInfo(),
- dispatch_type);
+ client_->HandleEventOnMainThread(
+ routing_id_, &in_flight_event_->coalescedEvent(),
+ in_flight_event_->latencyInfo(), dispatch_type);
}
in_flight_event_.reset();
@@ -217,7 +218,7 @@ void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type,
client_->SendInputEventAck(routing_id_, type, ack_result, id);
if (renderer_scheduler_) {
renderer_scheduler_->DidHandleInputEventOnMainThread(
- in_flight_event_->event());
+ in_flight_event_->coalescedEvent().event());
}
}
}
@@ -294,7 +295,7 @@ bool MainThreadEventQueue::IsRafAlignedInputDisabled() {
bool MainThreadEventQueue::IsRafAlignedEvent(
const std::unique_ptr<EventWithDispatchType>& event) {
- switch (event->event().type) {
+ switch (event->coalescedEvent().event().type) {
case blink::WebInputEvent::MouseMove:
case blink::WebInputEvent::MouseWheel:
return handle_raf_aligned_mouse_input_;
@@ -302,7 +303,8 @@ bool MainThreadEventQueue::IsRafAlignedEvent(
// TouchMoves that are blocking end up blocking scroll. Do not treat
// them as continuous events otherwise we will end up waiting up to an
// additional frame.
- return static_cast<const blink::WebTouchEvent&>(event->event())
+ return static_cast<const blink::WebTouchEvent&>(
+ event->coalescedEvent().event())
.dispatchType != blink::WebInputEvent::Blocking &&
handle_raf_aligned_touch_input_;
default:

Powered by Google App Engine
This is Rietveld 408576698