| 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 3a034abd7f4f5f1314ec3c580c9b89e80c25f1d7..a8b0fa735a1db61b0e19935dc2d0557737199c6b 100644
|
| --- a/content/browser/service_worker/service_worker_registration.h
|
| +++ b/content/browser/service_worker/service_worker_registration.h
|
| @@ -20,22 +20,16 @@ namespace content {
|
| class ServiceWorkerRegistrationInfo;
|
| class ServiceWorkerVersion;
|
|
|
| -// This class manages all persistence of service workers:
|
| -// - Registrations
|
| -// - Mapping of caches to registrations / versions
|
| -//
|
| -// This is the place where we manage simultaneous
|
| -// requests for the same registrations and caches, making sure that
|
| -// two pages that are registering the same pattern at the same time
|
| -// have their registrations coalesced rather than overwriting each
|
| -// other.
|
| -//
|
| -// This class also manages the state of the upgrade process, which
|
| -// includes managing which ServiceWorkerVersion is "active" vs "in
|
| -// waiting".
|
| +// This class represents a service worker registration. The
|
| +// scope and script url are constant for the life of the persistent
|
| +// registration. It's refcounted to facillitate multiple controllees
|
| +// being associated with the same registration. The class roughly
|
| +// corresponds to navigator.serviceWorker.registgration.
|
| class CONTENT_EXPORT ServiceWorkerRegistration
|
| : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>) {
|
| public:
|
| + typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
|
| +
|
| class Listener {
|
| public:
|
| virtual void OnVersionAttributesChanged(
|
| @@ -70,8 +64,8 @@ class CONTENT_EXPORT ServiceWorkerRegistration
|
|
|
| ServiceWorkerRegistrationInfo GetInfo();
|
|
|
| - // Sets the corresposding version attribute and resets the position (if any)
|
| - // left vacant (ie. by a waiting version being promoted).
|
| + // Sets the corresposding version attribute and resets the position
|
| + // (if any) left vacant (ie. by a waiting version being promoted).
|
| // Also notifies listeners via OnVersionAttributesChanged.
|
| void SetActiveVersion(ServiceWorkerVersion* version);
|
| void SetWaitingVersion(ServiceWorkerVersion* version);
|
| @@ -82,6 +76,11 @@ class CONTENT_EXPORT ServiceWorkerRegistration
|
| // listeners via OnVersionAttributesChanged.
|
| void UnsetVersion(ServiceWorkerVersion* version);
|
|
|
| + // This method corresponds to the [[Activate]] algorithm described in
|
| + // the service worker specification. It's only valid to call this method
|
| + // when the registration's active version has no controllees.
|
| + void ActivateWaitingVersion(const StatusCallback& completion_callback);
|
| +
|
| private:
|
| ~ServiceWorkerRegistration();
|
| friend class base::RefCounted<ServiceWorkerRegistration>;
|
| @@ -93,6 +92,10 @@ class CONTENT_EXPORT ServiceWorkerRegistration
|
| void UnsetVersionInternal(
|
| ServiceWorkerVersion* version,
|
| ChangedVersionAttributesMask* mask);
|
| + void OnActivateEventFinished(
|
| + ServiceWorkerVersion* activating_version,
|
| + const StatusCallback& completion_callback,
|
| + ServiceWorkerStatusCode status);
|
|
|
| const GURL pattern_;
|
| const GURL script_url_;
|
|
|