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

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

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: Add an ack type for async touch move 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TOUCH_EVENT_QUEUE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // single touch-move event). The event may also be immediately forwarded to 59 // single touch-move event). The event may also be immediately forwarded to
60 // the renderer (e.g. when there are no other queued touch event). 60 // the renderer (e.g. when there are no other queued touch event).
61 void QueueEvent(const TouchEventWithLatencyInfo& event); 61 void QueueEvent(const TouchEventWithLatencyInfo& event);
62 62
63 // Notifies the queue that a touch-event has been processed by the renderer. 63 // Notifies the queue that a touch-event has been processed by the renderer.
64 // At this point, the queue may send one or more gesture events and/or 64 // At this point, the queue may send one or more gesture events and/or
65 // additional queued touch-events to the renderer. 65 // additional queued touch-events to the renderer.
66 void ProcessTouchAck(InputEventAckState ack_result, 66 void ProcessTouchAck(InputEventAckState ack_result,
67 const ui::LatencyInfo& latency_info); 67 const ui::LatencyInfo& latency_info);
68 68
69 void ProcessAsyncTouchAck();
tdresser 2015/03/23 19:21:44 This should probably be ProcessUncancelableTouchAc
lanwei 2015/03/24 18:46:38 Done.
70
69 // When GestureScrollBegin is received, we send a touch cancel to renderer, 71 // When GestureScrollBegin is received, we send a touch cancel to renderer,
70 // route all the following touch events directly to client, and ignore the 72 // route all the following touch events directly to client, and ignore the
71 // ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received, 73 // ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received,
72 // resume the normal flow of sending touch events to the renderer. 74 // resume the normal flow of sending touch events to the renderer.
73 void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); 75 void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event);
74 76
75 void OnGestureEventAck( 77 void OnGestureEventAck(
76 const GestureEventWithLatencyInfo& event, 78 const GestureEventWithLatencyInfo& event,
77 InputEventAckState ack_result); 79 InputEventAckState ack_result);
78 80
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Suppression of TouchMove's within a slop region when a sequence has not yet 196 // Suppression of TouchMove's within a slop region when a sequence has not yet
195 // been preventDefaulted. 197 // been preventDefaulted.
196 scoped_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_; 198 scoped_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_;
197 199
198 // Whether touch events should remain buffered and dispatched asynchronously 200 // Whether touch events should remain buffered and dispatched asynchronously
199 // while a scroll sequence is active. In this mode, touchmove's are throttled 201 // while a scroll sequence is active. In this mode, touchmove's are throttled
200 // and ack'ed immediately, but remain buffered in |pending_async_touchmove_| 202 // and ack'ed immediately, but remain buffered in |pending_async_touchmove_|
201 // until a sufficient time period has elapsed since the last sent touch event. 203 // until a sufficient time period has elapsed since the last sent touch event.
202 // For details see the design doc at http://goo.gl/lVyJAa. 204 // For details see the design doc at http://goo.gl/lVyJAa.
203 bool send_touch_events_async_; 205 bool send_touch_events_async_;
206
207 // Whether we receive an ack from render for async touch move event.
208 bool receive_async_touch_move_ack_;
tdresser 2015/03/23 19:21:44 Can you clarify this comment? When wouldn't we rec
lanwei 2015/03/24 18:46:38 Done.
204 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_; 209 scoped_ptr<TouchEventWithLatencyInfo> pending_async_touchmove_;
210
211 // Once this value is greater than 0, which means we should ignore the
212 // following ignore_ack_ numbers of acks from render for async touch moves.
213 int ignore_ack_;
tdresser 2015/03/23 19:21:44 The variable name here should indicate that this i
lanwei 2015/03/24 18:46:38 Done.
214
215 // Count the number of aysnc touch moves sent out are waiting for their ack
tdresser 2015/03/23 19:21:44 Fix spelling "aysnc"
lanwei 2015/03/24 18:46:38 Done.
216 // back from render.
217 int sent_async_touch_move_count_;
205 double last_sent_touch_timestamp_sec_; 218 double last_sent_touch_timestamp_sec_;
206 219
207 // Event is saved to compare pointer positions for new touchmove events. 220 // Event is saved to compare pointer positions for new touchmove events.
208 scoped_ptr<blink::WebTouchEvent> last_sent_touchevent_; 221 scoped_ptr<blink::WebTouchEvent> last_sent_touchevent_;
209 222
210 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); 223 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
211 }; 224 };
212 225
213 } // namespace content 226 } // namespace content
214 227
215 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ 228 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698