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

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

Issue 130993003: Prevent partial touch sequences from reaching the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Name cleanup Created 6 years, 11 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 size_t size() const { 76 size_t size() const {
77 return touch_queue_.size(); 77 return touch_queue_.size();
78 } 78 }
79 79
80 bool ack_timeout_enabled() const { 80 bool ack_timeout_enabled() const {
81 return ack_timeout_enabled_; 81 return ack_timeout_enabled_;
82 } 82 }
83 83
84 bool has_handlers() const { 84 bool has_handlers() const {
85 return has_handlers_; 85 return touch_filtering_state_ != DROP_ALL_TOUCHES;
86 } 86 }
87 87
88 private: 88 private:
89 class TouchTimeoutHandler; 89 class TouchTimeoutHandler;
90 friend class TouchTimeoutHandler; 90 friend class TouchTimeoutHandler;
91 friend class TouchEventQueueTest; 91 friend class TouchEventQueueTest;
92 92
93 bool HasTimeoutEvent() const; 93 bool HasTimeoutEvent() const;
94 bool IsTimeoutRunningForTesting() const; 94 bool IsTimeoutRunningForTesting() const;
95 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; 95 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const;
(...skipping 30 matching lines...) Expand all
126 126
127 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. 127 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|.
128 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack 128 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack
129 // is being dispatched. 129 // is being dispatched.
130 CoalescedWebTouchEvent* dispatching_touch_ack_; 130 CoalescedWebTouchEvent* dispatching_touch_ack_;
131 131
132 // Used to prevent touch timeout scheduling if we receive a synchronous 132 // Used to prevent touch timeout scheduling if we receive a synchronous
133 // ack after forwarding a touch event to the client. 133 // ack after forwarding a touch event to the client.
134 bool dispatching_touch_; 134 bool dispatching_touch_;
135 135
136 // Whether there are any registered touch handlers. Defaults to false. 136 enum TouchFilteringState {
137 bool has_handlers_; 137 FORWARD_ALL_TOUCHES, // Don't filter at all - the default.
138 138 FORWARD_TOUCHES_UNTIL_TIMEOUT, // Don't filter unless we get an ACK timeout.
139 // Don't send touch events to the renderer while scrolling. 139 DROP_TOUCHES_IN_SEQUENCE, // Filter all events until a new touch
140 bool scroll_in_progress_; 140 // sequence is received.
141 141 DROP_ALL_TOUCHES, // Filter all events, e.g., no touch handler.
142 // Whether an event in the current (multi)touch sequence was consumed by the 142 TOUCH_FILTERING_STATE_DEFAULT = FORWARD_ALL_TOUCHES,
143 // renderer. The touch timeout will never be activated when this is true. 143 };
144 bool renderer_is_consuming_touch_gesture_; 144 TouchFilteringState touch_filtering_state_;
145 145
146 // Optional handler for timed-out touch event acks, disabled by default. 146 // Optional handler for timed-out touch event acks, disabled by default.
147 bool ack_timeout_enabled_; 147 bool ack_timeout_enabled_;
148 scoped_ptr<TouchTimeoutHandler> timeout_handler_; 148 scoped_ptr<TouchTimeoutHandler> timeout_handler_;
149 149
150 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); 150 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
151 }; 151 };
152 152
153 } // namespace content 153 } // namespace content
154 154
155 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ 155 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698