New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 918987 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 716187



Sign in to add a comment

base::Timer should actually cancel the delayed tasks that it posts

Project Member Reported by w...@chromium.org, Jan 4

Issue description

Internally the base::Timer variants post a delayed task to fire the timer.  If the Timer is deleted or stopped before that task executes then some internal state is cleared, to cause the task to be a no-op when it runs.

Instead of running no-op tasks, we should use e.g. CancelableClosure in the Timer implementation, to have internal Timer tasks properly cancelled as soon as they are no longer needed, and enable TaskScheduler/SequenceManager cancelled-task optimizations to be applied consistently.
 
Indeed, this is part of the things I want to fix as part of https://docs.google.com/document/d/11gcfpL-orj8SWY8bUBa1_ZGe8kPLUcjtGf2_WD7nBKw/edit

Currently, the Timer API allowing multi-threading prevents it from using basic WeakPtr-based cancellation.
Owner: gab@chromium.org
Status: Assigned (was: Untriaged)
Blocking: 716187
Re #1: base::Timer isn't a multi-threaded API, as such; it is sequence-affine while the timer is running, and must be stopped on that same sequence before it can be deleted, etc, on a new sequence. That matches the Invalidate/dereference requirements of WeakPtr, so there shouldn't be a problem using WeakPtr-based cancellation.
It isn't **meant to be** multi-threaded but I've been on a multi year effort to make the sequence-checks happy (almost there!)

Sign in to add a comment