| Index: content/browser/renderer_host/input/synthetic_gesture_controller.cc
|
| diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller.cc b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
|
| index 57b3af0e1af0cbcf40d8dd7122fb16e3b5067f4b..8314d948ba751c5776816c29fc3c86dd567c2700 100644
|
| --- a/content/browser/renderer_host/input/synthetic_gesture_controller.cc
|
| +++ b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
|
| @@ -36,16 +36,34 @@ void SyntheticGestureController::Flush(base::TimeTicks timestamp) {
|
| if (pending_gesture_queue_.IsEmpty())
|
| return;
|
|
|
| + if (pending_gesture_result_)
|
| + return;
|
| +
|
| SyntheticGesture* gesture = pending_gesture_queue_.FrontGesture();
|
| - SyntheticGesture::Result result = gesture->ForwardInputEvents(timestamp,
|
| - gesture_target_.get());
|
| + SyntheticGesture::Result result =
|
| + gesture->ForwardInputEvents(timestamp, gesture_target_.get());
|
|
|
| if (result == SyntheticGesture::GESTURE_RUNNING) {
|
| gesture_target_->SetNeedsFlush();
|
| return;
|
| }
|
|
|
| - StopGesture(*gesture, pending_gesture_queue_.FrontCallback(), result);
|
| + // It's possible that all events generated by the gesture have been fully
|
| + // dispatched at this point, in which case |OnDidFlushInput()| was called
|
| + // before |pending_gesture_result_| was initialized. Requesting another flush
|
| + // will trigger the necessary gesture-ending call to |OnDidFlushInput()|.
|
| + pending_gesture_result_.reset(new SyntheticGesture::Result(result));
|
| + gesture_target_->SetNeedsFlush();
|
| +}
|
| +
|
| +void SyntheticGestureController::OnDidFlushInput() {
|
| + if (!pending_gesture_result_)
|
| + return;
|
| +
|
| + DCHECK(!pending_gesture_queue_.IsEmpty());
|
| + StopGesture(*pending_gesture_queue_.FrontGesture(),
|
| + pending_gesture_queue_.FrontCallback(),
|
| + *pending_gesture_result_.Pass());
|
| pending_gesture_queue_.Pop();
|
|
|
| if (!pending_gesture_queue_.IsEmpty())
|
|
|