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

Side by Side Diff: content/child/service_worker/service_worker_network_provider.cc

Issue 2943463002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (Closed)
Patch Set: rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/service_worker/service_worker_network_provider.h" 5 #include "content/child/service_worker/service_worker_network_provider.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "content/child/child_thread_impl.h" 8 #include "content/child/child_thread_impl.h"
9 #include "content/child/request_extra_data.h" 9 #include "content/child/request_extra_data.h"
10 #include "content/child/service_worker/service_worker_dispatcher.h" 10 #include "content/child/service_worker/service_worker_dispatcher.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 is_parent_frame_secure) {} 209 is_parent_frame_secure) {}
210 210
211 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( 211 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
212 mojom::ServiceWorkerProviderInfoForStartWorkerPtr info) 212 mojom::ServiceWorkerProviderInfoForStartWorkerPtr info)
213 : provider_id_(info->provider_id) { 213 : provider_id_(info->provider_id) {
214 context_ = new ServiceWorkerProviderContext( 214 context_ = new ServiceWorkerProviderContext(
215 provider_id_, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, 215 provider_id_, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER,
216 std::move(info->client_request), 216 std::move(info->client_request),
217 ChildThreadImpl::current()->thread_safe_sender()); 217 ChildThreadImpl::current()->thread_safe_sender());
218 218
219 if (info->script_loader_factory_ptr_info.is_valid())
220 script_loader_factory_.Bind(
221 std::move(info->script_loader_factory_ptr_info));
222
219 ServiceWorkerDispatcher* dispatcher = 223 ServiceWorkerDispatcher* dispatcher =
220 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( 224 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
221 ChildThreadImpl::current()->thread_safe_sender(), 225 ChildThreadImpl::current()->thread_safe_sender(),
222 base::ThreadTaskRunnerHandle::Get().get()); 226 base::ThreadTaskRunnerHandle::Get().get());
223 // TODO(shimazu): Set registration/attributes directly to |context_|. 227 // TODO(shimazu): Set registration/attributes directly to |context_|.
224 dispatcher->OnAssociateRegistration(-1 /* unused thread_id */, 228 dispatcher->OnAssociateRegistration(-1 /* unused thread_id */,
225 info->provider_id, info->registration, 229 info->provider_id, info->registration,
226 info->attributes); 230 info->attributes);
227 provider_host_.Bind(std::move(info->host_ptr_info)); 231 provider_host_.Bind(std::move(info->host_ptr_info));
228 } 232 }
(...skipping 12 matching lines...) Expand all
241 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { 245 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const {
242 if (ServiceWorkerUtils::IsServicificationEnabled()) { 246 if (ServiceWorkerUtils::IsServicificationEnabled()) {
243 // Interception for subresource loading is not working (yet) 247 // Interception for subresource loading is not working (yet)
244 // when servicification is enabled. 248 // when servicification is enabled.
245 return false; 249 return false;
246 } 250 }
247 return context() && context()->controller(); 251 return context() && context()->controller();
248 } 252 }
249 253
250 } // namespace content 254 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698