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(const std::set<GURL>& origins, |
193 const GURL& origin, | 193 std::vector<int64>* newly_purgeable_resources); |
194 std::vector<int64>* newly_purgeable_resources); | |
195 | 194 |
196 // Completely deletes the contents of the database. | 195 // Completely deletes the contents of the database. |
197 // Be careful using this function. | 196 // Be careful using this function. |
198 Status DestroyDatabase(); | 197 Status DestroyDatabase(); |
199 | 198 |
200 private: | 199 private: |
201 // Opens the database at the |path_|. This is lazily called when the first | 200 // 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. | 201 // 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 | 202 // Returns NOT_FOUND if the database does not exist and |create_if_missing| is |
204 // false. Otherwise, returns an error. | 203 // false. Otherwise, returns an error. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); | 323 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); |
325 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); | 324 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); |
326 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); | 325 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); |
327 | 326 |
328 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 327 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
329 }; | 328 }; |
330 | 329 |
331 } // namespace content | 330 } // namespace content |
332 | 331 |
333 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 332 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
OLD | NEW |