| 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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 scoped_refptr<ServiceWorkerRegistration> | 1363 scoped_refptr<ServiceWorkerRegistration> |
| 1364 ServiceWorkerStorage::GetOrCreateRegistration( | 1364 ServiceWorkerStorage::GetOrCreateRegistration( |
| 1365 const ServiceWorkerDatabase::RegistrationData& data, | 1365 const ServiceWorkerDatabase::RegistrationData& data, |
| 1366 const ResourceList& resources) { | 1366 const ResourceList& resources) { |
| 1367 scoped_refptr<ServiceWorkerRegistration> registration = | 1367 scoped_refptr<ServiceWorkerRegistration> registration = |
| 1368 context_->GetLiveRegistration(data.registration_id); | 1368 context_->GetLiveRegistration(data.registration_id); |
| 1369 if (registration) | 1369 if (registration) |
| 1370 return registration; | 1370 return registration; |
| 1371 | 1371 |
| 1372 registration = new ServiceWorkerRegistration( | 1372 registration = new ServiceWorkerRegistration( |
| 1373 data.scope, data.registration_id, context_); | 1373 ServiceWorkerRegistrationOptions(data.scope), data.registration_id, |
| 1374 context_); |
| 1374 registration->set_resources_total_size_bytes(data.resources_total_size_bytes); | 1375 registration->set_resources_total_size_bytes(data.resources_total_size_bytes); |
| 1375 registration->set_last_update_check(data.last_update_check); | 1376 registration->set_last_update_check(data.last_update_check); |
| 1376 if (pending_deletions_.find(data.registration_id) != | 1377 if (pending_deletions_.find(data.registration_id) != |
| 1377 pending_deletions_.end()) { | 1378 pending_deletions_.end()) { |
| 1378 registration->set_is_deleted(true); | 1379 registration->set_is_deleted(true); |
| 1379 } | 1380 } |
| 1380 scoped_refptr<ServiceWorkerVersion> version = | 1381 scoped_refptr<ServiceWorkerVersion> version = |
| 1381 context_->GetLiveVersion(data.version_id); | 1382 context_->GetLiveVersion(data.version_id); |
| 1382 if (!version) { | 1383 if (!version) { |
| 1383 version = new ServiceWorkerVersion( | 1384 version = new ServiceWorkerVersion( |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1945 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1945 return; | 1946 return; |
| 1946 } | 1947 } |
| 1947 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1948 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1948 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( | 1949 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( |
| 1949 ServiceWorkerMetrics::DELETE_OK); | 1950 ServiceWorkerMetrics::DELETE_OK); |
| 1950 callback.Run(SERVICE_WORKER_OK); | 1951 callback.Run(SERVICE_WORKER_OK); |
| 1951 } | 1952 } |
| 1952 | 1953 |
| 1953 } // namespace content | 1954 } // namespace content |
| OLD | NEW |