New issue
Advanced search Search tips

Issue 817054 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

CancelableTaskTracker::TryCancelAll() leaves tasks in queue

Project Member Reported by cthomp@chromium.org, Feb 27 2018

Issue description

From discussion on https://crrev.com/c/818964, the consensus seems to be that calling TryCancelAll() should cause HasTrackedTasks() to return false. Currently, it sets the CancellationFlags, but does not clear the |task_flags_| map [1].

gab@ suggested [2] adding:

weak_factory_.InvalidateWeakPtrs();
task_flags_.clear();

I'll upload a CL shortly that addresses this and updates the corresponding unit tests.

[1] https://cs.chromium.org/chromium/src/base/task/cancelable_task_tracker.cc?gsn=CancelableTaskTracker&l=151
[2] https://chromium-review.googlesource.com/c/chromium/src/+/818964#message-1e3dc4eef5a49acc03ee227f3ee57317c082ef60
 

Comment 1 by cthomp@chromium.org, Feb 27 2018

CL: https://crrev.com/c/939733

I'm running the trybots to check that this change doesn't affect any users of CancelableTaskTracker.
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 28 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c7e66e92a6f8cf196fd3598389fcdee2957c864e

commit c7e66e92a6f8cf196fd3598389fcdee2957c864e
Author: Christopher Thompson <cthomp@chromium.org>
Date: Wed Feb 28 17:51:42 2018

Clear flags in CancelableTaskTracker::TryCancelAll

This makes TryCancelAll() additionally clear the flags map and
invalidate any weak pointers, so that HasTrackedTasks() will return
false immediately after calling TryCancelAll() (aligning calling
TryCancelAll more with destroying the CancelableTaskTracker).

This also updates the unit tests to account for this.

Bug:  817054 
Change-Id: I5d65847c2d230ed832d372f3980b847770638126
Reviewed-on: https://chromium-review.googlesource.com/939733
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Christopher Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539877}
[modify] https://crrev.com/c7e66e92a6f8cf196fd3598389fcdee2957c864e/base/task/cancelable_task_tracker.cc
[modify] https://crrev.com/c7e66e92a6f8cf196fd3598389fcdee2957c864e/base/task/cancelable_task_tracker_unittest.cc

Comment 3 by cthomp@chromium.org, Feb 28 2018

Status: Fixed (was: Started)

Sign in to add a comment