Commit 0b48b62c authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

Fixed fling regression from registering observer on GSB instead of GFS.

This cl resolves the regression that is caused by the following cl:
https://chromium-review.googlesource.com/c/chromium/src/+/1313270

The previous cl calls UnregisterFlingSchedulerObserver() twice when a
fling gets cancelled: once from gesture_event_queue while handling the
generated GSE and once from FlingScheduler::DidStopFlingingOnBrowser.

When there is only one active fling and the fling is not interrupted by
another scroll/fling this works fine since the second Unregister call
does nothing. However sometimes when a new fling replaces an active fling
(e.g. starting a fling in the opposite direction of the currently active
fling) the second Unregister call unregisters the observer that is added
for the new fling. Since the observer is unregistered for the new fling
no ProgressFling will get called till the user does a third fling.
on the first ProgressFling call for the third fling, the controller tries
to cancel the second fling and calls unregister which unregisters the
observer for the third fling and the same thing happens for the rest of
the flings from now on.

This cl fixes the issue by not calling UnregisterFlingSchedulerObserver()
in FlingScheduler::DidStopFlingingOnBrowser since it will get called once
the generated GSE of the fling cancel is processed.

Bug: 901831
Change-Id: I4d52f512ea38764fc64c580f6cac5ed4a32c1bee
Reviewed-on: https://chromium-review.googlesource.com/c/1327145Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606606}
parent ec359a9f
...@@ -59,7 +59,6 @@ void FlingScheduler::UnregisterFlingSchedulerObserver() { ...@@ -59,7 +59,6 @@ void FlingScheduler::UnregisterFlingSchedulerObserver() {
} }
void FlingScheduler::DidStopFlingingOnBrowser() { void FlingScheduler::DidStopFlingingOnBrowser() {
UnregisterFlingSchedulerObserver();
host_->DidStopFlinging(); host_->DidStopFlinging();
} }
......
...@@ -54,7 +54,6 @@ void FlingSchedulerAndroid::UnregisterFlingSchedulerObserver() { ...@@ -54,7 +54,6 @@ void FlingSchedulerAndroid::UnregisterFlingSchedulerObserver() {
} }
void FlingSchedulerAndroid::DidStopFlingingOnBrowser() { void FlingSchedulerAndroid::DidStopFlingingOnBrowser() {
UnregisterFlingSchedulerObserver();
host_->DidStopFlinging(); host_->DidStopFlinging();
} }
......
...@@ -103,7 +103,12 @@ class FlingSchedulerTest : public testing::Test, ...@@ -103,7 +103,12 @@ class FlingSchedulerTest : public testing::Test,
void SendGeneratedWheelEvent( void SendGeneratedWheelEvent(
const MouseWheelEventWithLatencyInfo& wheel_event) override {} const MouseWheelEventWithLatencyInfo& wheel_event) override {}
void SendGeneratedGestureScrollEvents( void SendGeneratedGestureScrollEvents(
const GestureEventWithLatencyInfo& gesture_event) override {} const GestureEventWithLatencyInfo& gesture_event) override {
if (gesture_event.event.GetType() ==
blink::WebInputEvent::kGestureScrollEnd) {
fling_controller_->UnregisterFlingSchedulerObserver();
}
}
std::unique_ptr<FlingController> fling_controller_; std::unique_ptr<FlingController> fling_controller_;
std::unique_ptr<FakeFlingScheduler> fling_scheduler_; std::unique_ptr<FakeFlingScheduler> fling_scheduler_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment