Use a RefCountedData<AtomicFlag> in CancelableTaskTracker.

If the MessageLoop from which CancelableTaskTracker is used is torn-down
before the tracker, or its target TaskRunner, then the cancellation
flags for outstanding tasks may be accessed after the tracker itself is
gone.

By adding ref-counting to the cancellation flags we ensure that they
remain available for as long as the posted task, the reply, or the
tracker, needs them.

We also remove the WeakPtrFactory from the CancelableTaskTracker, since
the Untrack() operations it was used to guard can instead be guarded by
the cancelation flags of each associated task.

Bug: 918948
Change-Id: I44a8356ecd970b7cedd1bbd2a6957c2707716bfc
Reviewed-on: https://chromium-review.googlesource.com/c/1398392
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621388}
3 files changed