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

Unified Diff: content/browser/service_worker/embedded_worker_instance.cc

Issue 1708583003: Pass data saver pref value into embedded worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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: content/browser/service_worker/embedded_worker_instance.cc
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc
index 25a9751a2134ab42b6447ded766032b035d2e840..8c745015fe06a230cfe0fc0698fe9abc7d68396f 100644
--- a/content/browser/service_worker/embedded_worker_instance.cc
+++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -17,6 +17,7 @@
#include "content/common/content_switches_internal.h"
#include "content/common/mojo/service_registry_impl.h"
#include "content/common/service_worker/embedded_worker_messages.h"
+#include "content/common/service_worker/embedded_worker_settings.h"
#include "content/common/service_worker/embedded_worker_setup.mojom.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/public/browser/browser_thread.h"
@@ -249,7 +250,8 @@ class EmbeddedWorkerInstance::StartTask {
scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params,
ServiceWorkerStatusCode status,
int process_id,
- bool is_new_process) {
+ bool is_new_process,
+ const EmbeddedWorkerSettings& settings) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
TRACE_EVENT_ASYNC_END1("ServiceWorker",
"EmbeddedWorkerInstance::ProcessAllocate",
@@ -269,6 +271,10 @@ class EmbeddedWorkerInstance::StartTask {
instance_->OnProcessAllocated(make_scoped_ptr(new WorkerProcessHandle(
instance_->context_, instance_->embedded_worker_id(), process_id)));
+ // TODO(bengr): Support changes to this setting while the worker
+ // is running.
+ params->settings.data_saver_enabled = settings.data_saver_enabled;
+
// Register the instance to DevToolsManager on UI thread.
const int64_t service_worker_version_id = params->service_worker_version_id;
GURL script_url(params->script_url);
@@ -364,7 +370,7 @@ void EmbeddedWorkerInstance::Start(int64_t service_worker_version_id,
params->script_url = script_url;
params->worker_devtools_agent_route_id = MSG_ROUTING_NONE;
params->wait_for_debugger = false;
- params->v8_cache_options = GetV8CacheOptions();
+ params->settings.v8_cache_options = GetV8CacheOptions();
inflight_start_task_.reset(new StartTask(this));
inflight_start_task_->Start(std::move(params), callback);

Powered by Google App Engine
This is Rietveld 408576698