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

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue.h

Issue 291003002: Move OverscrollController to RenderWidgetHostViewAura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK_GE Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 22 matching lines...) Expand all
33 virtual void SendGestureEventImmediately( 33 virtual void SendGestureEventImmediately(
34 const GestureEventWithLatencyInfo& event) = 0; 34 const GestureEventWithLatencyInfo& event) = 0;
35 35
36 virtual void OnGestureEventAck( 36 virtual void OnGestureEventAck(
37 const GestureEventWithLatencyInfo& event, 37 const GestureEventWithLatencyInfo& event,
38 InputEventAckState ack_result) = 0; 38 InputEventAckState ack_result) = 0;
39 }; 39 };
40 40
41 // Maintains WebGestureEvents in a queue before forwarding them to the renderer 41 // Maintains WebGestureEvents in a queue before forwarding them to the renderer
42 // to apply a sequence of filters on them: 42 // to apply a sequence of filters on them:
43 // 1. Zero-velocity fling-starts from touchpad are filtered. 43 // 1. The sequence is filtered for bounces. A bounce is when the finger lifts
44 // 2. The sequence is filtered for bounces. A bounce is when the finger lifts
45 // from the screen briefly during an in-progress scroll. Ifco this happens, 44 // from the screen briefly during an in-progress scroll. Ifco this happens,
46 // non-GestureScrollUpdate events are queued until the de-bounce interval 45 // non-GestureScrollUpdate events are queued until the de-bounce interval
47 // passes or another GestureScrollUpdate event occurs. 46 // passes or another GestureScrollUpdate event occurs.
48 // 3. Unnecessary GestureFlingCancel events are filtered. These are 47 // 2. Unnecessary GestureFlingCancel events are filtered. These are
49 // GestureFlingCancels that have no corresponding GestureFlingStart in the 48 // GestureFlingCancels that have no corresponding GestureFlingStart in the
50 // queue. 49 // queue.
51 // 4. Taps immediately after a GestureFlingCancel (caused by the same tap) are 50 // 3. Taps immediately after a GestureFlingCancel (caused by the same tap) are
52 // filtered. 51 // filtered.
53 // 5. Whenever possible, events in the queue are coalesced to have as few events 52 // 4. Whenever possible, events in the queue are coalesced to have as few events
54 // as possible and therefore maximize the chance that the event stream can be 53 // as possible and therefore maximize the chance that the event stream can be
55 // handled entirely by the compositor thread. 54 // handled entirely by the compositor thread.
56 // Events in the queue are forwarded to the renderer one by one; i.e., each 55 // Events in the queue are forwarded to the renderer one by one; i.e., each
57 // event is sent after receiving the ACK for previous one. The only exception is 56 // event is sent after receiving the ACK for previous one. The only exception is
58 // that if a GestureScrollUpdate is followed by a GesturePinchUpdate, they are 57 // that if a GestureScrollUpdate is followed by a GesturePinchUpdate, they are
59 // sent together. 58 // sent together.
60 // TODO(rjkroege): Possibly refactor into a filter chain: 59 // TODO(rjkroege): Possibly refactor into a filter chain:
61 // http://crbug.com/148443. 60 // http://crbug.com/148443.
62 class CONTENT_EXPORT GestureEventQueue { 61 class CONTENT_EXPORT GestureEventQueue {
63 public: 62 public:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 134
136 // Returns |true| if the only event in the queue is the current event and 135 // Returns |true| if the only event in the queue is the current event and
137 // hence that event should be handled now. 136 // hence that event should be handled now.
138 bool ShouldHandleEventNow() const; 137 bool ShouldHandleEventNow() const;
139 138
140 // Merge or append a GestureScrollUpdate or GesturePinchUpdate into 139 // Merge or append a GestureScrollUpdate or GesturePinchUpdate into
141 // the coalescing queue. 140 // the coalescing queue.
142 void MergeOrInsertScrollAndPinchEvent( 141 void MergeOrInsertScrollAndPinchEvent(
143 const GestureEventWithLatencyInfo& gesture_event); 142 const GestureEventWithLatencyInfo& gesture_event);
144 143
145 // Sub-filter for removing zero-velocity fling-starts from touchpad.
146 bool ShouldForwardForZeroVelocityFlingStart(
147 const GestureEventWithLatencyInfo& gesture_event) const;
148
149 // Sub-filter for removing bounces from in-progress scrolls. 144 // Sub-filter for removing bounces from in-progress scrolls.
150 bool ShouldForwardForBounceReduction( 145 bool ShouldForwardForBounceReduction(
151 const GestureEventWithLatencyInfo& gesture_event); 146 const GestureEventWithLatencyInfo& gesture_event);
152 147
153 // Sub-filter for removing unnecessary GestureFlingCancels. 148 // Sub-filter for removing unnecessary GestureFlingCancels.
154 bool ShouldForwardForGFCFiltering( 149 bool ShouldForwardForGFCFiltering(
155 const GestureEventWithLatencyInfo& gesture_event) const; 150 const GestureEventWithLatencyInfo& gesture_event) const;
156 151
157 // Sub-filter for suppressing taps immediately after a GestureFlingCancel. 152 // Sub-filter for suppressing taps immediately after a GestureFlingCancel.
158 bool ShouldForwardForTapSuppression( 153 bool ShouldForwardForTapSuppression(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Time window in which to debounce scroll/fling ends. Note that an interval 221 // Time window in which to debounce scroll/fling ends. Note that an interval
227 // of zero effectively disables debouncing. 222 // of zero effectively disables debouncing.
228 base::TimeDelta debounce_interval_; 223 base::TimeDelta debounce_interval_;
229 224
230 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); 225 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue);
231 }; 226 };
232 227
233 } // namespace content 228 } // namespace content
234 229
235 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ 230 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_delegate.cc ('k') | content/browser/renderer_host/input/gesture_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698