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

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

Issue 2455493002: service worker: Propagate navigation preload flag to SWVersion. (Closed)
Patch Set: more comment Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_registration_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_registration.cc
diff --git a/content/browser/service_worker/service_worker_registration.cc b/content/browser/service_worker/service_worker_registration.cc
index 92e3051d758ccc6e7343884db08f8c3920ba3d48..aed07474996b3601dcb782ba9e479adbf713c70c 100644
--- a/content/browser/service_worker/service_worker_registration.cc
+++ b/content/browser/service_worker/service_worker_registration.cc
@@ -121,8 +121,11 @@ void ServiceWorkerRegistration::SetActiveVersion(
if (active_version_)
active_version_->RemoveListener(this);
active_version_ = version;
- if (active_version_)
+ if (active_version_) {
active_version_->AddListener(this);
+ active_version_->set_navigation_preload_enabled(
+ is_navigation_preload_enabled_);
+ }
mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION);
NotifyVersionAttributesChanged(mask);
@@ -396,8 +399,11 @@ void ServiceWorkerRegistration::SetTaskRunnerForTest(
}
void ServiceWorkerRegistration::EnableNavigationPreload(bool enable) {
- // TODO(falken): Propagate to current versions and new versions.
+ if (is_navigation_preload_enabled_ == enable)
+ return;
is_navigation_preload_enabled_ = enable;
+ if (active_version_)
+ active_version_->set_navigation_preload_enabled(enable);
}
void ServiceWorkerRegistration::RegisterRegistrationFinishedCallback(
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_registration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698