| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 void ServiceWorkerRegisterJob::CompleteInternal( | 444 void ServiceWorkerRegisterJob::CompleteInternal( |
| 445 ServiceWorkerStatusCode status, | 445 ServiceWorkerStatusCode status, |
| 446 const std::string& status_message) { | 446 const std::string& status_message) { |
| 447 SetPhase(COMPLETE); | 447 SetPhase(COMPLETE); |
| 448 if (status != SERVICE_WORKER_OK) { | 448 if (status != SERVICE_WORKER_OK) { |
| 449 if (registration()) { | 449 if (registration()) { |
| 450 if (should_uninstall_on_failure_) | 450 if (should_uninstall_on_failure_) |
| 451 registration()->ClearWhenReady(); | 451 registration()->ClearWhenReady(); |
| 452 if (new_version()) { | 452 if (new_version()) { |
| 453 if (status != SERVICE_WORKER_ERROR_EXISTS) | 453 if (status == SERVICE_WORKER_ERROR_EXISTS) |
| 454 new_version()->SetStartWorkerStatusCode(SERVICE_WORKER_ERROR_EXISTS); |
| 455 else |
| 454 new_version()->ReportError(status, status_message); | 456 new_version()->ReportError(status, status_message); |
| 455 registration()->UnsetVersion(new_version()); | 457 registration()->UnsetVersion(new_version()); |
| 456 new_version()->Doom(); | 458 new_version()->Doom(); |
| 457 } | 459 } |
| 458 if (!registration()->waiting_version() && | 460 if (!registration()->waiting_version() && |
| 459 !registration()->active_version()) { | 461 !registration()->active_version()) { |
| 460 registration()->NotifyRegistrationFailed(); | 462 registration()->NotifyRegistrationFailed(); |
| 461 context_->storage()->DeleteRegistration( | 463 context_->storage()->DeleteRegistration( |
| 462 registration()->id(), | 464 registration()->id(), |
| 463 registration()->pattern().GetOrigin(), | 465 registration()->pattern().GetOrigin(), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (host->IsHostToRunningServiceWorker()) | 555 if (host->IsHostToRunningServiceWorker()) |
| 554 continue; | 556 continue; |
| 555 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 557 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
| 556 host->document_url())) | 558 host->document_url())) |
| 557 continue; | 559 continue; |
| 558 host->AddMatchingRegistration(registration); | 560 host->AddMatchingRegistration(registration); |
| 559 } | 561 } |
| 560 } | 562 } |
| 561 | 563 |
| 562 } // namespace content | 564 } // namespace content |
| OLD | NEW |