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

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

Issue 475533007: Minor ServiceWorker cleanup. The Registration.Clear method can potentially generated multiple listn… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | no next file » | 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 cea1d5570ecab90b2cb0c02feed5cab115e45184..ce5686381e8009f90565288ad05e72d0f52d0433 100644
--- a/content/browser/service_worker/service_worker_registration.cc
+++ b/content/browser/service_worker/service_worker_registration.cc
@@ -275,19 +275,27 @@ void ServiceWorkerRegistration::OnDeleteFinished(
void ServiceWorkerRegistration::Clear() {
context_->storage()->NotifyDoneUninstallingRegistration(this);
- if (installing_version()) {
- installing_version()->Doom();
- UnsetVersion(installing_version());
+ ChangedVersionAttributesMask mask;
+ if (installing_version_) {
+ installing_version_->Doom();
+ installing_version_ = NULL;
+ mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION);
}
-
- if (waiting_version()) {
- waiting_version()->Doom();
- UnsetVersion(waiting_version());
+ if (waiting_version_) {
+ waiting_version_->Doom();
+ waiting_version_ = NULL;
+ mask.add(ChangedVersionAttributesMask::WAITING_VERSION);
}
-
- if (active_version()) {
- active_version()->Doom();
- UnsetVersion(active_version());
+ if (active_version_) {
+ active_version_->Doom();
+ active_version_->RemoveListener(this);
+ active_version_ = NULL;
+ mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION);
+ }
+ if (mask.changed()) {
+ ServiceWorkerRegistrationInfo info = GetInfo();
+ FOR_EACH_OBSERVER(Listener, listeners_,
+ OnVersionAttributesChanged(this, mask, info));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698