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

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

Issue 2779763004: Create ServiceWorkerProviderHost before starting worker (Closed)
Patch Set: Rebased Created 3 years, 7 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_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index 917fe64bf6a7e3eb4836136bace13309dd57bb6c..541f89e9113de5a71bbb34f5ed8d6eac1b5069c5 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -303,6 +303,10 @@ class CONTENT_EXPORT ServiceWorkerVersion
return controllee_map_;
}
+ ServiceWorkerProviderHost* running_controller() {
falken 2017/06/01 08:12:35 // The provider host hosting this version. Only va
shimazu 2017/06/06 04:16:56 Done.
+ return running_controller_provider_.get();
+ }
+
base::WeakPtr<ServiceWorkerContextCore> context() const { return context_; }
// Adds and removes |request_job| as a dependent job not to stop the
@@ -555,6 +559,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;
@@ -723,6 +728,15 @@ class CONTENT_EXPORT ServiceWorkerVersion
std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_;
+ // Keeps track of the provider hosting worker's context for this version.
+ // |pending_controller_provider_| is valid from StartWorkerInternal to
+ // OnStartWorkerMessageSent. On OnStartWorkerMessageSent, the ownership will
+ // be passed to the context.
falken 2017/06/01 08:12:34 does "context" here mean ServiceWorkerContextCore?
shimazu 2017/06/06 04:16:56 Done.
+ // |running_controller_provider_| is always valid as long as this version has
+ // the running context.
+ std::unique_ptr<ServiceWorkerProviderHost> pending_controller_provider_;
+ base::WeakPtr<ServiceWorkerProviderHost> running_controller_provider_;
falken 2017/06/01 08:12:35 How about just pending_provider_host_ and provider
shimazu 2017/06/06 04:16:56 Done.
+
std::map<std::string, ServiceWorkerProviderHost*> controllee_map_;
// Will be null while shutting down.
base::WeakPtr<ServiceWorkerContextCore> context_;

Powered by Google App Engine
This is Rietveld 408576698