Chromium Code Reviews| 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) { |