Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| index 9f0e0963d6edaa02f0cde45b4c88bd069791d8ba..159a8af8d838af4741794f65c8b271ceecc4e056 100644 |
| --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| @@ -37,6 +37,7 @@ |
| #include "core/loader/FrameLoadRequest.h" |
| #include "core/loader/FrameLoader.h" |
| #include "core/loader/ThreadableLoadingContext.h" |
| +#include "core/loader/WorkerFetchContext.h" |
| #include "core/probe/CoreProbes.h" |
| #include "core/workers/ParentFrameTaskRunners.h" |
| #include "core/workers/SharedWorkerGlobalScope.h" |
| @@ -48,6 +49,7 @@ |
| #include "core/workers/WorkerScriptLoader.h" |
| #include "core/workers/WorkerThreadStartupData.h" |
| #include "platform/CrossThreadFunctional.h" |
| +#include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/heap/Handle.h" |
| #include "platform/heap/Persistent.h" |
| #include "platform/loader/fetch/ResourceResponse.h" |
| @@ -61,6 +63,7 @@ |
| #include "public/platform/WebString.h" |
| #include "public/platform/WebURL.h" |
| #include "public/platform/WebURLRequest.h" |
| +#include "public/platform/WebWorkerFetchContext.h" |
| #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" |
| #include "public/web/WebDevToolsAgent.h" |
| #include "public/web/WebFrame.h" |
| @@ -339,6 +342,17 @@ void WebSharedWorkerImpl::OnScriptLoaderFinished() { |
| web_security_origin))); |
| ProvideIndexedDBClientToWorker(worker_clients, |
| IndexedDBClientImpl::Create(*worker_clients)); |
| + |
| + if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| + std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
| + WTF::WrapUnique(client_->CreateWorkerFetchContext()); |
| + DCHECK(web_worker_fetch_context); |
|
kinuko
2017/04/20 04:08:14
We could get ServiceWorkerNetworkProvider here and
horo
2017/04/20 08:35:43
Done.
|
| + // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
| + // to |web_worker_fetch_context|. |
| + ProvideWorkerFetchContextToWorker(worker_clients, |
| + std::move(web_worker_fetch_context)); |
| + } |
| + |
| ContentSecurityPolicy* content_security_policy = |
| main_script_loader_->ReleaseContentSecurityPolicy(); |
| WorkerThreadStartMode start_mode = |
| @@ -423,6 +437,13 @@ void WebSharedWorkerImpl::DispatchDevToolsMessage(int session_id, |
| message); |
| } |
| +WebServiceWorkerNetworkProvider* |
| +WebSharedWorkerImpl::GetServiceWorkerNetworkProvider() { |
| + WebLocalFrameImpl* webFrame = |
| + WebLocalFrameImpl::FromFrame(main_frame_->GetFrame()); |
| + return webFrame->DataSource()->GetServiceWorkerNetworkProvider(); |
| +} |
| + |
| WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
| return new WebSharedWorkerImpl(client); |
| } |