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

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

Issue 1113143002: Restore simple fling status bookkeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Controls touchpad-related tap suppression, disabled by default. 66 // Controls touchpad-related tap suppression, disabled by default.
67 TapSuppressionController::Config touchpad_tap_suppression_config; 67 TapSuppressionController::Config touchpad_tap_suppression_config;
68 68
69 // Controls touchscreen-related tap suppression, disabled by default. 69 // Controls touchscreen-related tap suppression, disabled by default.
70 TapSuppressionController::Config touchscreen_tap_suppression_config; 70 TapSuppressionController::Config touchscreen_tap_suppression_config;
71 71
72 // Determines whether non-scroll gesture events are "debounced" during an 72 // Determines whether non-scroll gesture events are "debounced" during an
73 // active scroll sequence, suppressing brief scroll interruptions. 73 // active scroll sequence, suppressing brief scroll interruptions.
74 // Zero by default (disabled). 74 // Zero by default (disabled).
75 base::TimeDelta debounce_interval; 75 base::TimeDelta debounce_interval;
76
77 // Whether to filter unnecessary GestureFlingCancel events. Filtering should
78 // be disabled if there may be content-targetting fling curves about which
79 // the renderer is unaware (e.g., with Android WebView).
80 // True by default.
81 bool enable_fling_cancel_filtering;
82 }; 76 };
83 77
84 // Both |client| and |touchpad_client| must outlive the GestureEventQueue. 78 // Both |client| and |touchpad_client| must outlive the GestureEventQueue.
85 GestureEventQueue(GestureEventQueueClient* client, 79 GestureEventQueue(GestureEventQueueClient* client,
86 TouchpadTapSuppressionControllerClient* touchpad_client, 80 TouchpadTapSuppressionControllerClient* touchpad_client,
87 const Config& config); 81 const Config& config);
88 ~GestureEventQueue(); 82 ~GestureEventQueue();
89 83
90 // Adds a gesture to the queue if it passes the relevant filters. If 84 // Adds a gesture to the queue if it passes the relevant filters. If
91 // there are no events currently queued, the event will be forwarded 85 // there are no events currently queued, the event will be forwarded
92 // immediately. 86 // immediately.
93 void QueueEvent(const GestureEventWithLatencyInfo&); 87 void QueueEvent(const GestureEventWithLatencyInfo&);
94 88
95 // Indicates that the caller has received an acknowledgement from the renderer 89 // Indicates that the caller has received an acknowledgement from the renderer
96 // with state |ack_result| and event |type|. May send events if the queue is 90 // with state |ack_result| and event |type|. May send events if the queue is
97 // not empty. 91 // not empty.
98 void ProcessGestureAck(InputEventAckState ack_result, 92 void ProcessGestureAck(InputEventAckState ack_result,
99 blink::WebInputEvent::Type type, 93 blink::WebInputEvent::Type type,
100 const ui::LatencyInfo& latency); 94 const ui::LatencyInfo& latency);
101 95
102 // Notify the queue that a gesture fling animation in the renderer has ended. 96 // Sets the state of the |fling_in_progress_| field to indicate that a fling
103 void DidStopFlinging(); 97 // is definitely not in progress.
98 void FlingHasBeenHalted();
104 99
105 // Returns the |TouchpadTapSuppressionController| instance. 100 // Returns the |TouchpadTapSuppressionController| instance.
106 TouchpadTapSuppressionController* GetTouchpadTapSuppressionController(); 101 TouchpadTapSuppressionController* GetTouchpadTapSuppressionController();
107 102
108 void ForwardGestureEvent(const GestureEventWithLatencyInfo& gesture_event); 103 void ForwardGestureEvent(const GestureEventWithLatencyInfo& gesture_event);
109 104
110 bool empty() const { 105 bool empty() const {
111 return coalesced_gesture_events_.empty() && 106 return coalesced_gesture_events_.empty() &&
112 debouncing_deferral_queue_.empty(); 107 debouncing_deferral_queue_.empty();
113 } 108 }
114 109
115 int active_fling_count() const { return active_fling_count_; }
116
117 void set_debounce_interval_time_ms_for_testing(int interval_ms) { 110 void set_debounce_interval_time_ms_for_testing(int interval_ms) {
118 debounce_interval_ = base::TimeDelta::FromMilliseconds(interval_ms); 111 debounce_interval_ = base::TimeDelta::FromMilliseconds(interval_ms);
119 } 112 }
120 113
121 private: 114 private:
122 friend class GestureEventQueueTest; 115 friend class GestureEventQueueTest;
123 friend class MockRenderWidgetHost; 116 friend class MockRenderWidgetHost;
124 117
125 // TODO(mohsen): There are a bunch of ShouldForward.../ShouldDiscard... 118 // TODO(mohsen): There are a bunch of ShouldForward.../ShouldDiscard...
126 // methods that are getting confusing. This should be somehow fixed. Maybe 119 // methods that are getting confusing. This should be somehow fixed. Maybe
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void QueueScrollOrPinchAndForwardIfNecessary( 151 void QueueScrollOrPinchAndForwardIfNecessary(
159 const GestureEventWithLatencyInfo& gesture_event); 152 const GestureEventWithLatencyInfo& gesture_event);
160 153
161 // The number of sent events for which we're awaiting an ack. These events 154 // The number of sent events for which we're awaiting an ack. These events
162 // remain at the head of the queue until ack'ed. 155 // remain at the head of the queue until ack'ed.
163 size_t EventsInFlightCount() const; 156 size_t EventsInFlightCount() const;
164 157
165 // The receiver of all forwarded gesture events. 158 // The receiver of all forwarded gesture events.
166 GestureEventQueueClient* client_; 159 GestureEventQueueClient* client_;
167 160
168 // Whether to filter unnecessary GestureFlingCancel events. 161 // True if a GestureFlingStart is in progress on the renderer or
169 bool enable_fling_cancel_filtering_; 162 // queued without a subsequent queued GestureFlingCancel event.
170 163 bool fling_in_progress_;
171 // Whether there are any active flings in the renderer. As the fling
172 // end notification is asynchronous, we use a count rather than a boolean
173 // to avoid races in bookkeeping when starting a new fling.
174 int active_fling_count_;
175 164
176 // True if a GestureScrollUpdate sequence is in progress. 165 // True if a GestureScrollUpdate sequence is in progress.
177 bool scrolling_in_progress_; 166 bool scrolling_in_progress_;
178 167
179 // True if two related gesture events were sent before without waiting 168 // True if two related gesture events were sent before without waiting
180 // for an ACK, so the next gesture ACK should be ignored. 169 // for an ACK, so the next gesture ACK should be ignored.
181 bool ignore_next_ack_; 170 bool ignore_next_ack_;
182 171
183 // An object tracking the state of touchpad on the delivery of mouse events to 172 // An object tracking the state of touchpad on the delivery of mouse events to
184 // the renderer to filter mouse immediately after a touchpad fling canceling 173 // the renderer to filter mouse immediately after a touchpad fling canceling
(...skipping 26 matching lines...) Expand all
211 // Time window in which to debounce scroll/fling ends. Note that an interval 200 // Time window in which to debounce scroll/fling ends. Note that an interval
212 // of zero effectively disables debouncing. 201 // of zero effectively disables debouncing.
213 base::TimeDelta debounce_interval_; 202 base::TimeDelta debounce_interval_;
214 203
215 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); 204 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue);
216 }; 205 };
217 206
218 } // namespace content 207 } // namespace content
219 208
220 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ 209 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.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