Index: content/browser/service_worker/service_worker_version.h |
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h |
index 391300153d31a483bafeeab9ac3b6d8971ddadae..881ef8ca7f349694456023424b6256fe533f51cb 100644 |
--- a/content/browser/service_worker/service_worker_version.h |
+++ b/content/browser/service_worker/service_worker_version.h |
@@ -304,6 +304,10 @@ class CONTENT_EXPORT ServiceWorkerVersion |
return controllee_map_; |
} |
+ // The provider host hosting this version. Only valid while the version is |
+ // running. |
+ ServiceWorkerProviderHost* provider_host() { return provider_host_.get(); } |
+ |
base::WeakPtr<ServiceWorkerContextCore> context() const { return context_; } |
// Adds and removes |request_job| as a dependent job not to stop the |
@@ -556,6 +560,7 @@ class CONTENT_EXPORT ServiceWorkerVersion |
// EmbeddedWorkerInstance::Listener overrides: |
void OnThreadStarted() override; |
void OnStarting() override; |
+ void OnStartWorkerMessageSent() override; |
void OnStarted() override; |
void OnStopping() override; |
void OnStopped(EmbeddedWorkerStatus old_status) override; |
@@ -728,6 +733,15 @@ class CONTENT_EXPORT ServiceWorkerVersion |
std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_; |
+ // Keeps track of the provider hosting this running service worker for this |
+ // version. |pending_provider_host_| is valid from StartWorkerInternal to |
+ // OnStartWorkerMessageSent. On OnStartWorkerMessageSent, the ownership will |
+ // be passed to ServiceWorkerContextCore. |
+ // |provider_host_| is always valid as long as this version has |
+ // the running context. |
+ std::unique_ptr<ServiceWorkerProviderHost> pending_provider_host_; |
+ base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
+ |
std::map<std::string, ServiceWorkerProviderHost*> controllee_map_; |
// Will be null while shutting down. |
base::WeakPtr<ServiceWorkerContextCore> context_; |