• Sahel Sharify's avatar
    Fixed fling regression from registering observer on GSB instead of GFS. · 0b48b62c
    Sahel Sharify authored
    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}
    0b48b62c
fling_scheduler_unittest.cc 5.68 KB