Commit d747ae9e authored by Minggang Wang's avatar Minggang Wang Committed by Commit Bot

TaskManger: Invalidate the weak pointers after stopping updating

Currently, the operation of getting service worker infos is
asynchronous, during which the task manager may have stopped updating.
In this case we have to invalidate the weak pointers to avoid the
invoking of the callbacks.

BUG=953432

Change-Id: I7f5bc3c0203008175264eb5a8f31ab5236d40d27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572648Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Minggang Wang <minggang.wang@intel.com>
Cr-Commit-Position: refs/heads/master@{#652526}
parent 464a98fd
......@@ -121,6 +121,11 @@ void ServiceWorkerTaskProvider::StartUpdating() {
void ServiceWorkerTaskProvider::StopUpdating() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// OnDidGetAllServiceWorkerRunningInfos()/OnDidGetServiceWorkerRunningInfo()
// should never be called after this, and hence we must invalidate the weak
// pointers.
weak_ptr_factory_.InvalidateWeakPtrs();
// Stop listening to NOTIFICATION_PROFILE_CREATED.
registrar_.RemoveAll();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment