Chromium Code Reviews| 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 3175ef10d160dc8abfb8df41266eb0bddd38adf6..ba1e3943ac6246add2e71d9fcc119529a269bc5e 100644 |
| --- a/content/browser/service_worker/service_worker_provider_host.h |
| +++ b/content/browser/service_worker/service_worker_provider_host.h |
| @@ -10,6 +10,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "content/browser/service_worker/service_worker_registration.h" |
| #include "content/common/content_export.h" |
| #include "content/common/service_worker/service_worker_types.h" |
| #include "content/public/common/resource_type.h" |
| @@ -38,13 +39,20 @@ class ServiceWorkerVersion; |
| // Note this class can also host a running service worker, in which |
| // case it will observe resource loads made directly by the service worker. |
| class CONTENT_EXPORT ServiceWorkerProviderHost |
| - : public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
| + : public ServiceWorkerRegistration::Listener, |
| + public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
| public: |
| ServiceWorkerProviderHost(int process_id, |
| int provider_id, |
| base::WeakPtr<ServiceWorkerContextCore> context, |
| ServiceWorkerDispatcherHost* dispatcher_host); |
| - ~ServiceWorkerProviderHost(); |
| + virtual ~ServiceWorkerProviderHost(); |
| + |
| + // ServiceWorkerRegistration::Listener overrides. |
|
michaeln
2014/08/05 23:57:15
please put this in the private section since this
nhiroki
2014/08/06 06:57:27
Moved.
|
| + virtual void OnVersionAttributesChanged( |
| + ServiceWorkerRegistration* registration, |
| + ChangedVersionAttributesMask changed_mask, |
| + const ServiceWorkerRegistrationInfo& info) OVERRIDE; |
| int process_id() const { return process_id_; } |
| int provider_id() const { return provider_id_; } |
| @@ -87,6 +95,9 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| // provider, the method will reset that field to NULL. |
| void UnsetVersion(ServiceWorkerVersion* version); |
| + // Associates to |registration| to listen for its version change events. |
| + void SetRegistration(ServiceWorkerRegistration* registration); |
|
michaeln
2014/08/05 23:57:15
We'll need to clear this association too in some c
nhiroki
2014/08/06 06:57:27
Done (please see my reply comment in service_worke
|
| + |
| // Returns false if the version is not in the expected STARTING in our |
| // process state. That would be indicative of a bad IPC message. |
| bool SetHostedVersionId(int64 versions_id); |
| @@ -100,6 +111,10 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| // Returns true if |version| can be associated with this provider. |
| bool CanAssociateVersion(ServiceWorkerVersion* version); |
| + // Returns true if this provider hasn't been associated with any registration |
| + // yet. |
| + bool CanAssociateRegistration(); |
| + |
| // Returns true if the context referred to by this host (i.e. |context_|) is |
| // still alive. |
| bool IsContextAlive(); |
| @@ -118,6 +133,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| const int provider_id_; |
| GURL document_url_; |
| + scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
| + |
| scoped_refptr<ServiceWorkerVersion> controlling_version_; |
| scoped_refptr<ServiceWorkerVersion> active_version_; |
| scoped_refptr<ServiceWorkerVersion> waiting_version_; |