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

Unified Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.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
« no previous file with comments | « third_party/WebKit/Source/web/WebRuntimeFeatures.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 df1c855549616284cc81191861fa9a16353e306a..02e2ad204a435d468a07235650e2c0cc8be424a9 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -38,6 +38,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"
@@ -50,6 +51,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"
@@ -63,6 +65,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"
@@ -327,6 +330,20 @@ void WebSharedWorkerImpl::OnScriptLoaderFinished() {
web_security_origin)));
ProvideIndexedDBClientToWorker(worker_clients,
IndexedDBClientImpl::Create(*worker_clients));
+
+ if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
+ std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context =
+ client_->CreateWorkerFetchContext(
+ WebLocalFrameImpl::FromFrame(main_frame_->GetFrame())
+ ->DataSource()
+ ->GetServiceWorkerNetworkProvider());
+ 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));
+ }
+
ContentSecurityPolicy* content_security_policy =
main_script_loader_->ReleaseContentSecurityPolicy();
WorkerThreadStartMode start_mode =
« no previous file with comments | « third_party/WebKit/Source/web/WebRuntimeFeatures.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698