[Animation Worklet] Ensure dispatcher's done callback always runs
Previously it was possible for the AnimationWorkletMutatorDispatcherImpl::MutateSynchronously to wait indefinitely and hang if the worklet task runner didn't execute the posted mutation task. (I suspect this would happen if task is posted during the worklet thread shutdown process) In fact, this condition would occur occasionally when running our tests and causing the content_shell to hang and test to timeout which lead to the test flakiness. This fix ensures the done closure is guaranteed to run even when destination task runner drops it. This is achieved by using base::ScopedClosureRunner which runs the closure on destruction if not run already. TEST: Locally running the tests no longer produces the hang. TEST: AnimationWorkletMutatorDispatcherImplTest.DispatcherShouldNotHangWhenMutatorGoesAway Bug: 930462 Change-Id: Ie35ab9c2072d71c301d304b10e0cf15c3d6616da Reviewed-on: https://chromium-review.googlesource.com/c/1477960 Commit-Queue: Majid Valipour <majidvp@chromium.org> Reviewed-by:Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#634334}
Showing
Please register or sign in to comment