Index: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
index 6acd6833d14aa1989cea9188bbb255a3c6f07ea9..607114ee3a3210862afdc61e8a5b506ef44c5d96 100644 |
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp |
@@ -38,6 +38,7 @@ |
#include "core/inspector/ConsoleMessage.h" |
#include "core/loader/FrameLoadRequest.h" |
#include "core/loader/ThreadableLoadingContext.h" |
+#include "core/loader/WorkerFetchContext.h" |
#include "core/probe/CoreProbes.h" |
#include "core/workers/ParentFrameTaskRunners.h" |
#include "core/workers/WorkerClients.h" |
@@ -49,6 +50,7 @@ |
#include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
#include "modules/serviceworkers/ServiceWorkerThread.h" |
#include "platform/Histogram.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/SharedBuffer.h" |
#include "platform/heap/Handle.h" |
#include "platform/loader/fetch/SubstituteData.h" |
@@ -60,6 +62,7 @@ |
#include "platform/wtf/PtrUtil.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebURLRequest.h" |
+#include "public/platform/WebWorkerFetchContext.h" |
#include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" |
#include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
#include "public/web/WebConsoleMessage.h" |
@@ -433,6 +436,17 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { |
worker_clients, |
WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); |
+ if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
+ std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
+ WTF::WrapUnique( |
+ worker_context_client_->CreateServiceWorkerFetchContext()); |
+ DCHECK(web_worker_fetch_context); |
+ // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
+ // to |web_worker_fetch_context|. |
+ ProvideWorkerFetchContextToWorker(worker_clients, |
+ std::move(web_worker_fetch_context)); |
+ } |
+ |
// We need to set the CSP to both the shadow page's document and the |
// ServiceWorkerGlobalScope. |
document->InitContentSecurityPolicy( |