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

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

Issue 417043006: ServiceWorker: Make SWProviderHost listen to SWRegistration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_provider_host.cc
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
index 85ea2cae79391c90355ff0bb6b2fe5dfe5b4680a..386ae60b03176659b35e45eaabbba6db52ff7e4c 100644
--- a/content/browser/service_worker/service_worker_provider_host.cc
+++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -41,6 +41,20 @@ ServiceWorkerProviderHost::~ServiceWorkerProviderHost() {
waiting_version_->RemovePotentialControllee(this);
if (installing_version_)
installing_version_->RemovePotentialControllee(this);
+ if (associated_registration_)
+ associated_registration_->RemoveListener(this);
+}
+
+void ServiceWorkerProviderHost::OnVersionAttributesChanged(
+ ServiceWorkerRegistration* registration,
+ ChangedVersionAttributesMask changed_mask,
+ const ServiceWorkerRegistrationInfo& info) {
+ if (changed_mask.installing_changed())
+ SetInstallingVersion(registration->installing_version());
+ if (changed_mask.waiting_changed())
+ SetWaitingVersion(registration->waiting_version());
+ if (changed_mask.active_changed())
+ SetActiveVersion(registration->active_version());
}
void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) {
@@ -201,6 +215,15 @@ bool ServiceWorkerProviderHost::CanAssociateVersion(
version->registration_id();
}
+void ServiceWorkerProviderHost::AssociateRegistration(
+ ServiceWorkerRegistration* registration) {
+ DCHECK(registration);
+ if (!context_ || associated_registration_)
falken 2014/08/05 02:41:28 nit: Since AssociateRegistration only takes effect
nhiroki 2014/08/05 15:51:12 Done.
+ return;
+ associated_registration_ = registration;
+ registration->AddListener(this);
+}
+
void ServiceWorkerProviderHost::PostMessage(
const base::string16& message,
const std::vector<int>& sent_message_port_ids) {

Powered by Google App Engine
This is Rietveld 408576698