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

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

Issue 48973005: Move TouchEvent timeout code to the TouchEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years 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 d1daa1590d732d2cc497d7ccf8fe9a4997570008..ea7eb71fe5ae516e76d30b3824d18317c2845425 100644
--- a/content/browser/renderer_host/input/touch_event_queue.h
+++ b/content/browser/renderer_host/input/touch_event_queue.h
@@ -38,7 +38,7 @@ class CONTENT_EXPORT TouchEventQueue {
// The |client| must outlive the TouchEventQueue.
explicit TouchEventQueue(TouchEventQueueClient* client);
- virtual ~TouchEventQueue();
+ ~TouchEventQueue();
// Adds an event to the queue. The event may be coalesced with previously
// queued events (e.g. consecutive touch-move events can be coalesced into a
@@ -54,8 +54,8 @@ class CONTENT_EXPORT TouchEventQueue {
// When GestureScrollBegin is received, we send a touch cancel to renderer,
// route all the following touch events directly to client, and ignore the
- // ack for the touch cancel. When GestureScrollEnd/GestureFlingStart is
- // received, we resume the normal flow of sending touch events to renderer.
+ // ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received,
+ // resume the normal flow of sending touch events to the renderer.
void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event);
// Empties the queue of touch events. This may result in any number of gesture
@@ -66,20 +66,30 @@ class CONTENT_EXPORT TouchEventQueue {
// a touch start event.
bool IsPendingAckTouchStart() const;
- // Returns whether the event-queue is empty.
+ // Sets whether a delayed touch ack will cancel and flush the current
+ // touch sequence.
+ void SetAckTimeoutEnabled(bool enabled, size_t ack_timeout_delay_ms);
+
bool empty() const WARN_UNUSED_RESULT {
return touch_queue_.empty();
}
- bool no_touch_to_renderer() const {
- return no_touch_to_renderer_;
+ size_t size() const {
+ return touch_queue_.size();
+ }
+
+ bool ack_timeout_enabled() const {
+ return ack_timeout_enabled_;
}
private:
+ class TouchTimeoutHandler;
+ friend class TouchTimeoutHandler;
friend class TouchEventQueueTest;
- size_t GetQueueSize() const;
- const TouchEventWithLatencyInfo& GetLatestEvent() const;
+ bool HasTimeoutEvent() const;
+ bool IsTimeoutRunningForTesting() const;
+ const TouchEventWithLatencyInfo& GetLatestEventForTesting() const;
// Walks the queue, checking each event for |ShouldForwardToRenderer()|.
// If true, forwards the touch event and stops processing further events.
@@ -92,6 +102,10 @@ class CONTENT_EXPORT TouchEventQueue {
const ui::LatencyInfo& renderer_latency_info);
bool ShouldForwardToRenderer(const blink::WebTouchEvent& event) const;
+ void ForwardToRenderer(const TouchEventWithLatencyInfo& event);
+ void UpdateTouchAckStates(const blink::WebTouchEvent& event,
+ InputEventAckState ack_result);
+
// Handles touch event forwarding and ack'ed event dispatch.
TouchEventQueueClient* client_;
@@ -108,11 +122,21 @@ class CONTENT_EXPORT TouchEventQueue {
// is being dispatched.
CoalescedWebTouchEvent* dispatching_touch_ack_;
- // Don't send touch events to renderer. This is enabled when the page
- // is scrolling. This behaviour is currently enabled only on aura behind
- // a flag.
+ // Used to prevent touch timeout scheduling if we receive a synchronous
+ // ack after forwarding a touch event to the client.
+ bool dispatching_touch_;
+
+ // Don't send touch events to the renderer while scrolling.
bool no_touch_to_renderer_;
+ // Whether an event in the current (multi)touch sequence was consumed by the
+ // renderer. The touch timeout will never be activated when this is true.
+ bool renderer_is_consuming_touch_gesture_;
+
+ // Optional handler for timed-out touch event acks, disabled by default.
+ bool ack_timeout_enabled_;
+ scoped_ptr<TouchTimeoutHandler> timeout_handler_;
+
DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
};
« no previous file with comments | « content/browser/renderer_host/input/timeout_monitor.cc ('k') | content/browser/renderer_host/input/touch_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698