| OLD | NEW |
| 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/browser/service_worker/service_worker_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
| 6 | 6 |
| 7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
| 8 #include "content/browser/service_worker/service_worker_info.h" | 8 #include "content/browser/service_worker/service_worker_info.h" |
| 9 #include "content/browser/service_worker/service_worker_register_job.h" | 9 #include "content/browser/service_worker/service_worker_register_job.h" |
| 10 #include "content/browser/service_worker/service_worker_utils.h" | 10 #include "content/browser/service_worker/service_worker_utils.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 void ServiceWorkerRegistration::OnDeleteFinished( | 269 void ServiceWorkerRegistration::OnDeleteFinished( |
| 270 ServiceWorkerStatusCode status) { | 270 ServiceWorkerStatusCode status) { |
| 271 // Intentionally empty completion callback, used to prevent | 271 // Intentionally empty completion callback, used to prevent |
| 272 // |this| from being deleted until the storage method completes. | 272 // |this| from being deleted until the storage method completes. |
| 273 } | 273 } |
| 274 | 274 |
| 275 void ServiceWorkerRegistration::Clear() { | 275 void ServiceWorkerRegistration::Clear() { |
| 276 context_->storage()->NotifyDoneUninstallingRegistration(this); | 276 context_->storage()->NotifyDoneUninstallingRegistration(this); |
| 277 | 277 |
| 278 if (installing_version()) { | 278 ChangedVersionAttributesMask mask; |
| 279 installing_version()->Doom(); | 279 if (installing_version_) { |
| 280 UnsetVersion(installing_version()); | 280 installing_version_->Doom(); |
| 281 installing_version_ = NULL; |
| 282 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION); |
| 281 } | 283 } |
| 282 | 284 if (waiting_version_) { |
| 283 if (waiting_version()) { | 285 waiting_version_->Doom(); |
| 284 waiting_version()->Doom(); | 286 waiting_version_ = NULL; |
| 285 UnsetVersion(waiting_version()); | 287 mask.add(ChangedVersionAttributesMask::WAITING_VERSION); |
| 286 } | 288 } |
| 287 | 289 if (active_version_) { |
| 288 if (active_version()) { | 290 active_version_->Doom(); |
| 289 active_version()->Doom(); | 291 active_version_->RemoveListener(this); |
| 290 UnsetVersion(active_version()); | 292 active_version_ = NULL; |
| 293 mask.add(ChangedVersionAttributesMask::ACTIVE_VERSION); |
| 294 } |
| 295 if (mask.changed()) { |
| 296 ServiceWorkerRegistrationInfo info = GetInfo(); |
| 297 FOR_EACH_OBSERVER(Listener, listeners_, |
| 298 OnVersionAttributesChanged(this, mask, info)); |
| 291 } | 299 } |
| 292 } | 300 } |
| 293 | 301 |
| 294 void ServiceWorkerRegistration::OnStoreFinished( | 302 void ServiceWorkerRegistration::OnStoreFinished( |
| 295 scoped_refptr<ServiceWorkerVersion> version, | 303 scoped_refptr<ServiceWorkerVersion> version, |
| 296 ServiceWorkerStatusCode status) { | 304 ServiceWorkerStatusCode status) { |
| 297 if (!context_) | 305 if (!context_) |
| 298 return; | 306 return; |
| 299 context_->storage()->NotifyDoneInstallingRegistration( | 307 context_->storage()->NotifyDoneInstallingRegistration( |
| 300 this, version.get(), status); | 308 this, version.get(), status); |
| 301 } | 309 } |
| 302 | 310 |
| 303 } // namespace content | 311 } // namespace content |
| OLD | NEW |