| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool GetPurgeableResourceIds(std::set<int64>* ids); | 121 bool GetPurgeableResourceIds(std::set<int64>* ids); |
| 122 | 122 |
| 123 // Writes |ids| into the database as purgeable resources. Returns true on | 123 // Writes |ids| into the database as purgeable resources. Returns true on |
| 124 // success. Otherwise writes nothing and returns false. | 124 // success. Otherwise writes nothing and returns false. |
| 125 bool WritePurgeableResourceIds(const std::set<int64>& ids); | 125 bool WritePurgeableResourceIds(const std::set<int64>& ids); |
| 126 | 126 |
| 127 // Deletes purgeable resource ids specified by |ids| from the database. | 127 // Deletes purgeable resource ids specified by |ids| from the database. |
| 128 // Returns true on success. Otherwise deletes nothing and returns false. | 128 // Returns true on success. Otherwise deletes nothing and returns false. |
| 129 bool ClearPurgeableResourceIds(const std::set<int64>& ids); | 129 bool ClearPurgeableResourceIds(const std::set<int64>& ids); |
| 130 | 130 |
| 131 // Delete all data for |origin|, namely, unique origin, registrations and |
| 132 // resource records. Resources are moved to the purgeable list. |
| 133 bool DeleteAllDataForOrigin(const GURL& origin); |
| 134 |
| 131 bool is_disabled() const { return is_disabled_; } | 135 bool is_disabled() const { return is_disabled_; } |
| 132 bool was_corruption_detected() const { return was_corruption_detected_; } | 136 bool was_corruption_detected() const { return was_corruption_detected_; } |
| 133 | 137 |
| 134 private: | 138 private: |
| 135 // Opens the database at the |path_|. This is lazily called when the first | 139 // Opens the database at the |path_|. This is lazily called when the first |
| 136 // database API is called. Returns true if the database was opened. Returns | 140 // database API is called. Returns true if the database was opened. Returns |
| 137 // false if the opening failed or was not neccessary, that is, the database | 141 // false if the opening failed or was not neccessary, that is, the database |
| 138 // does not exist and |create_if_needed| is false. | 142 // does not exist and |create_if_needed| is false. |
| 139 bool LazyOpen(bool create_if_needed); | 143 bool LazyOpen(bool create_if_needed); |
| 140 | 144 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Basic); | 207 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Basic); |
| 204 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Overwrite); | 208 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Overwrite); |
| 205 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Multiple); | 209 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Multiple); |
| 206 | 210 |
| 207 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 211 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
| 208 }; | 212 }; |
| 209 | 213 |
| 210 } // namespace content | 214 } // namespace content |
| 211 | 215 |
| 212 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 216 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
| OLD | NEW |