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