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

Unified Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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 1b4d6eb2324f29d5f3f4af7e1e5f16dc3a176f0b..897aa7290d2589bfe95b78d62440378a2a1af6b1 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -39,6 +39,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"
@@ -51,6 +52,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"
@@ -62,6 +64,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"
@@ -419,6 +422,17 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() {
worker_clients,
WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider()));
+ if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
+ std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context =
+
+ 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(

Powered by Google App Engine
This is Rietveld 408576698