Skip to content
Commit d4e29009 authored by Patrick Monette's avatar Patrick Monette Committed by Chromium LUCI CQ
Browse files

[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: default avatarFrancois Pierre Doray <fdoray@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#958468}
parent 8cbd9d5b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment