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

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

Issue 16114003: Don't send touch move to renderer while scrolling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix the case touch event queue could be empty when GetLatestEvent() is called Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TOUCH_EVENT_QUEUE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 10
(...skipping 19 matching lines...) Expand all
30 // queued events (e.g. consecutive touch-move events can be coalesced into a 30 // queued events (e.g. consecutive touch-move events can be coalesced into a
31 // single touch-move event). The event may also be immediately forwarded to 31 // single touch-move event). The event may also be immediately forwarded to
32 // the renderer (e.g. when there are no other queued touch event). 32 // the renderer (e.g. when there are no other queued touch event).
33 void QueueEvent(const TouchEventWithLatencyInfo& event); 33 void QueueEvent(const TouchEventWithLatencyInfo& event);
34 34
35 // Notifies the queue that a touch-event has been processed by the renderer. 35 // Notifies the queue that a touch-event has been processed by the renderer.
36 // At this point, the queue may send one or more gesture events and/or 36 // At this point, the queue may send one or more gesture events and/or
37 // additional queued touch-events to the renderer. 37 // additional queued touch-events to the renderer.
38 void ProcessTouchAck(InputEventAckState ack_result); 38 void ProcessTouchAck(InputEventAckState ack_result);
39 39
40 // On receiving the first GestureScrollUpdate, flushes any touch events in
41 // the queue to view, sends a touch cancel event to the renderer immediately,
42 // and then resets the event queue so as not to process the acked touch cancel
43 // event.
44 void OnGestureScrollStart();
45
40 // Empties the queue of touch events. This may result in any number of gesture 46 // Empties the queue of touch events. This may result in any number of gesture
41 // events being sent to the renderer. 47 // events being sent to the renderer.
42 void FlushQueue(); 48 void FlushQueue();
43 49
44 // Resets all internal state. This does not trigger any touch or gesture 50 // Resets all internal state. This does not trigger any touch or gesture
45 // events to be sent. 51 // events to be sent.
46 void Reset(); 52 void Reset();
47 53
48 // Returns whether the event-queue is empty. 54 // Returns whether the event-queue is empty.
49 bool empty() const WARN_UNUSED_RESULT { 55 bool empty() const WARN_UNUSED_RESULT {
(...skipping 11 matching lines...) Expand all
61 void PopTouchEventToView(InputEventAckState ack_result); 67 void PopTouchEventToView(InputEventAckState ack_result);
62 68
63 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const; 69 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const;
64 70
65 // The RenderWidgetHost that owns this event-queue. 71 // The RenderWidgetHost that owns this event-queue.
66 RenderWidgetHostImpl* render_widget_host_; 72 RenderWidgetHostImpl* render_widget_host_;
67 73
68 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; 74 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue;
69 TouchQueue touch_queue_; 75 TouchQueue touch_queue_;
70 76
77 TouchEventWithLatencyInfo latest_event_;
78
71 // Maintain the ACK status for each touch point. 79 // Maintain the ACK status for each touch point.
72 typedef std::map<int, InputEventAckState> TouchPointAckStates; 80 typedef std::map<int, InputEventAckState> TouchPointAckStates;
73 TouchPointAckStates touch_ack_states_; 81 TouchPointAckStates touch_ack_states_;
74 82
75 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); 83 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
76 }; 84 };
77 85
78 } // namespace content 86 } // namespace content
79 87
80 #endif // CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_ 88 #endif // CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698