Chromium Code Reviews| 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 5521e4423465f67ca5160da204af02efa86d94af..4fe0dcc54f999952972f8a337aca288f0a63bc73 100644 |
| --- a/content/child/service_worker/service_worker_network_provider.cc |
| +++ b/content/child/service_worker/service_worker_network_provider.cc |
| @@ -7,6 +7,7 @@ |
| #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" |
| @@ -207,6 +208,24 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( |
| GetNextProviderId(), |
| is_parent_frame_secure) {} |
| +ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( |
| + mojom::ServiceWorkerProviderClientInfoPtr info) |
| + : provider_id_(info->provider_id) { |
| + context_ = new ServiceWorkerProviderContext( |
| + provider_id_, info->type, 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, info->provider_id, info->registration, |
|
falken
2017/06/16 15:44:46
this -1 is not used right, since we are bypassing
shimazu
2017/06/19 03:53:30
Yes, that's right.
Added, thanks.
|
| + info->attributes); |
| + |
| + provider_host_.Bind(std::move(info->host_ptr_info)); |
| +} |
| + |
| ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider() |
| : provider_id_(kInvalidServiceWorkerProviderId) {} |
| @@ -218,16 +237,6 @@ 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 { |
| return context() && context()->controller(); |
| } |