[Timer] Call DETACH_FROM_SEQUENCE() in AbandonScheduledTask()
Currently, DETACH_FROM_SEQUENCE() is unconditionally called in TimerBase::Stop(). This is wrong because of an optimization in the timer code that keeps the scheduled task in the task queue (see the kAlwaysAbandonScheduledTask feature). Using the timer on another sequence at that point can cause a race condition. Now, DETACH_FROM_SEQUENCE() is only called when the scheduled task is actually canceled. There were 2 cases where a timer was stopped and then deleted on another sequence, which was now DCHECK'ing in tests. Those 2 cases were changed to use AbandonAndStop(). This will not cause any noticeable difference in behavior because in both cases, the timer is never reused after it is stopped. Bug: 1262205 Change-Id: I9d236c037def96a3f20938b791fb18967263c749 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3381775 Reviewed-by:Francois Pierre Doray <fdoray@chromium.org> Reviewed-by:
Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Patrick Monette <pmonette@chromium.org> Cr-Commit-Position: refs/heads/main@{#958468}
Loading
Please register or sign in to comment