| 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 "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 ServiceWorkerDatabase::WritePurgeableResourceIds(const std::set<int64>& ids) { | 1042 ServiceWorkerDatabase::WritePurgeableResourceIds(const std::set<int64>& ids) { |
| 1043 return WriteResourceIds(kPurgeableResIdKeyPrefix, ids); | 1043 return WriteResourceIds(kPurgeableResIdKeyPrefix, ids); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 ServiceWorkerDatabase::Status | 1046 ServiceWorkerDatabase::Status |
| 1047 ServiceWorkerDatabase::ClearPurgeableResourceIds(const std::set<int64>& ids) { | 1047 ServiceWorkerDatabase::ClearPurgeableResourceIds(const std::set<int64>& ids) { |
| 1048 return DeleteResourceIds(kPurgeableResIdKeyPrefix, ids); | 1048 return DeleteResourceIds(kPurgeableResIdKeyPrefix, ids); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 ServiceWorkerDatabase::Status | 1051 ServiceWorkerDatabase::Status |
| 1052 ServiceWorkerDatabase::PurgeUncommittedResourceIds( | 1052 ServiceWorkerDatabase::MoveResourceIdsFromUncommittedToPurgeable( |
| 1053 const std::set<int64>& ids) { | 1053 const std::set<int64>& ids) { |
| 1054 leveldb::WriteBatch batch; | 1054 leveldb::WriteBatch batch; |
| 1055 Status status = DeleteResourceIdsInBatch( | 1055 Status status = DeleteResourceIdsInBatch( |
| 1056 kUncommittedResIdKeyPrefix, ids, &batch); | 1056 kUncommittedResIdKeyPrefix, ids, &batch); |
| 1057 if (status != STATUS_OK) | 1057 if (status != STATUS_OK) |
| 1058 return status; | 1058 return status; |
| 1059 status = WriteResourceIdsInBatch(kPurgeableResIdKeyPrefix, ids, &batch); | 1059 status = WriteResourceIdsInBatch(kPurgeableResIdKeyPrefix, ids, &batch); |
| 1060 if (status != STATUS_OK) | 1060 if (status != STATUS_OK) |
| 1061 return status; | 1061 return status; |
| 1062 return WriteBatch(&batch); | 1062 return WriteBatch(&batch); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 if (status != STATUS_OK) | 1599 if (status != STATUS_OK) |
| 1600 Disable(from_here, status); | 1600 Disable(from_here, status); |
| 1601 ServiceWorkerMetrics::CountWriteDatabaseResult(status); | 1601 ServiceWorkerMetrics::CountWriteDatabaseResult(status); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { | 1604 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { |
| 1605 return path_.empty(); | 1605 return path_.empty(); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 } // namespace content | 1608 } // namespace content |
| OLD | NEW |