OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "web/WebEmbeddedWorkerImpl.h" | 31 #include "web/WebEmbeddedWorkerImpl.h" |
32 | 32 |
33 #include <memory> | 33 #include <memory> |
34 #include "bindings/core/v8/SourceLocation.h" | 34 #include "bindings/core/v8/SourceLocation.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/SecurityContext.h" | 36 #include "core/dom/SecurityContext.h" |
37 #include "core/frame/csp/ContentSecurityPolicy.h" | 37 #include "core/frame/csp/ContentSecurityPolicy.h" |
38 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
39 #include "core/loader/FrameLoadRequest.h" | 39 #include "core/loader/FrameLoadRequest.h" |
40 #include "core/loader/ThreadableLoadingContext.h" | 40 #include "core/loader/ThreadableLoadingContext.h" |
| 41 #include "core/loader/WorkerFetchContext.h" |
41 #include "core/probe/CoreProbes.h" | 42 #include "core/probe/CoreProbes.h" |
42 #include "core/workers/ParentFrameTaskRunners.h" | 43 #include "core/workers/ParentFrameTaskRunners.h" |
43 #include "core/workers/WorkerClients.h" | 44 #include "core/workers/WorkerClients.h" |
44 #include "core/workers/WorkerGlobalScope.h" | 45 #include "core/workers/WorkerGlobalScope.h" |
45 #include "core/workers/WorkerInspectorProxy.h" | 46 #include "core/workers/WorkerInspectorProxy.h" |
46 #include "core/workers/WorkerLoaderProxy.h" | 47 #include "core/workers/WorkerLoaderProxy.h" |
47 #include "core/workers/WorkerScriptLoader.h" | 48 #include "core/workers/WorkerScriptLoader.h" |
48 #include "core/workers/WorkerThreadStartupData.h" | 49 #include "core/workers/WorkerThreadStartupData.h" |
49 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 50 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
50 #include "modules/serviceworkers/ServiceWorkerThread.h" | 51 #include "modules/serviceworkers/ServiceWorkerThread.h" |
51 #include "platform/Histogram.h" | 52 #include "platform/Histogram.h" |
| 53 #include "platform/RuntimeEnabledFeatures.h" |
52 #include "platform/SharedBuffer.h" | 54 #include "platform/SharedBuffer.h" |
53 #include "platform/heap/Handle.h" | 55 #include "platform/heap/Handle.h" |
54 #include "platform/loader/fetch/SubstituteData.h" | 56 #include "platform/loader/fetch/SubstituteData.h" |
55 #include "platform/network/ContentSecurityPolicyParsers.h" | 57 #include "platform/network/ContentSecurityPolicyParsers.h" |
56 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 58 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
57 #include "platform/network/NetworkUtils.h" | 59 #include "platform/network/NetworkUtils.h" |
58 #include "platform/weborigin/SecurityOrigin.h" | 60 #include "platform/weborigin/SecurityOrigin.h" |
59 #include "platform/wtf/Functional.h" | 61 #include "platform/wtf/Functional.h" |
60 #include "platform/wtf/PtrUtil.h" | 62 #include "platform/wtf/PtrUtil.h" |
61 #include "public/platform/Platform.h" | 63 #include "public/platform/Platform.h" |
62 #include "public/platform/WebURLRequest.h" | 64 #include "public/platform/WebURLRequest.h" |
| 65 #include "public/platform/WebWorkerFetchContext.h" |
63 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" | 66 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" |
64 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
65 #include "public/web/WebConsoleMessage.h" | 68 #include "public/web/WebConsoleMessage.h" |
66 #include "public/web/WebDevToolsAgent.h" | 69 #include "public/web/WebDevToolsAgent.h" |
67 #include "public/web/WebSettings.h" | 70 #include "public/web/WebSettings.h" |
68 #include "public/web/WebView.h" | 71 #include "public/web/WebView.h" |
69 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 72 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
70 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 73 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
71 #include "web/IndexedDBClientImpl.h" | 74 #include "web/IndexedDBClientImpl.h" |
72 #include "web/ServiceWorkerGlobalScopeClientImpl.h" | 75 #include "web/ServiceWorkerGlobalScopeClientImpl.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 std::move(content_settings_client_)); | 429 std::move(content_settings_client_)); |
427 ProvideIndexedDBClientToWorker(worker_clients, | 430 ProvideIndexedDBClientToWorker(worker_clients, |
428 IndexedDBClientImpl::Create(*worker_clients)); | 431 IndexedDBClientImpl::Create(*worker_clients)); |
429 ProvideServiceWorkerGlobalScopeClientToWorker( | 432 ProvideServiceWorkerGlobalScopeClientToWorker( |
430 worker_clients, | 433 worker_clients, |
431 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); | 434 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); |
432 ProvideServiceWorkerContainerClientToWorker( | 435 ProvideServiceWorkerContainerClientToWorker( |
433 worker_clients, | 436 worker_clients, |
434 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); | 437 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); |
435 | 438 |
| 439 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| 440 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
| 441 WTF::WrapUnique( |
| 442 worker_context_client_->CreateServiceWorkerFetchContext()); |
| 443 DCHECK(web_worker_fetch_context); |
| 444 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
| 445 // to |web_worker_fetch_context|. |
| 446 ProvideWorkerFetchContextToWorker(worker_clients, |
| 447 std::move(web_worker_fetch_context)); |
| 448 } |
| 449 |
436 // We need to set the CSP to both the shadow page's document and the | 450 // We need to set the CSP to both the shadow page's document and the |
437 // ServiceWorkerGlobalScope. | 451 // ServiceWorkerGlobalScope. |
438 document->InitContentSecurityPolicy( | 452 document->InitContentSecurityPolicy( |
439 main_script_loader_->ReleaseContentSecurityPolicy()); | 453 main_script_loader_->ReleaseContentSecurityPolicy()); |
440 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { | 454 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { |
441 document->ParseAndSetReferrerPolicy( | 455 document->ParseAndSetReferrerPolicy( |
442 main_script_loader_->GetReferrerPolicy()); | 456 main_script_loader_->GetReferrerPolicy()); |
443 } | 457 } |
444 | 458 |
445 KURL script_url = main_script_loader_->Url(); | 459 KURL script_url = main_script_loader_->Url(); |
(...skipping 30 matching lines...) Expand all Loading... |
476 loader_proxy_ = WorkerLoaderProxy::Create(this); | 490 loader_proxy_ = WorkerLoaderProxy::Create(this); |
477 worker_thread_ = | 491 worker_thread_ = |
478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); | 492 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); |
479 worker_thread_->Start(std::move(startup_data), | 493 worker_thread_->Start(std::move(startup_data), |
480 main_thread_task_runners_.Get()); | 494 main_thread_task_runners_.Get()); |
481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 495 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
482 script_url); | 496 script_url); |
483 } | 497 } |
484 | 498 |
485 } // namespace blink | 499 } // namespace blink |
OLD | NEW |