| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 scoped_refptr<ServiceWorkerVersion> version = | 736 scoped_refptr<ServiceWorkerVersion> version = |
| 737 context_->GetLiveVersion(data.version_id); | 737 context_->GetLiveVersion(data.version_id); |
| 738 if (!version) { | 738 if (!version) { |
| 739 version = new ServiceWorkerVersion(registration, data.version_id, context_); | 739 version = new ServiceWorkerVersion(registration, data.version_id, context_); |
| 740 version->SetStatus(data.is_active ? | 740 version->SetStatus(data.is_active ? |
| 741 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED); | 741 ServiceWorkerVersion::ACTIVE : ServiceWorkerVersion::INSTALLED); |
| 742 version->script_cache_map()->SetResources(resources); | 742 version->script_cache_map()->SetResources(resources); |
| 743 } | 743 } |
| 744 | 744 |
| 745 if (version->status() == ServiceWorkerVersion::ACTIVE) | 745 if (version->status() == ServiceWorkerVersion::ACTIVE) |
| 746 registration->set_active_version(version); | 746 registration->SetActiveVersion(version); |
| 747 else if (version->status() == ServiceWorkerVersion::INSTALLED) | 747 else if (version->status() == ServiceWorkerVersion::INSTALLED) |
| 748 registration->set_waiting_version(version); | 748 registration->SetWaitingVersion(version); |
| 749 else | 749 else |
| 750 NOTREACHED(); | 750 NOTREACHED(); |
| 751 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after | 751 // TODO(michaeln): Hmmm, what if DeleteReg was invoked after |
| 752 // the Find result we're returning here? NOTREACHED condition? | 752 // the Find result we're returning here? NOTREACHED condition? |
| 753 return registration; | 753 return registration; |
| 754 } | 754 } |
| 755 | 755 |
| 756 ServiceWorkerRegistration* | 756 ServiceWorkerRegistration* |
| 757 ServiceWorkerStorage::FindInstallingRegistrationForDocument( | 757 ServiceWorkerStorage::FindInstallingRegistrationForDocument( |
| 758 const GURL& document_url) { | 758 const GURL& document_url) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 // Give up the corruption recovery until the browser restarts. | 1089 // Give up the corruption recovery until the browser restarts. |
| 1090 LOG(ERROR) << "Failed to delete the diskcache."; | 1090 LOG(ERROR) << "Failed to delete the diskcache."; |
| 1091 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1091 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1092 return; | 1092 return; |
| 1093 } | 1093 } |
| 1094 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1094 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1095 callback.Run(SERVICE_WORKER_OK); | 1095 callback.Run(SERVICE_WORKER_OK); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 } // namespace content | 1098 } // namespace content |
| OLD | NEW |