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 83e8c798fb3f5ea20465a51e8f1c23d631662876..391a7b653a4dfb7764e63bbd0dfcc1c9b8ec4b45 100644 |
--- a/content/browser/service_worker/service_worker_storage.cc |
+++ b/content/browser/service_worker/service_worker_storage.cc |
@@ -329,6 +329,22 @@ void ServiceWorkerStorage::FindRegistrationForPattern( |
weak_factory_.GetWeakPtr(), scope, callback))); |
} |
+scoped_refptr<ServiceWorkerRegistration> |
+ServiceWorkerStorage::GetUninstallingRegistration(const GURL& scope) { |
+ if (state_ != INITIALIZED || !context_) |
+ return NULL; |
+ for (RegistrationRefsById::const_iterator it = |
+ uninstalling_registrations_.begin(); |
+ it != uninstalling_registrations_.end(); |
+ ++it) { |
+ if (it->second->pattern() == scope) { |
+ DCHECK(it->second->is_uninstalling()); |
+ return it->second; |
+ } |
+ } |
+ return NULL; |
+} |
+ |
void ServiceWorkerStorage::FindRegistrationForId( |
int64 registration_id, |
const GURL& origin, |
@@ -420,7 +436,7 @@ void ServiceWorkerStorage::StoreRegistration( |
data.has_fetch_handler = true; |
data.version_id = version->version_id(); |
data.last_update_check = base::Time::Now(); |
- data.is_active = false; // initially stored in the waiting state |
+ data.is_active = (version == registration->active_version()); |
ResourceList resources; |
version->script_cache_map()->GetResources(&resources); |
@@ -608,6 +624,16 @@ void ServiceWorkerStorage::NotifyDoneInstallingRegistration( |
} |
} |
+void ServiceWorkerStorage::NotifyUninstallingRegistration( |
+ ServiceWorkerRegistration* registration) { |
+ uninstalling_registrations_[registration->id()] = registration; |
+} |
+ |
+void ServiceWorkerStorage::NotifyDoneUninstallingRegistration( |
+ ServiceWorkerRegistration* registration) { |
+ uninstalling_registrations_.erase(registration->id()); |
+} |
+ |
void ServiceWorkerStorage::Disable() { |
state_ = DISABLED; |
if (disk_cache_) |
@@ -773,7 +799,7 @@ void ServiceWorkerStorage::DidFindRegistrationForId( |
} |
if (status == ServiceWorkerDatabase::STATUS_ERROR_NOT_FOUND) { |
- // TODO(nhiroki): Find a registration in |installing_registrations_|. |
+ // TODO(nhiroki): Find a registration in |installing_registrations|. |
callback.Run(DatabaseStatusToStatusCode(status), |
scoped_refptr<ServiceWorkerRegistration>()); |
return; |