Chromium Code Reviews| 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..2fa3191fd32b4d58ac7ca710d1447b93e9258740 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_; } |
|
nhiroki
2014/08/11 12:24:51
nit: can you move this after "set_is_deleted()" to
falken
2014/08/12 09:06:06
Done, moved some functions up above active_version
|
| + |
| void AddListener(Listener* listener); |
| void RemoveListener(Listener* listener); |
| @@ -83,7 +85,17 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
| void ActivateWaitingVersionWhenReady(); |
| bool is_deleted() const { return is_deleted_; } |
| - void set_is_deleted() { is_deleted_ = true; } |
| + void set_is_deleted(bool deleted) { is_deleted_ = deleted; } |
| + |
| + // 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>; |
| @@ -101,18 +113,21 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
| // 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( |
| ServiceWorkerVersion* activating_version, |
| ServiceWorkerStatusCode status); |
| - void ResetShouldActivateWhenReady(); |
| void OnDeleteFinished(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_; |
| @@ -122,5 +137,7 @@ class CONTENT_EXPORT ServiceWorkerRegistration |
| DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
| }; |
| + |
| } // namespace content |
| + |
| #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |