| 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_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 CompleteInternal(status); | 383 CompleteInternal(status); |
| 384 context_->job_coordinator()->FinishJob(pattern_, this); | 384 context_->job_coordinator()->FinishJob(pattern_, this); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void ServiceWorkerRegisterJob::CompleteInternal( | 387 void ServiceWorkerRegisterJob::CompleteInternal( |
| 388 ServiceWorkerStatusCode status) { | 388 ServiceWorkerStatusCode status) { |
| 389 SetPhase(COMPLETE); | 389 SetPhase(COMPLETE); |
| 390 if (status != SERVICE_WORKER_OK) { | 390 if (status != SERVICE_WORKER_OK) { |
| 391 if (registration()) { | 391 if (registration()) { |
| 392 if (new_version()) { | 392 if (new_version()) { |
| 393 new_version()->SetStatus(ServiceWorkerVersion::REDUNDANT); | |
| 394 DisassociateVersionFromDocuments(context_, new_version()); | 393 DisassociateVersionFromDocuments(context_, new_version()); |
| 395 registration()->UnsetVersion(new_version()); | 394 registration()->UnsetVersion(new_version()); |
| 395 new_version()->Doom(); |
| 396 } | 396 } |
| 397 if (!registration()->active_version()) { | 397 if (!registration()->active_version()) { |
| 398 context_->storage()->DeleteRegistration( | 398 context_->storage()->DeleteRegistration( |
| 399 registration()->id(), | 399 registration()->id(), |
| 400 registration()->script_url().GetOrigin(), | 400 registration()->script_url().GetOrigin(), |
| 401 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 401 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 if (!is_promise_resolved_) | 404 if (!is_promise_resolved_) |
| 405 ResolvePromise(status, NULL, NULL); | 405 ResolvePromise(status, NULL, NULL); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 DCHECK(context); | 511 DCHECK(context); |
| 512 for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = | 512 for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = |
| 513 context->GetProviderHostIterator(); | 513 context->GetProviderHostIterator(); |
| 514 !it->IsAtEnd(); it->Advance()) { | 514 !it->IsAtEnd(); it->Advance()) { |
| 515 ServiceWorkerProviderHost* host = it->GetProviderHost(); | 515 ServiceWorkerProviderHost* host = it->GetProviderHost(); |
| 516 host->UnsetVersion(version); | 516 host->UnsetVersion(version); |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 } // namespace content | 520 } // namespace content |
| OLD | NEW |