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

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

Issue 380093002: Update installed ServiceWorkers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 de1f0617e0c2bc44ce1dc16e2eba78ecc2458d09..dfca0f0ac4181346f65c1c055276bc3340f34a9d 100644
--- a/content/browser/service_worker/service_worker_registration.h
+++ b/content/browser/service_worker/service_worker_registration.h
@@ -20,22 +20,15 @@ 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 regiratration. The
falken 2014/07/17 06:33:42 nit: registration
+// scope and script url are constant for the life of the persistent
+// registration. It's refcounted to facillitate multiple controllees
falken 2014/07/17 06:33:41 nit: facilitate
+// being associated with the same registration. The class roughly
+// corresponds to navigator.serviceWorker.registgration.
falken 2014/07/17 06:33:41 nit: registration
class CONTENT_EXPORT ServiceWorkerRegistration
: NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>) {
public:
+ typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
class Listener {
public:
@@ -71,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
falken 2014/07/17 06:33:41 nit: corresponding
+ // (if any) left vacant (ie. by a waiting version being promoted).
// Also notifies listeners via OnVersionAttributesChanged.
void SetActiveVersion(ServiceWorkerVersion* version);
void SetWaitingVersion(ServiceWorkerVersion* version);
@@ -83,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>;
@@ -94,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_;

Powered by Google App Engine
This is Rietveld 408576698