| 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_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (!version) { | 653 if (!version) { |
| 654 version = new ServiceWorkerVersion(registration, data.version_id, context_); | 654 version = new ServiceWorkerVersion(registration, data.version_id, context_); |
| 655 version->SetStatus(data.is_active ? | 655 version->SetStatus(data.is_active ? |
| 656 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED); | 656 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED); |
| 657 version->script_cache_map()->SetResources(resources); | 657 version->script_cache_map()->SetResources(resources); |
| 658 } | 658 } |
| 659 | 659 |
| 660 if (version->status() == ServiceWorkerVersion::ACTIVE) | 660 if (version->status() == ServiceWorkerVersion::ACTIVE) |
| 661 registration->set_active_version(version); | 661 registration->set_active_version(version); |
| 662 else if (version->status() == ServiceWorkerVersion::INSTALLED) | 662 else if (version->status() == ServiceWorkerVersion::INSTALLED) |
| 663 registration->set_pending_version(version); | 663 registration->set_waiting_version(version); |
| 664 else | 664 else |
| 665 NOTREACHED(); | 665 NOTREACHED(); |
| 666 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after | 666 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after |
| 667 // the Find result we're returning here? NOTREACHED condition? | 667 // the Find result we're returning here? NOTREACHED condition? |
| 668 return registration; | 668 return registration; |
| 669 } | 669 } |
| 670 | 670 |
| 671 ServiceWorkerRegistration* | 671 ServiceWorkerRegistration* |
| 672 ServiceWorkerStorage::FindInstallingRegistrationForDocument( | 672 ServiceWorkerStorage::FindInstallingRegistrationForDocument( |
| 673 const GURL& document_url) { | 673 const GURL& document_url) { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 const FindInDBCallback& callback) { | 950 const FindInDBCallback& callback) { |
| 951 ServiceWorkerDatabase::RegistrationData data; | 951 ServiceWorkerDatabase::RegistrationData data; |
| 952 ResourceList resources; | 952 ResourceList resources; |
| 953 ServiceWorkerDatabase::Status status = | 953 ServiceWorkerDatabase::Status status = |
| 954 database->ReadRegistration(registration_id, origin, &data, &resources); | 954 database->ReadRegistration(registration_id, origin, &data, &resources); |
| 955 original_task_runner->PostTask( | 955 original_task_runner->PostTask( |
| 956 FROM_HERE, base::Bind(callback, data, resources, status)); | 956 FROM_HERE, base::Bind(callback, data, resources, status)); |
| 957 } | 957 } |
| 958 | 958 |
| 959 } // namespace content | 959 } // namespace content |
| OLD | NEW |