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

Unified Diff: content/browser/renderer_host/input/touch_event_queue.h

Issue 245833002: Implement async touchmove dispatch during scroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 years, 8 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/touch_event_queue.h
diff --git a/content/browser/renderer_host/input/touch_event_queue.h b/content/browser/renderer_host/input/touch_event_queue.h
index 03d3210adb429c2fb3a9cebe33215f3058eb97c8..5a3ecc0b7c1f666079351b5495be0ca6b0e3f5a2 100644
--- a/content/browser/renderer_host/input/touch_event_queue.h
+++ b/content/browser/renderer_host/input/touch_event_queue.h
@@ -48,12 +48,16 @@ class CONTENT_EXPORT TouchEventQueue {
// using the disposition to determine whether a scroll update should be
// sent. Mobile Safari's default overflow scroll behavior.
TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE,
+ // Send touchmove events throughout a scroll, but throttle sending and
+ // ignore the ACK as long as scrolling remains possible. Unconsumed scroll
+ // events return touchmove events to being dispatched synchronously.
+ TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE,
// Like sync, except that consumed scroll events cause subsequent touchmove
// events to be suppressed. Unconsumed scroll events return touchmove
// events to being dispatched synchronously (so scrolling may be hijacked
// when a scroll limit is reached, and later resumed). http://goo.gl/RShsdN
TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE,
aelias_OOO_until_Jul13 2014/04/22 01:56:39 Can we delete this mode as part of this patch? Th
Rick Byers 2014/04/22 14:52:59 Replacing ABSORB with ASYNC is OK with me (async j
jdduke (slow) 2014/04/23 19:57:41 Done.
- TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_TOUCHCANCEL
+ TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE
};
// The |client| must outlive the TouchEventQueue. If
@@ -128,16 +132,29 @@ class CONTENT_EXPORT TouchEventQueue {
// events being sent to the renderer.
void FlushQueue();
- // Walks the queue, checking each event for |ShouldForwardToRenderer()|.
- // If true, forwards the touch event and stops processing further events.
- // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|.
+ // Walks the queue, checking each event with |FilterBeforeFowarding()|.
+ // If allowed, forwards the touch event and stops processing further events.
+ // Otherwise, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|.
void TryForwardNextEventToRenderer();
- // Pops the touch-event from the top of the queue and sends it to the
- // TouchEventQueueClient. This reduces the size of the queue by one.
+ // Forwards the event at the head of the queue to the renderer.
+ void ForwardNextEventToRenderer();
+
+ // Pops the touch-event from the head of the queue and acks it to the client.
+ void PopTouchEventToClient(InputEventAckState ack_result);
+
+ // Pops the touch-event from the head of the queue and acks it to the client,
+ // updating the event with |renderer_latency_info|.
void PopTouchEventToClient(InputEventAckState ack_result,
const ui::LatencyInfo& renderer_latency_info);
+ // Ack all coalesced events in |acked_event| to the client with |ack_result|.
+ void AckTouchEventToClient(InputEventAckState ack_result,
+ const CoalescedWebTouchEvent& acked_event);
+
+ // Safely pop the head of the queue.
+ scoped_ptr<CoalescedWebTouchEvent> PopTouchEvent();
+
enum PreFilterResult {
ACK_WITH_NO_CONSUMER_EXISTS,
ACK_WITH_NOT_CONSUMED,
@@ -146,7 +163,6 @@ class CONTENT_EXPORT TouchEventQueue {
// Filter touches prior to forwarding to the renderer, e.g., if the renderer
// has no touch handler.
PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event);
- void ForwardToRenderer(const TouchEventWithLatencyInfo& event);
void UpdateTouchAckStates(const blink::WebTouchEvent& event,
InputEventAckState ack_result);
@@ -164,7 +180,7 @@ class CONTENT_EXPORT TouchEventQueue {
// Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|.
// If not NULL, |dispatching_touch_ack_| is the touch event of which the ack
// is being dispatched.
- CoalescedWebTouchEvent* dispatching_touch_ack_;
+ const CoalescedWebTouchEvent* dispatching_touch_ack_;
// Used to prevent touch timeout scheduling if we receive a synchronous
// ack after forwarding a touch event to the client.
@@ -195,6 +211,14 @@ class CONTENT_EXPORT TouchEventQueue {
// timeout, and shouldn't cause touchend to be dropped.
bool absorbing_touch_moves_;
+ // Whether touchmove's should remain buffered and dispatched asynchronously
+ // while a scroll sequence is active. In this mode, touchmove's are
+ // ack'ed immediately but remain buffered in |pending_async_touch_move_| until
+ // a sufficient time period has elapsed since the last sent touch event.
+ bool async_touch_moves_;
aelias_OOO_until_Jul13 2014/04/22 01:56:39 Instead of these bools, can we keep the enum value
Rick Byers 2014/04/22 14:52:59 We can remove this bool completely when we collaps
jdduke (slow) 2014/04/23 19:57:41 Done.
+ scoped_ptr<TouchEventWithLatencyInfo> pending_async_touch_move_;
+ double last_sent_touch_timestamp_;
aelias_OOO_until_Jul13 2014/04/22 01:56:39 Please specify "ms" or "sec" in the variable name.
jdduke (slow) 2014/04/23 19:57:41 Done.
+
// How touch events are handled during scrolling. For now this is a global
// setting for experimentation, but we may evolve it into an app-controlled
// mode.

Powered by Google App Engine
This is Rietveld 408576698