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

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

Issue 2094323002: Ensure acks are sent for all blocking events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/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 243bc4fe9508b0386899b6c22929c0e8ebfda206..b4c9d82700089e08d6431021dcb47338cb66ca05 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -98,21 +98,38 @@ bool MainThreadEventQueue::HandleEvent(
return non_blocking;
}
-void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type) {
+void MainThreadEventQueue::EventHandled(blink::WebInputEvent::Type type,
+ InputEventAckState ack_result) {
if (type == blink::WebInputEvent::MouseWheel) {
+ if (in_flight_wheel_event_) {
+ // Send acks for blocking wheel events.
+ for (const auto id : in_flight_wheel_event_->eventsToAck)
tdresser 2016/06/28 14:04:49 eventsToAck is just a list of zeroes, which is pre
dtapuska 2016/06/28 17:30:21 Changed to be a dcheck.
+ client_->SendInputEventAck(routing_id_, type, ack_result, id);
+ }
+
if (!wheel_events_.empty()) {
- std::unique_ptr<PendingMouseWheelEvent> event = wheel_events_.Pop();
- client_->SendEventToMainThread(routing_id_, &event->event, event->latency,
- event->type);
+ in_flight_wheel_event_ = wheel_events_.Pop();
+ client_->SendEventToMainThread(
+ routing_id_, &in_flight_wheel_event_->event,
+ in_flight_wheel_event_->latency, in_flight_wheel_event_->type);
} else {
+ in_flight_wheel_event_.reset();
wheel_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING);
}
} else if (blink::WebInputEvent::isTouchEventType(type)) {
+ if (in_flight_touch_event_) {
+ // Send acks for blocking touch events.
+ for (const auto id : in_flight_touch_event_->eventsToAck)
+ client_->SendInputEventAck(routing_id_, type, ack_result, id);
+ }
+
if (!touch_events_.empty()) {
- std::unique_ptr<PendingTouchEvent> event = touch_events_.Pop();
- client_->SendEventToMainThread(routing_id_, &event->event, event->latency,
- event->type);
+ in_flight_touch_event_ = touch_events_.Pop();
+ client_->SendEventToMainThread(
+ routing_id_, &in_flight_touch_event_->event,
+ in_flight_touch_event_->latency, in_flight_touch_event_->type);
} else {
+ in_flight_touch_event_.reset();
touch_events_.set_state(WebInputEventQueueState::ITEM_NOT_PENDING);
}
} else {

Powered by Google App Engine
This is Rietveld 408576698