OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_database.h" | 5 #include "content/browser/service_worker/service_worker_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 // Duplicated resource id or url should not exist. | 507 // Duplicated resource id or url should not exist. |
508 DCHECK(pushed_resources.insert(itr->resource_id).second); | 508 DCHECK(pushed_resources.insert(itr->resource_id).second); |
509 DCHECK(pushed_urls.insert(itr->url).second); | 509 DCHECK(pushed_urls.insert(itr->url).second); |
510 | 510 |
511 PutResourceRecordToBatch(*itr, registration.version_id, &batch); | 511 PutResourceRecordToBatch(*itr, registration.version_id, &batch); |
512 | 512 |
513 // Delete a resource from the uncommitted list. | 513 // Delete a resource from the uncommitted list. |
514 batch.Delete(CreateResourceIdKey( | 514 batch.Delete(CreateResourceIdKey( |
515 kUncommittedResIdKeyPrefix, itr->resource_id)); | 515 kUncommittedResIdKeyPrefix, itr->resource_id)); |
| 516 // Delete from the purgeable list in case this version was once deleted. |
| 517 batch.Delete( |
| 518 CreateResourceIdKey(kPurgeableResIdKeyPrefix, itr->resource_id)); |
516 } | 519 } |
517 | 520 |
518 // Retrieve a previous version to sweep purgeable resources. | 521 // Retrieve a previous version to sweep purgeable resources. |
519 RegistrationData old_registration; | 522 RegistrationData old_registration; |
520 status = ReadRegistrationData(registration.registration_id, | 523 status = ReadRegistrationData(registration.registration_id, |
521 registration.scope.GetOrigin(), | 524 registration.scope.GetOrigin(), |
522 &old_registration); | 525 &old_registration); |
523 if (status != STATUS_OK && status != STATUS_ERROR_NOT_FOUND) | 526 if (status != STATUS_OK && status != STATUS_ERROR_NOT_FOUND) |
524 return status; | 527 return status; |
525 if (status == STATUS_OK) { | 528 if (status == STATUS_OK) { |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 | 1113 |
1111 void ServiceWorkerDatabase::HandleWriteResult( | 1114 void ServiceWorkerDatabase::HandleWriteResult( |
1112 const tracked_objects::Location& from_here, | 1115 const tracked_objects::Location& from_here, |
1113 Status status) { | 1116 Status status) { |
1114 if (status != STATUS_OK) | 1117 if (status != STATUS_OK) |
1115 Disable(from_here, status); | 1118 Disable(from_here, status); |
1116 ServiceWorkerMetrics::CountWriteDatabaseResult(status); | 1119 ServiceWorkerMetrics::CountWriteDatabaseResult(status); |
1117 } | 1120 } |
1118 | 1121 |
1119 } // namespace content | 1122 } // namespace content |
OLD | NEW |