Chromium Code Reviews| 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( |