| OLD | NEW |
| 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 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 9 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 9 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 SyntheticGesture* gesture = pending_gesture_queue_.FrontGesture(); | 42 SyntheticGesture* gesture = pending_gesture_queue_.FrontGesture(); |
| 43 SyntheticGesture::Result result = | 43 SyntheticGesture::Result result = |
| 44 gesture->ForwardInputEvents(timestamp, gesture_target_.get()); | 44 gesture->ForwardInputEvents(timestamp, gesture_target_.get()); |
| 45 | 45 |
| 46 if (result == SyntheticGesture::GESTURE_RUNNING) { | 46 if (result == SyntheticGesture::GESTURE_RUNNING) { |
| 47 gesture_target_->SetNeedsFlush(); | 47 gesture_target_->SetNeedsFlush(); |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // It's possible that all events generated by the gesture have been fully | 51 // It's possible that all events generated by the gesture have been fully |
| 52 // dispatched at this point, in which case |OnDidFlushInput()| was called | 52 // dispatched at this point, in which case |OnDidFlushAllInput()| was called |
| 53 // before |pending_gesture_result_| was initialized. Requesting another flush | 53 // before |pending_gesture_result_| was initialized. Requesting another flush |
| 54 // will trigger the necessary gesture-ending call to |OnDidFlushInput()|. | 54 // will trigger the necessary gesture-ending call to |OnDidFlushAllInput()|. |
| 55 pending_gesture_result_.reset(new SyntheticGesture::Result(result)); | 55 pending_gesture_result_.reset(new SyntheticGesture::Result(result)); |
| 56 gesture_target_->SetNeedsFlush(); | 56 gesture_target_->SetNeedsFlush(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SyntheticGestureController::OnDidFlushInput() { | 59 void SyntheticGestureController::OnDidFlushAllInput() { |
| 60 if (!pending_gesture_result_) | 60 if (!pending_gesture_result_) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 DCHECK(!pending_gesture_queue_.IsEmpty()); | 63 DCHECK(!pending_gesture_queue_.IsEmpty()); |
| 64 auto pending_gesture_result = pending_gesture_result_.Pass(); | 64 auto pending_gesture_result = pending_gesture_result_.Pass(); |
| 65 StopGesture(*pending_gesture_queue_.FrontGesture(), | 65 StopGesture(*pending_gesture_queue_.FrontGesture(), |
| 66 pending_gesture_queue_.FrontCallback(), | 66 pending_gesture_queue_.FrontCallback(), |
| 67 *pending_gesture_result); | 67 *pending_gesture_result); |
| 68 pending_gesture_queue_.Pop(); | 68 pending_gesture_queue_.Pop(); |
| 69 | 69 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() { | 93 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() { |
| 94 } | 94 } |
| 95 | 95 |
| 96 SyntheticGestureController::GestureAndCallbackQueue:: | 96 SyntheticGestureController::GestureAndCallbackQueue:: |
| 97 ~GestureAndCallbackQueue() { | 97 ~GestureAndCallbackQueue() { |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace content | 100 } // namespace content |
| OLD | NEW |