Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 355163003: Don't prematurely delete script resources when registration is deleted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index bf866b991cec0309c5b02e4ab2a8c6b28f3a029d..9bdbb7fa360c6c5767f3aabe5380f23569b3facd 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -388,14 +388,18 @@ void ServiceWorkerVersion::RemoveControllee(
controllee_by_id_.Remove(found->second);
controllee_map_.erase(found);
RemoveProcessFromWorker(provider_host->process_id());
- if (!HasControllee())
- ScheduleStopWorker();
- // TODO(kinuko): Fire NoControllees notification when the # of controllees
- // reaches 0, so that a new pending version can be activated (which will
- // deactivate this version).
- // TODO(michaeln): On no controllees call storage DeleteVersionResources
- // if this version has been deactivated. Probably storage can listen for
- // NoControllees for versions that have been deleted.
+
+ if (HasControllee())
+ return;
+ ScheduleStopWorker();
+ if (!context_)
+ return;
+ ServiceWorkerRegistration* registration =
+ context_->GetLiveRegistration(registration_id_);
+ if (status() == REDUNDANT ||
+ (registration && registration->is_uninstalling()))
+ context_->storage()->DeleteVersionResources(
michaeln 2014/06/28 02:29:31 I this should StartPurging()
+ version_id_, base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
}
void ServiceWorkerVersion::AddWaitingControllee(

Powered by Google App Engine
This is Rietveld 408576698