| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "content/browser/service_worker/embedded_worker_status.h" | 9 #include "content/browser/service_worker/embedded_worker_status.h" |
| 10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 const scoped_refptr<ServiceWorkerVersion>& version) { | 350 const scoped_refptr<ServiceWorkerVersion>& version) { |
| 351 DCHECK_EQ(id(), version->registration_id()); | 351 DCHECK_EQ(id(), version->registration_id()); |
| 352 | 352 |
| 353 UnsetVersion(version.get()); | 353 UnsetVersion(version.get()); |
| 354 | 354 |
| 355 for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = | 355 for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = |
| 356 context_->GetProviderHostIterator(); | 356 context_->GetProviderHostIterator(); |
| 357 !it->IsAtEnd(); it->Advance()) { | 357 !it->IsAtEnd(); it->Advance()) { |
| 358 ServiceWorkerProviderHost* host = it->GetProviderHost(); | 358 ServiceWorkerProviderHost* host = it->GetProviderHost(); |
| 359 if (host->controlling_version() == version) | 359 if (host->controlling_version() == version) |
| 360 host->NotifyControllerLost(); | 360 host->NotifyControllerLost(true /* was_deleted */); |
| 361 } | 361 } |
| 362 | 362 |
| 363 version->Doom(); | 363 version->Doom(); |
| 364 | 364 |
| 365 if (!active_version() && !waiting_version()) { | 365 if (!active_version() && !waiting_version()) { |
| 366 // Delete the records from the db. | 366 // Delete the records from the db. |
| 367 context_->storage()->DeleteRegistration( | 367 context_->storage()->DeleteRegistration( |
| 368 id(), pattern().GetOrigin(), | 368 id(), pattern().GetOrigin(), |
| 369 base::Bind(&ServiceWorkerRegistration::OnDeleteFinished, this)); | 369 base::Bind(&ServiceWorkerRegistration::OnDeleteFinished, this)); |
| 370 // But not from memory if there is a version in the pipeline. | 370 // But not from memory if there is a version in the pipeline. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 if (!context_) { | 513 if (!context_) { |
| 514 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 514 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
| 515 return; | 515 return; |
| 516 } | 516 } |
| 517 context_->storage()->NotifyDoneInstallingRegistration( | 517 context_->storage()->NotifyDoneInstallingRegistration( |
| 518 this, version.get(), status); | 518 this, version.get(), status); |
| 519 callback.Run(status); | 519 callback.Run(status); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace content | 522 } // namespace content |
| OLD | NEW |