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

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: rebase and merge Created 6 years, 5 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 41092889e74c4396711d5d829d02a63bbfbf0645..c170a97151caaca897e58a7f55340b1c66735b30 100644
--- a/content/browser/service_worker/service_worker_registration.h
+++ b/content/browser/service_worker/service_worker_registration.h
@@ -60,6 +60,8 @@ class CONTENT_EXPORT ServiceWorkerRegistration
return installing_version_.get();
}
+ bool is_uninstalling() const { return is_uninstalling_; }
+
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
@@ -85,6 +87,16 @@ class CONTENT_EXPORT ServiceWorkerRegistration
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>;
@@ -98,9 +110,16 @@ class CONTENT_EXPORT ServiceWorkerRegistration
ServiceWorkerVersion* version,
ChangedVersionAttributesMask* mask);
+ bool IsListeningForNoControllees();
+ void SetShouldActivateWhenReady(bool should_activate);
+ void SetUninstalling(bool is_uninstalling);
+
// ServiceWorkerVersion::Listener override.
virtual void OnNoControllees(ServiceWorkerVersion* version) OVERRIDE;
+ // This method corresponds to the [[ClearRegistration]] algorithm.
+ void Clear();
+
// This method corresponds to the [[Activate]] algorithm.
void ActivateWaitingVersion();
void OnActivateEventFinished(
@@ -113,6 +132,7 @@ class CONTENT_EXPORT ServiceWorkerRegistration
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_;
@@ -122,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