| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 info.waiting_version = version->GetInfo(); | 1061 info.waiting_version = version->GetInfo(); |
| 1062 infos.push_back(info); | 1062 infos.push_back(info); |
| 1063 continue; | 1063 continue; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 if (registration_data.is_active) { | 1066 if (registration_data.is_active) { |
| 1067 info.active_version.status = ServiceWorkerVersion::ACTIVATED; | 1067 info.active_version.status = ServiceWorkerVersion::ACTIVATED; |
| 1068 info.active_version.script_url = registration_data.script; | 1068 info.active_version.script_url = registration_data.script; |
| 1069 info.active_version.version_id = registration_data.version_id; | 1069 info.active_version.version_id = registration_data.version_id; |
| 1070 info.active_version.registration_id = registration_data.registration_id; | 1070 info.active_version.registration_id = registration_data.registration_id; |
| 1071 info.active_version.fetch_handler_existence = |
| 1072 registration_data.has_fetch_handler |
| 1073 ? ServiceWorkerVersion::FetchHandlerExistence::EXISTS |
| 1074 : ServiceWorkerVersion::FetchHandlerExistence::DOES_NOT_EXIST; |
| 1071 } else { | 1075 } else { |
| 1072 info.waiting_version.status = ServiceWorkerVersion::INSTALLED; | 1076 info.waiting_version.status = ServiceWorkerVersion::INSTALLED; |
| 1073 info.waiting_version.script_url = registration_data.script; | 1077 info.waiting_version.script_url = registration_data.script; |
| 1074 info.waiting_version.version_id = registration_data.version_id; | 1078 info.waiting_version.version_id = registration_data.version_id; |
| 1075 info.waiting_version.registration_id = registration_data.registration_id; | 1079 info.waiting_version.registration_id = registration_data.registration_id; |
| 1080 info.waiting_version.fetch_handler_existence = |
| 1081 registration_data.has_fetch_handler |
| 1082 ? ServiceWorkerVersion::FetchHandlerExistence::EXISTS |
| 1083 : ServiceWorkerVersion::FetchHandlerExistence::DOES_NOT_EXIST; |
| 1076 } | 1084 } |
| 1077 infos.push_back(info); | 1085 infos.push_back(info); |
| 1078 } | 1086 } |
| 1079 | 1087 |
| 1080 // Add unstored registrations that are being installed. | 1088 // Add unstored registrations that are being installed. |
| 1081 for (const auto& registration : installing_registrations_) { | 1089 for (const auto& registration : installing_registrations_) { |
| 1082 if ((!origin_filter.is_valid() || | 1090 if ((!origin_filter.is_valid() || |
| 1083 registration.second->pattern().GetOrigin() == origin_filter) && | 1091 registration.second->pattern().GetOrigin() == origin_filter) && |
| 1084 pushed_registrations.insert(registration.first).second) { | 1092 pushed_registrations.insert(registration.first).second) { |
| 1085 infos.push_back(registration.second->GetInfo()); | 1093 infos.push_back(registration.second->GetInfo()); |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1785 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1778 return; | 1786 return; |
| 1779 } | 1787 } |
| 1780 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1788 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1781 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( | 1789 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( |
| 1782 ServiceWorkerMetrics::DELETE_OK); | 1790 ServiceWorkerMetrics::DELETE_OK); |
| 1783 callback.Run(SERVICE_WORKER_OK); | 1791 callback.Run(SERVICE_WORKER_OK); |
| 1784 } | 1792 } |
| 1785 | 1793 |
| 1786 } // namespace content | 1794 } // namespace content |
| OLD | NEW |