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

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

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: fix #include "public/web/WebDataSaverFlag.h" 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/web/WebSharedWorkerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
index 32ec2662dc4e7040ec1b49518cbed60f71732cf5..1dfd539fd82f6103aa8c31843834a9175c508984 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -123,7 +123,7 @@ void WebSharedWorkerImpl::TerminateWorkerThread() {
worker_inspector_proxy_->WorkerThreadTerminated();
}
-void WebSharedWorkerImpl::InitializeLoader() {
+void WebSharedWorkerImpl::InitializeLoader(WebDataSaverFlag data_saver_flag) {
DCHECK(IsMainThread());
// Create 'shadow page'. This page is never displayed, it is used to proxy the
@@ -134,6 +134,7 @@ void WebSharedWorkerImpl::InitializeLoader() {
// FIXME: http://crbug.com/363843. This needs to find a better way to
// not create graphics layers.
web_view_->GetSettings()->SetAcceleratedCompositingEnabled(false);
+ web_view_->GetSettings()->SetDataSaverFlag(data_saver_flag);
// FIXME: Settings information should be passed to the Worker process from
// Browser process when the worker is created (similar to
// RenderThread::OnCreateNewView).
@@ -291,12 +292,13 @@ void WebSharedWorkerImpl::StartWorkerContext(
const WebString& name,
const WebString& content_security_policy,
WebContentSecurityPolicyType policy_type,
- WebAddressSpace creation_address_space) {
+ WebAddressSpace creation_address_space,
+ WebDataSaverFlag data_saver_flag) {
DCHECK(IsMainThread());
url_ = url;
name_ = name;
creation_address_space_ = creation_address_space;
- InitializeLoader();
+ InitializeLoader(data_saver_flag);
}
void WebSharedWorkerImpl::DidReceiveScriptLoaderResponse() {
@@ -347,8 +349,8 @@ void WebSharedWorkerImpl::OnScriptLoaderFinished() {
DCHECK(web_worker_fetch_context);
// TODO(horo): Set more information about the context (ex: AppCacheHostID)
// to |web_worker_fetch_context|.
- web_worker_fetch_context->SetDataSaverEnabled(
- document->GetFrame()->GetSettings()->GetDataSaverEnabled());
+ web_worker_fetch_context->SetDataSaverFlag(
+ document->GetFrame()->GetSettings()->GetDataSaverFlag());
ProvideWorkerFetchContextToWorker(worker_clients,
std::move(web_worker_fetch_context));
}

Powered by Google App Engine
This is Rietveld 408576698