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

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

Issue 2701753003: [WIP] off-main-thread loading
Patch Set: small fix 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 626956c7ecc84603cab1db5d46b7f5b7bff3f99a..2c70a201e9154470227aaf278aff07d9372fa47d 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"
@@ -333,6 +334,7 @@ void WebEmbeddedWorkerImpl::loadShadowPage() {
void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) {
DCHECK_EQ(frame, m_mainFrame);
DCHECK(!m_mainScriptLoader);
+ DCHECK(!m_webWorkerFetchContextInfo);
DCHECK(m_mainFrame);
DCHECK(m_workerContextClient);
DCHECK(m_loadingShadowPage);
@@ -340,6 +342,8 @@ void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) {
m_loadingShadowPage = false;
frame->dataSource()->setServiceWorkerNetworkProvider(WTF::wrapUnique(
m_workerContextClient->createServiceWorkerNetworkProvider()));
+ m_webWorkerFetchContextInfo = WTF::wrapUnique(
+ m_workerContextClient->createServiceWorkerFetchContextInfo());
m_mainScriptLoader = WorkerScriptLoader::create();
m_mainScriptLoader->setRequestContext(
WebURLRequest::RequestContextServiceWorker);
@@ -430,6 +434,16 @@ void WebEmbeddedWorkerImpl::startWorkerThread() {
workerClients,
WTF::wrapUnique(m_workerContextClient->createServiceWorkerProvider()));
+ // |m_webWorkerFetchContextInfo| is null if off-main-thread-fetch is disabled.
+ if (m_webWorkerFetchContextInfo) {
+ provideWorkerFetchContextInfoToWorker(
+ workerClients, std::move(m_webWorkerFetchContextInfo));
+ WorkerFetchContextInfo* workerFetchContextInfo =
+ WorkerFetchContextInfo::from(*workerClients);
+ workerFetchContextInfo->setDataSaverEnabled(
+ document->frame()->settings()->getDataSaverEnabled());
+ }
+
// We need to set the CSP to both the shadow page's document and the
// ServiceWorkerGlobalScope.
document->initContentSecurityPolicy(
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698