| 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 12 matching lines...) Expand all Loading... |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 ServiceWorkerRegistration::ServiceWorkerRegistration( | 25 ServiceWorkerRegistration::ServiceWorkerRegistration( |
| 26 const GURL& pattern, | 26 const GURL& pattern, |
| 27 int64 registration_id, | 27 int64 registration_id, |
| 28 base::WeakPtr<ServiceWorkerContextCore> context) | 28 base::WeakPtr<ServiceWorkerContextCore> context) |
| 29 : pattern_(pattern), | 29 : pattern_(pattern), |
| 30 registration_id_(registration_id), | 30 registration_id_(registration_id), |
| 31 is_deleted_(false), | 31 is_deleted_(false), |
| 32 is_uninstalling_(false), | 32 is_uninstalling_(false), |
| 33 is_uninstalled_(false), |
| 33 should_activate_when_ready_(false), | 34 should_activate_when_ready_(false), |
| 34 context_(context) { | 35 context_(context) { |
| 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 36 DCHECK(context_); | 37 DCHECK(context_); |
| 37 context_->AddLiveRegistration(this); | 38 context_->AddLiveRegistration(this); |
| 38 } | 39 } |
| 39 | 40 |
| 40 ServiceWorkerRegistration::~ServiceWorkerRegistration() { | 41 ServiceWorkerRegistration::~ServiceWorkerRegistration() { |
| 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 42 DCHECK(!listeners_.might_have_observers()); | 43 DCHECK(!listeners_.might_have_observers()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 281 } |
| 281 | 282 |
| 282 void ServiceWorkerRegistration::OnDeleteFinished( | 283 void ServiceWorkerRegistration::OnDeleteFinished( |
| 283 ServiceWorkerStatusCode status) { | 284 ServiceWorkerStatusCode status) { |
| 284 // Intentionally empty completion callback, used to prevent | 285 // Intentionally empty completion callback, used to prevent |
| 285 // |this| from being deleted until the storage method completes. | 286 // |this| from being deleted until the storage method completes. |
| 286 } | 287 } |
| 287 | 288 |
| 288 void ServiceWorkerRegistration::Clear() { | 289 void ServiceWorkerRegistration::Clear() { |
| 289 is_uninstalling_ = false; | 290 is_uninstalling_ = false; |
| 291 is_uninstalled_ = true; |
| 290 if (context_) | 292 if (context_) |
| 291 context_->storage()->NotifyDoneUninstallingRegistration(this); | 293 context_->storage()->NotifyDoneUninstallingRegistration(this); |
| 292 | 294 |
| 293 ChangedVersionAttributesMask mask; | 295 ChangedVersionAttributesMask mask; |
| 294 if (installing_version_.get()) { | 296 if (installing_version_.get()) { |
| 295 installing_version_->Doom(); | 297 installing_version_->Doom(); |
| 296 installing_version_ = NULL; | 298 installing_version_ = NULL; |
| 297 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION); | 299 mask.add(ChangedVersionAttributesMask::INSTALLING_VERSION); |
| 298 } | 300 } |
| 299 if (waiting_version_.get()) { | 301 if (waiting_version_.get()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 324 if (!context_) { | 326 if (!context_) { |
| 325 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 327 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
| 326 return; | 328 return; |
| 327 } | 329 } |
| 328 context_->storage()->NotifyDoneInstallingRegistration( | 330 context_->storage()->NotifyDoneInstallingRegistration( |
| 329 this, version.get(), status); | 331 this, version.get(), status); |
| 330 callback.Run(status); | 332 callback.Run(status); |
| 331 } | 333 } |
| 332 | 334 |
| 333 } // namespace content | 335 } // namespace content |
| OLD | NEW |