| Index: content/browser/service_worker/service_worker_storage.cc
|
| diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc
|
| index bc5a82aef2e091fa80aaafa7a67264334eb64ad2..351cea57bfe0aa16dabc88613da0d9071547b2b9 100644
|
| --- a/content/browser/service_worker/service_worker_storage.cc
|
| +++ b/content/browser/service_worker/service_worker_storage.cc
|
| @@ -450,8 +450,6 @@ void ServiceWorkerStorage::NotifyDoneInstallingRegistration(
|
| &ServiceWorkerDatabase::PurgeUncommittedResourceIds),
|
| base::Unretained(database_.get()),
|
| ids));
|
| -
|
| - StartPurgingResources(resources);
|
| }
|
| }
|
|
|
| @@ -705,7 +703,8 @@ void ServiceWorkerStorage::DidStoreRegistration(
|
| registered_origins_.insert(origin);
|
| callback.Run(SERVICE_WORKER_OK);
|
|
|
| - SchedulePurgeResources(deleted_version_id, newly_purgeable_resources);
|
| + if (!context_ || !context_->GetLiveVersion(deleted_version_id))
|
| + StartPurgingResources(newly_purgeable_resources);
|
| }
|
|
|
| void ServiceWorkerStorage::DidUpdateToActiveState(
|
| @@ -734,7 +733,8 @@ void ServiceWorkerStorage::DidDeleteRegistration(
|
| registered_origins_.erase(origin);
|
| callback.Run(SERVICE_WORKER_OK);
|
|
|
| - SchedulePurgeResources(version_id, newly_purgeable_resources);
|
| + if (!context_ || !context_->GetLiveVersion(version_id))
|
| + StartPurgingResources(newly_purgeable_resources);
|
| }
|
|
|
| scoped_refptr<ServiceWorkerRegistration>
|
| @@ -844,32 +844,6 @@ void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) {
|
| ServiceWorkerMetrics::CountInitDiskCacheResult(rv == net::OK);
|
| }
|
|
|
| -void ServiceWorkerStorage::OnNoControllees(ServiceWorkerVersion* version) {
|
| - std::map<int64, std::vector<int64> >::iterator it =
|
| - deleted_version_resource_ids_.find(version->version_id());
|
| - DCHECK(it != deleted_version_resource_ids_.end());
|
| - StartPurgingResources(it->second);
|
| - deleted_version_resource_ids_.erase(it);
|
| - version->RemoveListener(this);
|
| -}
|
| -
|
| -void ServiceWorkerStorage::SchedulePurgeResources(
|
| - int64 version_id,
|
| - const std::vector<int64>& resources) {
|
| - DCHECK(deleted_version_resource_ids_.find(version_id) ==
|
| - deleted_version_resource_ids_.end());
|
| - if (resources.empty())
|
| - return;
|
| - scoped_refptr<ServiceWorkerVersion> version =
|
| - context_ ? context_->GetLiveVersion(version_id) : NULL;
|
| - if (version && version->HasControllee()) {
|
| - deleted_version_resource_ids_[version_id] = resources;
|
| - version->AddListener(this);
|
| - } else {
|
| - StartPurgingResources(resources);
|
| - }
|
| -}
|
| -
|
| void ServiceWorkerStorage::StartPurgingResources(
|
| const std::vector<int64>& ids) {
|
| DCHECK(has_checked_for_stale_resources_);
|
| @@ -878,6 +852,10 @@ void ServiceWorkerStorage::StartPurgingResources(
|
| ContinuePurgingResources();
|
| }
|
|
|
| +void ServiceWorkerStorage::PurgeResources(const ResourceList& resources) {
|
| + StartPurgingResources(resources);
|
| +}
|
| +
|
| void ServiceWorkerStorage::StartPurgingResources(
|
| const ResourceList& resources) {
|
| DCHECK(has_checked_for_stale_resources_);
|
|
|