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

Unified Diff: content/renderer/service_worker/service_worker_context_client.cc

Issue 2958753003: Revert "Create ServiceWorkerProviderHost before starting worker" (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « content/renderer/service_worker/service_worker_context_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/service_worker/service_worker_context_client.cc
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index a1e97f3525ba9152f38e56508878108b75ad7256..7332acf3aee10b8a5a4d1c97066090d482cde884 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -554,7 +554,6 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
const GURL& script_url,
mojom::ServiceWorkerEventDispatcherRequest dispatcher_request,
mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host,
- mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info,
std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client)
: embedded_worker_id_(embedded_worker_id),
service_worker_version_id_(service_worker_version_id),
@@ -576,11 +575,6 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
"ServiceWorkerContextClient::StartingWorkerContext",
this,
"PrepareWorker");
- // Create a content::ServiceWorkerNetworkProvider for this data source so
- // we can observe its requests.
- pending_network_provider_ =
- base::MakeUnique<ServiceWorkerNetworkProvider>(std::move(provider_info));
- provider_context_ = pending_network_provider_->context();
}
ServiceWorkerContextClient::~ServiceWorkerContextClient() {}
@@ -722,7 +716,9 @@ void ServiceWorkerContextClient::WorkerContextStarted(
SetRegistrationInServiceWorkerGlobalScope(registration_info, version_attrs);
- (*instance_host_)->OnThreadStarted(WorkerThread::GetCurrentId());
+ (*instance_host_)
+ ->OnThreadStarted(WorkerThread::GetCurrentId(),
+ provider_context_->provider_id());
TRACE_EVENT_ASYNC_STEP_INTO0(
"ServiceWorker",
@@ -1100,9 +1096,23 @@ void ServiceWorkerContextClient::DidHandlePaymentRequestEvent(
std::unique_ptr<blink::WebServiceWorkerNetworkProvider>
ServiceWorkerContextClient::CreateServiceWorkerNetworkProvider() {
DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence());
+
+ // Create a content::ServiceWorkerNetworkProvider for this data source so
+ // we can observe its requests.
+ std::unique_ptr<ServiceWorkerNetworkProvider> provider =
+ base::MakeUnique<ServiceWorkerNetworkProvider>(
+ MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER,
+ true /* is_parent_frame_secure */);
+ provider_context_ = provider->context();
+ network_provider_id_ = provider->provider_id();
+
+ // Tell the network provider about which version to load.
+ provider->SetServiceWorkerVersionId(service_worker_version_id_,
+ embedded_worker_id_);
+
// Blink is responsible for deleting the returned object.
return base::MakeUnique<WebServiceWorkerNetworkProviderImpl>(
- std::move(pending_network_provider_));
+ std::move(provider));
}
std::unique_ptr<blink::WebWorkerFetchContext>
@@ -1118,7 +1128,7 @@ ServiceWorkerContextClient::CreateServiceWorkerFetchContext() {
// Blink is responsible for deleting the returned object.
return base::MakeUnique<ServiceWorkerFetchContextImpl>(
script_url_, worker_url_loader_factory_provider.PassInterface(),
- provider_context_->provider_id());
+ network_provider_id_);
}
std::unique_ptr<blink::WebServiceWorkerProvider>
« no previous file with comments | « content/renderer/service_worker/service_worker_context_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698