OLD | NEW |
---|---|
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/renderer/shared_worker/embedded_shared_worker_stub.h" | 5 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/feature_list.h" | |
10 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
11 #include "content/child/appcache/appcache_dispatcher.h" | 12 #include "content/child/appcache/appcache_dispatcher.h" |
12 #include "content/child/appcache/web_application_cache_host_impl.h" | 13 #include "content/child/appcache/web_application_cache_host_impl.h" |
13 #include "content/child/request_extra_data.h" | 14 #include "content/child/request_extra_data.h" |
14 #include "content/child/scoped_child_process_reference.h" | 15 #include "content/child/scoped_child_process_reference.h" |
15 #include "content/child/service_worker/service_worker_handle_reference.h" | 16 #include "content/child/service_worker/service_worker_handle_reference.h" |
16 #include "content/child/service_worker/service_worker_network_provider.h" | 17 #include "content/child/service_worker/service_worker_network_provider.h" |
17 #include "content/child/service_worker/service_worker_provider_context.h" | 18 #include "content/child/service_worker/service_worker_provider_context.h" |
18 #include "content/child/shared_worker_devtools_agent.h" | 19 #include "content/child/shared_worker_devtools_agent.h" |
19 #include "content/child/webmessageportchannel_impl.h" | 20 #include "content/child/webmessageportchannel_impl.h" |
20 #include "content/common/worker_messages.h" | 21 #include "content/common/worker_messages.h" |
22 #include "content/common/worker_url_loader_factory_provider.mojom.h" | |
21 #include "content/public/common/appcache_info.h" | 23 #include "content/public/common/appcache_info.h" |
24 #include "content/public/common/content_features.h" | |
22 #include "content/public/common/origin_util.h" | 25 #include "content/public/common/origin_util.h" |
23 #include "content/renderer/devtools/devtools_agent.h" | 26 #include "content/renderer/devtools/devtools_agent.h" |
24 #include "content/renderer/render_thread_impl.h" | 27 #include "content/renderer/render_thread_impl.h" |
28 #include "content/renderer/renderer_blink_platform_impl.h" | |
29 #include "content/renderer/service_worker/worker_fetch_context_impl.h" | |
25 #include "content/renderer/shared_worker/embedded_shared_worker_content_settings _client_proxy.h" | 30 #include "content/renderer/shared_worker/embedded_shared_worker_content_settings _client_proxy.h" |
26 #include "ipc/ipc_message_macros.h" | 31 #include "ipc/ipc_message_macros.h" |
32 #include "third_party/WebKit/public/platform/InterfaceProvider.h" | |
27 #include "third_party/WebKit/public/platform/URLConversion.h" | 33 #include "third_party/WebKit/public/platform/URLConversion.h" |
28 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 34 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
29 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerNetworkProvider.h" | 35 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerNetworkProvider.h" |
30 #include "third_party/WebKit/public/web/WebSharedWorker.h" | 36 #include "third_party/WebKit/public/web/WebSharedWorker.h" |
31 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" | 37 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" |
32 #include "url/origin.h" | 38 #include "url/origin.h" |
33 | 39 |
34 namespace content { | 40 namespace content { |
35 | 41 |
36 namespace { | 42 namespace { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 const blink::WebString& state) { | 251 const blink::WebString& state) { |
246 worker_devtools_agent_->SendDevToolsMessage( | 252 worker_devtools_agent_->SendDevToolsMessage( |
247 session_id, call_id, message, state); | 253 session_id, call_id, message, state); |
248 } | 254 } |
249 | 255 |
250 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* | 256 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
251 EmbeddedSharedWorkerStub::CreateDevToolsMessageLoop() { | 257 EmbeddedSharedWorkerStub::CreateDevToolsMessageLoop() { |
252 return DevToolsAgent::createMessageLoopWrapper(); | 258 return DevToolsAgent::createMessageLoopWrapper(); |
253 } | 259 } |
254 | 260 |
261 blink::WebWorkerFetchContext* | |
262 EmbeddedSharedWorkerStub::CreateWorkerFetchContext() { | |
263 if (!base::FeatureList::IsEnabled(features::kOffMainThreadFetch)) | |
nhiroki
2017/04/20 04:16:07
DCHECK(base::FeatureList::IsEnabled(features::kOff
horo
2017/04/20 08:35:43
Done.
| |
264 return nullptr; | |
265 mojom::WorkerURLLoaderFactoryProviderPtr worker_url_loader_factory_provider; | |
266 RenderThreadImpl::current() | |
267 ->blink_platform_impl() | |
268 ->GetInterfaceProvider() | |
269 ->GetInterface(mojo::MakeRequest(&worker_url_loader_factory_provider)); | |
270 WorkerFetchContextImpl* worker_fetch_context = new WorkerFetchContextImpl( | |
271 worker_url_loader_factory_provider.PassInterface()); | |
272 blink::WebServiceWorkerNetworkProvider* web_provider = | |
273 impl_->GetServiceWorkerNetworkProvider(); | |
274 if (web_provider) { | |
275 ServiceWorkerNetworkProvider* provider = | |
276 ServiceWorkerNetworkProvider::FromWebServiceWorkerNetworkProvider( | |
277 web_provider); | |
278 worker_fetch_context->SetServiceWorkerProviderID(provider->provider_id()); | |
279 worker_fetch_context->SetIsControlledByServiceWorker( | |
280 provider->IsControlledByServiceWorker()); | |
281 } | |
282 return worker_fetch_context; | |
283 } | |
284 | |
255 void EmbeddedSharedWorkerStub::Shutdown() { | 285 void EmbeddedSharedWorkerStub::Shutdown() { |
256 // WebSharedWorker must be already deleted in the blink side | 286 // WebSharedWorker must be already deleted in the blink side |
257 // when this is called. | 287 // when this is called. |
258 impl_ = nullptr; | 288 impl_ = nullptr; |
259 delete this; | 289 delete this; |
260 } | 290 } |
261 | 291 |
262 bool EmbeddedSharedWorkerStub::Send(IPC::Message* message) { | 292 bool EmbeddedSharedWorkerStub::Send(IPC::Message* message) { |
263 return RenderThreadImpl::current()->Send(message); | 293 return RenderThreadImpl::current()->Send(message); |
264 } | 294 } |
(...skipping 20 matching lines...) Expand all Loading... | |
285 } | 315 } |
286 } | 316 } |
287 | 317 |
288 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 318 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
289 // After this we wouldn't get any IPC for this stub. | 319 // After this we wouldn't get any IPC for this stub. |
290 running_ = false; | 320 running_ = false; |
291 impl_->TerminateWorkerContext(); | 321 impl_->TerminateWorkerContext(); |
292 } | 322 } |
293 | 323 |
294 } // namespace content | 324 } // namespace content |
OLD | NEW |