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

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

Issue 217163006: Defer synthetic gesture completions until events have been flushed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore browser test Created 6 years, 8 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_INPUT_ROUTER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 void SimulateTouchGestureWithMouse( 174 void SimulateTouchGestureWithMouse(
175 const MouseEventWithLatencyInfo& mouse_event); 175 const MouseEventWithLatencyInfo& mouse_event);
176 176
177 // Called when a touch timeout-affecting bit has changed, in turn toggling the 177 // Called when a touch timeout-affecting bit has changed, in turn toggling the
178 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input 178 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input
179 // to that determination includes current view properties, the allowed touch 179 // to that determination includes current view properties, the allowed touch
180 // action and the command-line configured |touch_ack_timeout_supported_|. 180 // action and the command-line configured |touch_ack_timeout_supported_|.
181 void UpdateTouchAckTimeoutEnabled(); 181 void UpdateTouchAckTimeoutEnabled();
182 182
183 // If a flush has been requested, signals a completed flush to the client if
184 // all events have been dispatched (i.e., |HasPendingEvents()| is false).
185 void SignalFlushedIfNecessary();
186
187 bool HasPendingEvents() const;
188
183 bool IsInOverscrollGesture() const; 189 bool IsInOverscrollGesture() const;
184 190
185 int routing_id() const { return routing_id_; } 191 int routing_id() const { return routing_id_; }
186 192
187 193
188 IPC::Sender* sender_; 194 IPC::Sender* sender_;
189 InputRouterClient* client_; 195 InputRouterClient* client_;
190 InputAckHandler* ack_handler_; 196 InputAckHandler* ack_handler_;
191 int routing_id_; 197 int routing_id_;
192 198
(...skipping 15 matching lines...) Expand all
208 214
209 // The next mouse move event to send (only non-null while mouse_move_pending_ 215 // The next mouse move event to send (only non-null while mouse_move_pending_
210 // is true). 216 // is true).
211 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_; 217 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_;
212 218
213 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent 219 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent
214 // and we are waiting for a corresponding ack. 220 // and we are waiting for a corresponding ack.
215 bool mouse_wheel_pending_; 221 bool mouse_wheel_pending_;
216 MouseWheelEventWithLatencyInfo current_wheel_event_; 222 MouseWheelEventWithLatencyInfo current_wheel_event_;
217 223
218 typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue;
219
220 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send. 224 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send.
221 // Unlike mouse moves, mouse wheel events received while one is pending are 225 // Unlike mouse moves, mouse wheel events received while one is pending are
222 // coalesced (by accumulating deltas) if they match the previous event in 226 // coalesced (by accumulating deltas) if they match the previous event in
223 // modifiers. On the Mac, in particular, mouse wheel events are received at a 227 // modifiers. On the Mac, in particular, mouse wheel events are received at a
224 // high rate; not waiting for the ack results in jankiness, and using the same 228 // high rate; not waiting for the ack results in jankiness, and using the same
225 // mechanism as for mouse moves (just dropping old events when multiple ones 229 // mechanism as for mouse moves (just dropping old events when multiple ones
226 // would be queued) results in very slow scrolling. 230 // would be queued) results in very slow scrolling.
231 typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue;
227 WheelEventQueue coalesced_mouse_wheel_events_; 232 WheelEventQueue coalesced_mouse_wheel_events_;
228 233
229 // The time when an input event was sent to the RenderWidget.
230 base::TimeTicks input_event_start_time_;
231
232 // Queue of keyboard events that we need to track.
233 typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
234
235 // A queue of keyboard events. We can't trust data from the renderer so we 234 // A queue of keyboard events. We can't trust data from the renderer so we
236 // stuff key events into a queue and pop them out on ACK, feeding our copy 235 // stuff key events into a queue and pop them out on ACK, feeding our copy
237 // back to whatever unhandled handler instead of the returned version. 236 // back to whatever unhandled handler instead of the returned version.
237 typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
238 KeyQueue key_queue_; 238 KeyQueue key_queue_;
239 239
240 // The time when an input event was sent to the client.
241 base::TimeTicks input_event_start_time_;
242
240 // Whether touch ack timeout handling has been enabled via the command line. 243 // Whether touch ack timeout handling has been enabled via the command line.
241 bool touch_ack_timeout_supported_; 244 bool touch_ack_timeout_supported_;
242 base::TimeDelta touch_ack_timeout_delay_; 245 base::TimeDelta touch_ack_timeout_delay_;
243 246
244 // Cached flags from |OnViewUpdated()|, defaults to 0. 247 // Cached flags from |OnViewUpdated()|, defaults to 0.
245 int current_view_flags_; 248 int current_view_flags_;
246 249
247 // The source of the ack within the scope of |ProcessInputEventAck()|. 250 // The source of the ack within the scope of |ProcessInputEventAck()|.
248 // Defaults to ACK_SOURCE_NONE. 251 // Defaults to ACK_SOURCE_NONE.
249 AckSource current_ack_source_; 252 AckSource current_ack_source_;
250 253
251 scoped_ptr<TouchEventQueue> touch_event_queue_; 254 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call
252 scoped_ptr<GestureEventQueue> gesture_event_queue_; 255 // to the client_ after all events have been dispatched/acked.
256 bool flush_requested_;
257
258 TouchEventQueue touch_event_queue_;
259 GestureEventQueue gesture_event_queue_;
253 TouchActionFilter touch_action_filter_; 260 TouchActionFilter touch_action_filter_;
254 InputEventStreamValidator event_stream_validator_; 261 InputEventStreamValidator event_stream_validator_;
255 262
256 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); 263 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl);
257 }; 264 };
258 265
259 } // namespace content 266 } // namespace content
260 267
261 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 268 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/gesture_event_queue.cc ('k') | content/browser/renderer_host/input/input_router_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698