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

Unified Diff: third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp

Issue 2886663002: DataSaver support for off-main-thread-fetch (Closed)
Patch Set: rebase on TOT Created 3 years, 7 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/core/loader/WorkerFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
index 767f6dca3b81059c7a2a0d2b34888677b1e9ca30..d4830069f643e0b183069986e0f4e13af1dbf27d 100644
--- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
@@ -173,6 +173,18 @@ RefPtr<WebTaskRunner> WorkerFetchContext::LoadingTaskRunner() const {
return loading_task_runner_;
}
+void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request,
+ FetchResourceType type) {
+ BaseFetchContext::AddAdditionalRequestHeaders(request, type);
+
+ // The remaining modifications are only necessary for HTTP and HTTPS.
+ if (!request.Url().IsEmpty() && !request.Url().ProtocolIsInHTTPFamily())
+ return;
+
+ if (web_context_->IsDataSaverEnabled())
+ request.SetHTTPHeaderField("Save-Data", "on");
+}
+
DEFINE_TRACE(WorkerFetchContext) {
visitor->Trace(worker_global_scope_);
visitor->Trace(resource_fetcher_);

Powered by Google App Engine
This is Rietveld 408576698