Chromium Code Reviews| Index: base/timer/timer.cc |
| diff --git a/base/timer/timer.cc b/base/timer/timer.cc |
| index abcd70aefa1c31212945b01867e6c039c27a3b9e..1f6efcc7e3db704b60f2740f36e92b277734f1fd 100644 |
| --- a/base/timer/timer.cc |
| +++ b/base/timer/timer.cc |
| @@ -99,8 +99,7 @@ Timer::Timer(const tracked_objects::Location& posted_from, |
| } |
| Timer::~Timer() { |
| - // TODO(gab): Enable this once Stop() properly detaches from sequence. |
| - // DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
| + DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
| AbandonAndStop(); |
| } |
| @@ -144,6 +143,10 @@ void Timer::Stop() { |
| // DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
| is_running_ = false; |
| + |
| + // It's safe to destroy or restart Timer on another sequence after Stop(). |
|
danakj
2017/06/06 20:07:12
Did you intentionally do this before running the u
gab
2017/06/07 13:28:54
Yes, see comment at the end of this method, it's n
|
| + origin_sequence_checker_.DetachFromSequence(); |
| + |
| if (!retain_user_task_) |
| user_task_.Reset(); |
| // No more member accesses here: |this| could be deleted after freeing |