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

Side by Side Diff: content/renderer/service_worker/embedded_worker_dispatcher.cc

Issue 1708583003: Pass data saver pref value into embedded worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" 5 #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 NULL), 90 NULL),
91 params.worker_devtools_agent_route_id)); 91 params.worker_devtools_agent_route_id));
92 92
93 blink::WebEmbeddedWorkerStartData start_data; 93 blink::WebEmbeddedWorkerStartData start_data;
94 start_data.scriptURL = params.script_url; 94 start_data.scriptURL = params.script_url;
95 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent()); 95 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent());
96 start_data.waitForDebuggerMode = 96 start_data.waitForDebuggerMode =
97 params.wait_for_debugger ? 97 params.wait_for_debugger ?
98 blink::WebEmbeddedWorkerStartData::WaitForDebugger : 98 blink::WebEmbeddedWorkerStartData::WaitForDebugger :
99 blink::WebEmbeddedWorkerStartData::DontWaitForDebugger; 99 blink::WebEmbeddedWorkerStartData::DontWaitForDebugger;
100 start_data.v8CacheOptions = 100 start_data.v8CacheOptions = static_cast<blink::WebSettings::V8CacheOptions>(
101 static_cast<blink::WebSettings::V8CacheOptions>(params.v8_cache_options); 101 params.settings.v8_cache_options);
102 start_data.dataSaverEnabled = params.settings.data_saver_enabled;
102 start_data.pauseAfterDownloadMode = 103 start_data.pauseAfterDownloadMode =
103 params.pause_after_download 104 params.pause_after_download
104 ? blink::WebEmbeddedWorkerStartData::PauseAfterDownload 105 ? blink::WebEmbeddedWorkerStartData::PauseAfterDownload
105 : blink::WebEmbeddedWorkerStartData::DontPauseAfterDownload; 106 : blink::WebEmbeddedWorkerStartData::DontPauseAfterDownload;
106 107
107 wrapper->worker()->startWorkerContext(start_data); 108 wrapper->worker()->startWorkerContext(start_data);
108 workers_.AddWithID(wrapper.release(), params.embedded_worker_id); 109 workers_.AddWithID(wrapper.release(), params.embedded_worker_id);
109 } 110 }
110 111
111 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) { 112 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) {
(...skipping 16 matching lines...) Expand all
128 "EmbeddedWorkerDispatcher::OnResumeAfterDownload"); 129 "EmbeddedWorkerDispatcher::OnResumeAfterDownload");
129 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); 130 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id);
130 if (!wrapper) { 131 if (!wrapper) {
131 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker"; 132 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker";
132 return; 133 return;
133 } 134 }
134 wrapper->worker()->resumeAfterDownload(); 135 wrapper->worker()->resumeAfterDownload();
135 } 136 }
136 137
137 } // namespace content 138 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/content_browser_client.cc ('k') | content/test/data/service_worker/add_save_data_to_title.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698