| 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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 // main thread. Change back to DROP_EVENT once we have synchronization | 554 // main thread. Change back to DROP_EVENT once we have synchronization |
| 555 // bugs sorted out. | 555 // bugs sorted out. |
| 556 result = DID_NOT_HANDLE; | 556 result = DID_NOT_HANDLE; |
| 557 break; | 557 break; |
| 558 case cc::InputHandler::SCROLL_UNKNOWN: | 558 case cc::InputHandler::SCROLL_UNKNOWN: |
| 559 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: | 559 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: |
| 560 result = DID_NOT_HANDLE; | 560 result = DID_NOT_HANDLE; |
| 561 break; | 561 break; |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | |
| 565 // Send the event and its disposition to the elasticity controller to update | |
| 566 // the over-scroll animation. If the event is to be handled on the main | |
| 567 // thread, the event and its disposition will be sent to the elasticity | |
| 568 // controller after being handled on the main thread. | |
| 569 if (scroll_elasticity_controller_ && result != DID_NOT_HANDLE) { | |
| 570 // Note that the call to the elasticity controller is made asynchronously, | |
| 571 // to minimize divergence between main thread and impl thread event | |
| 572 // handling paths. | |
| 573 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 574 FROM_HERE, | |
| 575 base::Bind(&InputScrollElasticityController::ObserveWheelEventAndResult, | |
| 576 scroll_elasticity_controller_->GetWeakPtr(), wheel_event, | |
| 577 scroll_result)); | |
| 578 } | |
| 579 return result; | 564 return result; |
| 580 } | 565 } |
| 581 | 566 |
| 582 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin( | 567 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin( |
| 583 const WebGestureEvent& gesture_event) { | 568 const WebGestureEvent& gesture_event) { |
| 584 if (gesture_scroll_on_impl_thread_) | 569 if (gesture_scroll_on_impl_thread_) |
| 585 CancelCurrentFling(); | 570 CancelCurrentFling(); |
| 586 | 571 |
| 587 #ifndef NDEBUG | 572 #ifndef NDEBUG |
| 588 DCHECK(!expect_scroll_update_end_); | 573 DCHECK(!expect_scroll_update_end_); |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 // is made asynchronously, to minimize divergence between main thread and | 1340 // is made asynchronously, to minimize divergence between main thread and |
| 1356 // impl thread event handling paths. | 1341 // impl thread event handling paths. |
| 1357 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1342 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1358 FROM_HERE, | 1343 FROM_HERE, |
| 1359 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1344 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
| 1360 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1345 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1361 scroll_result)); | 1346 scroll_result)); |
| 1362 } | 1347 } |
| 1363 | 1348 |
| 1364 } // namespace ui | 1349 } // namespace ui |
| OLD | NEW |