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

Unified Diff: content/browser/service_worker/service_worker_provider_host.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_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 bf34ff13f41dbf2659c62e71d58bf474844a5c15..5377c614839108af9207bc9fcec5df4f65d39a91 100644
--- a/content/browser/service_worker/service_worker_provider_host.h
+++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -88,6 +88,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
bool are_ancestors_secure,
const WebContentsGetter& web_contents_getter);
+ // Creates ServiceWorkerProviderHost for the worker's context. Information
+ // about the ServiceWorkerProviderHost is passed with the StartWorker message.
+ static std::unique_ptr<ServiceWorkerProviderHost> PreCreateForWorkerContext(
+ ServiceWorkerVersion* hosted_version,
+ base::WeakPtr<ServiceWorkerContextCore> context);
+
// Used to create a ServiceWorkerProviderHost when the renderer-side provider
// is created. This ProviderHost will be created for the process specified by
// |process_id|.
@@ -196,8 +202,6 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
// Clears the associated registration and stop listening to it.
void DisassociateRegistration();
- void SetHostedVersion(ServiceWorkerVersion* version);
-
// Returns a handler for a request, the handler may return NULL if
// the request doesn't require special handling.
std::unique_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
@@ -266,6 +270,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
ServiceWorkerProviderHostInfo info,
ServiceWorkerDispatcherHost* dispatcher_host);
+ // Completes initialization of provider hosts used for the service worker's
+ // context.
falken 2017/06/01 08:12:34 It's pretty lame but this class historically calls
shimazu 2017/06/06 04:16:56 Done.
+ virtual void CompleteStartWorkerPreparation(
+ int process_id,
+ mojom::ServiceWorkerProviderClientInfoPtr* provider_client_info);
+
// Sends event messages to the renderer. Events for the worker are queued up
// until the worker thread id is known via SetReadyToSendMessagesToWorker().
void SendUpdateFoundMessage(
@@ -301,6 +311,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
void BindWorkerFetchContext(
mojom::ServiceWorkerWorkerClientAssociatedPtrInfo client_ptr_info);
+ protected:
+ ServiceWorkerProviderHost(int process_id,
+ ServiceWorkerProviderHostInfo info,
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ ServiceWorkerDispatcherHost* dispatcher_host);
+
private:
friend class ForeignFetchRequestHandlerTest;
friend class LinkHeaderServiceWorkerTest;
@@ -331,11 +347,6 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
~OneShotGetReadyCallback();
};
- ServiceWorkerProviderHost(int process_id,
- ServiceWorkerProviderHostInfo info,
- base::WeakPtr<ServiceWorkerContextCore> context,
- ServiceWorkerDispatcherHost* dispatcher_host);
-
// ServiceWorkerRegistration::Listener overrides.
void OnVersionAttributesChanged(
ServiceWorkerRegistration* registration,
@@ -369,6 +380,10 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
bool IsReadyToSendMessages() const;
void Send(IPC::Message* message) const;
+ // Sets the version hosted by this provider. This method should be used only
+ // for providers for service worker contexts.
falken 2017/06/01 08:12:34 ditto
shimazu 2017/06/06 04:16:56 Done.
+ void SetHostedVersion(ServiceWorkerVersion* version);
+
// Finalizes cross-site transfers and navigation-initalized hosts.
void FinalizeInitialization(int process_id,
ServiceWorkerDispatcherHost* dispatcher_host);

Powered by Google App Engine
This is Rietveld 408576698