| 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 Status WritePurgeableResourceIds(const std::set<int64>& ids); | 178 Status WritePurgeableResourceIds(const std::set<int64>& ids); |
| 179 | 179 |
| 180 // Deletes purgeable resource ids specified by |ids| from the database. | 180 // Deletes purgeable resource ids specified by |ids| from the database. |
| 181 // Returns OK on success. Otherwise deletes nothing and returns an error. | 181 // Returns OK on success. Otherwise deletes nothing and returns an error. |
| 182 Status ClearPurgeableResourceIds(const std::set<int64>& ids); | 182 Status ClearPurgeableResourceIds(const std::set<int64>& ids); |
| 183 | 183 |
| 184 // Moves |ids| from the uncommitted list to the purgeable list. | 184 // Moves |ids| from the uncommitted list to the purgeable list. |
| 185 // Returns OK on success. Otherwise deletes nothing and returns an error. | 185 // Returns OK on success. Otherwise deletes nothing and returns an error. |
| 186 Status PurgeUncommittedResourceIds(const std::set<int64>& ids); | 186 Status PurgeUncommittedResourceIds(const std::set<int64>& ids); |
| 187 | 187 |
| 188 // Deletes all data for |origin|, namely, unique origin, registrations and | 188 // Deletes all data for |origins|, namely, unique origin, registrations and |
| 189 // resource records. Resources are moved to the purgeable list. Returns OK if | 189 // resource records. Resources are moved to the purgeable list. Returns OK if |
| 190 // they are successfully deleted or not found in the database. Otherwise, | 190 // they are successfully deleted or not found in the database. Otherwise, |
| 191 // returns an error. | 191 // returns an error. |
| 192 Status DeleteAllDataForOrigin( | 192 Status DeleteAllDataForOrigins( |
| 193 const GURL& origin, | 193 const std::set<GURL>& origins, |
| 194 std::vector<int64>* newly_purgeable_resources); | 194 std::vector<int64>* newly_purgeable_resources); |
| 195 | 195 |
| 196 // Completely deletes the contents of the database. | 196 // Completely deletes the contents of the database. |
| 197 // Be careful using this function. | 197 // Be careful using this function. |
| 198 Status DestroyDatabase(); | 198 Status DestroyDatabase(); |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 // Opens the database at the |path_|. This is lazily called when the first | 201 // Opens the database at the |path_|. This is lazily called when the first |
| 202 // database API is called. Returns OK if the database is successfully opened. | 202 // database API is called. Returns OK if the database is successfully opened. |
| 203 // Returns NOT_FOUND if the database does not exist and |create_if_missing| is | 203 // Returns NOT_FOUND if the database does not exist and |create_if_missing| is |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); | 324 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); |
| 325 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); | 325 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); |
| 326 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); | 326 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); |
| 327 | 327 |
| 328 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 328 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 } // namespace content | 331 } // namespace content |
| 332 | 332 |
| 333 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 333 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
| OLD | NEW |