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

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

Issue 417043006: ServiceWorker: Make SWProviderHost listen to SWRegistration (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_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..2eb117c4d8af71939f3f2971a2bd34d69d1624e8 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.
+ 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_; }
@@ -100,6 +108,9 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
// Returns true if |version| can be associated with this provider.
bool CanAssociateVersion(ServiceWorkerVersion* version);
+ // Associates to |registration| to listen its version change events.
falken 2014/08/05 02:41:28 s/listen/listen for/g
nhiroki 2014/08/05 15:51:12 Done.
+ void AssociateRegistration(ServiceWorkerRegistration* registration);
+
// Returns true if the context referred to by this host (i.e. |context_|) is
// still alive.
bool IsContextAlive();
@@ -118,6 +129,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_;

Powered by Google App Engine
This is Rietveld 408576698