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

Unified Diff: content/browser/service_worker/service_worker_process_manager.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/service_worker_process_manager.cc
diff --git a/content/browser/service_worker/service_worker_process_manager.cc b/content/browser/service_worker/service_worker_process_manager.cc
index a6a239465e9e7213206d97d494eeee810d348e70..b04ac64493705bf28acbbd3ebaa6211b9b05a53a 100644
--- a/content/browser/service_worker/service_worker_process_manager.cc
+++ b/content/browser/service_worker/service_worker_process_manager.cc
@@ -11,9 +11,12 @@
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
+#include "content/common/service_worker/embedded_worker_settings.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/site_instance.h"
#include "content/public/common/child_process_host.h"
+#include "content/public/common/content_client.h"
#include "url/gurl.h"
namespace content {
@@ -136,7 +139,8 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
bool can_use_existing_process,
const base::Callback<void(ServiceWorkerStatusCode,
int process_id,
- bool is_new_process)>& callback) {
+ bool is_new_process,
+ const EmbeddedWorkerSettings&)>& callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -146,6 +150,10 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
return;
}
+ EmbeddedWorkerSettings settings;
+ settings.data_saver_enabled =
+ GetContentClient()->browser()->IsDataSaverEnabled(browser_context_);
falken 2016/02/19 06:58:35 We should add a comment that this the EWSettings f
bengr 2016/03/07 23:35:29 Done.
+
if (process_id_for_test_ != ChildProcessHost::kInvalidUniqueID) {
// Let tests specify the returned process ID. Note: We may need to be able
// to specify the error code too.
@@ -153,7 +161,7 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
: new_process_id_for_test_;
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(callback, SERVICE_WORKER_OK, result,
- false /* is_new_process */));
+ false /* is_new_process */, settings));
return;
}
@@ -161,7 +169,7 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(callback, SERVICE_WORKER_ERROR_ABORT,
ChildProcessHost::kInvalidUniqueID,
- false /* is_new_process */));
+ false /* is_new_process */, settings));
return;
}
@@ -179,7 +187,7 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(callback, SERVICE_WORKER_OK, process_id,
- false /* is_new_process */));
+ false /* is_new_process */, settings));
return;
}
}
@@ -198,7 +206,7 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
BrowserThread::IO, FROM_HERE,
base::Bind(callback, SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND,
ChildProcessHost::kInvalidUniqueID,
- false /* is_new_process */));
+ false /* is_new_process */, settings));
return;
}
@@ -208,7 +216,7 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
rph->IncrementWorkerRefCount();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(callback, SERVICE_WORKER_OK, rph->GetID(),
- true /* is_new_process */));
+ true /* is_new_process */, settings));
}
void ServiceWorkerProcessManager::ReleaseWorkerProcess(int embedded_worker_id) {

Powered by Google App Engine
This is Rietveld 408576698