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

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

Issue 360123002: ServiceWorker: some more groundwork in support of the update process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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_provider_host.h
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h
index 31f4a372b1bd7633651c8f160266267bbb26d3dd..fba49ad9ac06a7180481c3c77866dd8df67d2cf1 100644
--- a/content/browser/service_worker/service_worker_provider_host.h
+++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -53,17 +53,19 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
return running_hosted_version_ != NULL;
}
- // The service worker version that corresponds with
- // navigator.serviceWorker.active for our document.
+ // Getters for the navigator.serviceWorker attribute values.
+ ServiceWorkerVersion* controlling_version() const {
+ return controlling_version_.get();
+ }
ServiceWorkerVersion* active_version() const {
return active_version_.get();
}
-
- // The service worker version that corresponds with
- // navigate.serviceWorker.waiting for our document.
ServiceWorkerVersion* waiting_version() const {
return waiting_version_.get();
}
+ ServiceWorkerVersion* installing_version() const {
+ return installing_version_.get();
+ }
// The running version, if any, that this provider is providing resource
// loads for.
@@ -74,11 +76,15 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
void SetDocumentUrl(const GURL& url);
const GURL& document_url() const { return document_url_; }
- // Associates |version| to this provider as its '.active' or '.waiting'
- // version.
- // Giving NULL to this method will unset the corresponding field.
+ // Associates |version| to the corresponding field or if |version| is NULL
+ // clears the field.
void SetActiveVersion(ServiceWorkerVersion* version);
void SetWaitingVersion(ServiceWorkerVersion* version);
+ void SetInstallingVersion(ServiceWorkerVersion* version);
+
+ // If |version| is the installing, waiting, or active version of this
+ // provider, the method will reset that field to NULL.
+ void UnsetVersion(ServiceWorkerVersion* version);
// Returns false if the version is not in the expected STARTING in our
// process state. That would be indicative of a bad IPC message.
@@ -90,9 +96,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
ResourceType::Type resource_type,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context);
- // Returns true if |version| has the same registration as active and waiting
- // versions.
- bool ValidateVersionForAssociation(ServiceWorkerVersion* version);
+ // Returns true if |version| can be associated with this provider.
+ bool CanAssociateVersion(ServiceWorkerVersion* version);
// Returns true if the context referred to by this host (i.e. |context_|) is
// still alive.
@@ -111,8 +116,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
const int process_id_;
const int provider_id_;
GURL document_url_;
+
+ // TODO(michaeln): controlling_version_ is not used yet.
+ scoped_refptr<ServiceWorkerVersion> controlling_version_;
scoped_refptr<ServiceWorkerVersion> active_version_;
scoped_refptr<ServiceWorkerVersion> waiting_version_;
+ scoped_refptr<ServiceWorkerVersion> installing_version_;
scoped_refptr<ServiceWorkerVersion> running_hosted_version_;
base::WeakPtr<ServiceWorkerContextCore> context_;
ServiceWorkerDispatcherHost* dispatcher_host_;

Powered by Google App Engine
This is Rietveld 408576698