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

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

Issue 997283002: Coalesce async touch move events until the ack back from render (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit tests Created 5 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 54bf892014c80b6884e624cdcdaac312c0817e46..4623aeae2c83aa8cae9dc3d085589dc516982b0d 100644
--- a/content/browser/renderer_host/input/input_router_impl.cc
+++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -248,6 +248,8 @@ bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message)
IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck)
+ IPC_MESSAGE_HANDLER(InputHostMsg_HandleUncancelableTouchMoveEvent_ACK,
+ OnUncancelableTouchMoveAck)
IPC_MESSAGE_HANDLER(InputHostMsg_DidOverscroll, OnDidOverscroll)
IPC_MESSAGE_HANDLER(InputHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck)
IPC_MESSAGE_HANDLER(InputHostMsg_SelectRange_ACK, OnSelectMessageAck)
@@ -347,13 +349,19 @@ void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
// Touch events should always indicate in the event whether they are
// cancelable (respect ACK disposition) or not.
bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event);
+ bool is_async_touch_move = false;
if (WebInputEvent::isTouchEventType(input_event.type)) {
const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
- DCHECK_NE(ignores_ack, !!touch.cancelable);
+ if (touch.type == WebInputEvent::TouchMove && !touch.cancelable)
+ is_async_touch_move = true;
+
+ if (touch.type != WebInputEvent::TouchMove)
+ DCHECK_NE(ignores_ack, touch.cancelable);
}
- // If we don't care about the ack disposition, send the ack immediately.
- if (ignores_ack) {
+ // If we don't care about the ack disposition, or it is an async touchmove
+ // event, send the ack immediately.
+ if (ignores_ack || is_async_touch_move) {
ProcessInputEventAck(input_event.type,
INPUT_EVENT_ACK_STATE_IGNORED,
latency_info,
@@ -435,6 +443,15 @@ void InputRouterImpl::OnInputEventAck(
Details<int>(&type));
}
+void InputRouterImpl::OnUncancelableTouchMoveAck(
+ const InputHostMsg_HandleUncancelableTouchMoveEvent_ACK_Params& ack) {
+ ProcessUncancelableTouchMoveAck();
+ int type = static_cast<int>(ack.type);
+ NotificationService::current()->Notify(
+ NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
+ Source<void>(this), Details<int>(&type));
+}
+
void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) {
client_->DidOverscroll(params);
}
@@ -597,6 +614,10 @@ void InputRouterImpl::ProcessTouchAck(
touch_event_queue_.ProcessTouchAck(ack_result, latency);
}
+void InputRouterImpl::ProcessUncancelableTouchMoveAck() {
+ touch_event_queue_.ProcessUncancelableTouchMoveAck();
+}
+
void InputRouterImpl::UpdateTouchAckTimeoutEnabled() {
// Mobile sites tend to be well-behaved with respect to touch handling, so
// they have less need for the touch timeout fallback.

Powered by Google App Engine
This is Rietveld 408576698