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

Unified Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 217163006: Defer synthetic gesture completions until events have been flushed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use |DidFlush| Created 6 years, 9 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/browser/renderer_host/input/input_router_impl.cc
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc
index 1028668e51100a582df1f4d54792935b6419897d..b6110d21648446332073c9b60b1a755c9b3a2a67 100644
--- a/content/browser/renderer_host/input/input_router_impl.cc
+++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -146,6 +146,7 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender,
touch_ack_timeout_supported_(false),
current_view_flags_(0),
current_ack_source_(ACK_SOURCE_NONE),
+ flush_requested_(false),
gesture_event_queue_(new GestureEventQueue(this, this)) {
DCHECK(sender);
DCHECK(client);
@@ -159,7 +160,10 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender,
InputRouterImpl::~InputRouterImpl() {}
-void InputRouterImpl::Flush() {}
+void InputRouterImpl::Flush() {
+ flush_requested_ = true;
+ SignalFlushedIfNecessary();
+}
bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) {
DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart);
@@ -623,6 +627,8 @@ void InputRouterImpl::ProcessInputEventAck(
} else if (event_type != WebInputEvent::Undefined) {
ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE);
}
+
+ SignalFlushedIfNecessary();
}
void InputRouterImpl::ProcessKeyboardAck(blink::WebInputEvent::Type type,
@@ -822,6 +828,27 @@ void InputRouterImpl::UpdateTouchAckTimeoutEnabled() {
touch_ack_timeout_delay_);
}
+void InputRouterImpl::SignalFlushedIfNecessary() {
+ if (!flush_requested_)
+ return;
+
+ if (HasPendingEvents())
+ return;
+
+ flush_requested_ = false;
+ client_->DidFlush();
+}
+
+bool InputRouterImpl::HasPendingEvents() const {
+ return !touch_event_queue_->empty() ||
+ gesture_event_queue_->HasQueuedGestureEvents() ||
+ !key_queue_.empty() ||
+ mouse_move_pending_ ||
+ mouse_wheel_pending_ ||
+ select_range_pending_ ||
+ move_caret_pending_;
+}
+
bool InputRouterImpl::IsInOverscrollGesture() const {
OverscrollController* controller = client_->GetOverscrollController();
return controller && controller->overscroll_mode() != OVERSCROLL_NONE;

Powered by Google App Engine
This is Rietveld 408576698