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

Unified Diff: content/child/service_worker/service_worker_network_provider.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
Index: content/child/service_worker/service_worker_network_provider.cc
diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc
index 19c50777ed32e4587226354e5fc65f3088919be3..364d0dcbfe4fb69e144529eddb14048c91f29250 100644
--- a/content/child/service_worker/service_worker_network_provider.cc
+++ b/content/child/service_worker/service_worker_network_provider.cc
@@ -7,7 +7,6 @@
#include "base/atomic_sequence_num.h"
#include "content/child/child_thread_impl.h"
#include "content/child/request_extra_data.h"
-#include "content/child/service_worker/service_worker_dispatcher.h"
#include "content/child/service_worker/service_worker_handle_reference.h"
#include "content/child/service_worker/service_worker_provider_context.h"
#include "content/common/navigation_params.h"
@@ -208,25 +207,6 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
GetNextProviderId(),
is_parent_frame_secure) {}
-ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
- mojom::ServiceWorkerProviderInfoForStartWorkerPtr info)
- : provider_id_(info->provider_id) {
- context_ = new ServiceWorkerProviderContext(
- provider_id_, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER,
- std::move(info->client_request),
- ChildThreadImpl::current()->thread_safe_sender());
-
- ServiceWorkerDispatcher* dispatcher =
- ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
- ChildThreadImpl::current()->thread_safe_sender(),
- base::ThreadTaskRunnerHandle::Get().get());
- // TODO(shimazu): Set registration/attributes directly to |context_|.
- dispatcher->OnAssociateRegistration(-1 /* unused thread_id */,
- info->provider_id, info->registration,
- info->attributes);
- provider_host_.Bind(std::move(info->host_ptr_info));
-}
-
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider()
: provider_id_(kInvalidServiceWorkerProviderId) {}
@@ -238,6 +218,16 @@ ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() {
provider_host_.reset();
}
+void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId(
+ int64_t version_id,
+ int embedded_worker_id) {
+ DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_);
+ if (!ChildThreadImpl::current())
+ return; // May be null in some tests.
+ dispatcher_host_->OnSetHostedVersionId(provider_id(), version_id,
+ embedded_worker_id);
+}
+
bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const {
if (ServiceWorkerUtils::IsServicificationEnabled()) {
// Interception for subresource loading is not working (yet)
« no previous file with comments | « content/child/service_worker/service_worker_network_provider.h ('k') | content/common/service_worker/embedded_worker.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698