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

Unified Diff: content/browser/service_worker/service_worker_registration.h

Issue 413063004: Service Worker: in Unregister, wait until after the active worker no longer controls a document (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 4 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_registration.h
diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h
index e8e65b37b8860a09cbb34e55168e7ffca12361d6..b5b678550534eabbd403739070d7e747cf87157e 100644
--- a/content/browser/service_worker/service_worker_registration.h
+++ b/content/browser/service_worker/service_worker_registration.h
@@ -50,6 +50,11 @@ class CONTENT_EXPORT ServiceWorkerRegistration
const GURL& script_url() const { return script_url_; }
const GURL& pattern() const { return pattern_; }
+ bool is_deleted() const { return is_deleted_; }
+ void set_is_deleted(bool deleted) { is_deleted_ = deleted; }
+
+ bool is_uninstalling() const { return is_uninstalling_; }
+
ServiceWorkerVersion* active_version() const {
return active_version_.get();
}
@@ -85,8 +90,15 @@ class CONTENT_EXPORT ServiceWorkerRegistration
// is called, activation is initiated immediately.
void ActivateWaitingVersionWhenReady();
- bool is_deleted() const { return is_deleted_; }
- void set_is_deleted() { is_deleted_ = true; }
+ // Triggers the [[ClearRegistration]] algorithm when the currently
+ // active version has no controllees. Deletes this registration
+ // from storage immediately.
+ void ClearWhenReady();
+
+ // Restores this registration in storage and cancels the pending
+ // [[ClearRegistration]] algorithm. If the algorithm was already triggered,
+ // does nothing.
+ void AbortPendingClear();
private:
friend class base::RefCounted<ServiceWorkerRegistration>;
@@ -109,13 +121,18 @@ class CONTENT_EXPORT ServiceWorkerRegistration
void OnActivateEventFinished(
ServiceWorkerVersion* activating_version,
ServiceWorkerStatusCode status);
- void ResetShouldActivateWhenReady();
void OnDeleteFinished(ServiceWorkerStatusCode status);
+ // This method corresponds to the [[ClearRegistration]] algorithm.
+ void Clear();
+ void OnStoreFinished(scoped_refptr<ServiceWorkerVersion> version,
+ ServiceWorkerStatusCode status);
+
const GURL pattern_;
const GURL script_url_;
const int64 registration_id_;
bool is_deleted_;
+ bool is_uninstalling_;
bool should_activate_when_ready_;
scoped_refptr<ServiceWorkerVersion> active_version_;
scoped_refptr<ServiceWorkerVersion> waiting_version_;
@@ -125,5 +142,7 @@ class CONTENT_EXPORT ServiceWorkerRegistration
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
};
+
} // namespace content
+
#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_

Powered by Google App Engine
This is Rietveld 408576698