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 <string> | 10 #include <string> |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 const std::string& user_data_name, | 172 const std::string& user_data_name, |
173 const std::string& user_data); | 173 const std::string& user_data); |
174 | 174 |
175 // Deletes user data for |registration_id| and |user_data_name| from the | 175 // Deletes user data for |registration_id| and |user_data_name| from the |
176 // database. Returns OK if it's successfully deleted or not found in the | 176 // database. Returns OK if it's successfully deleted or not found in the |
177 // database. | 177 // database. |
178 Status DeleteUserData(int64 registration_id, | 178 Status DeleteUserData(int64 registration_id, |
179 const std::string& user_data_name); | 179 const std::string& user_data_name); |
180 | 180 |
181 // Reads user data for all registrations that have data with |user_data_name| | 181 // Reads user data for all registrations that have data with |user_data_name| |
182 // from the database. | 182 // from the database. Returns OK if they are successfully read or not found. |
183 Status ReadUserDataForAllRegistrations( | 183 Status ReadUserDataForAllRegistrations( |
184 const std::string& user_data_name, | 184 const std::string& user_data_name, |
185 std::vector<std::pair<int64, std::string>>* user_data); | 185 std::vector<std::pair<int64, std::string>>* user_data); |
186 | 186 |
187 // As new resources are put into the diskcache, they go into an uncommitted | 187 // As new resources are put into the diskcache, they go into an uncommitted |
188 // list. When a registration is saved that refers to those ids, they're | 188 // list. When a registration is saved that refers to those ids, they're |
189 // removed from that list. When a resource no longer has any registrations or | 189 // removed from that list. When a resource no longer has any registrations or |
190 // caches referring to it, it's added to the purgeable list. Periodically, | 190 // caches referring to it, it's added to the purgeable list. Periodically, |
191 // the purgeable list can be purged from the diskcache. At system startup, all | 191 // the purgeable list can be purged from the diskcache. At system startup, all |
192 // uncommitted ids are moved to the purgeable list. | 192 // uncommitted ids are moved to the purgeable list. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 DISABLED, | 355 DISABLED, |
356 }; | 356 }; |
357 State state_; | 357 State state_; |
358 | 358 |
359 base::SequenceChecker sequence_checker_; | 359 base::SequenceChecker sequence_checker_; |
360 | 360 |
361 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase); | 361 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase); |
362 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase_InMemory); | 362 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase_InMemory); |
363 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); | 363 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); |
364 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); | 364 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); |
| 365 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, |
| 366 Registration_UninitializedDatabase); |
| 367 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, |
| 368 UserData_UninitializedDatabase); |
365 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); | 369 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); |
366 | 370 |
367 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 371 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
368 }; | 372 }; |
369 | 373 |
370 } // namespace content | 374 } // namespace content |
371 | 375 |
372 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 376 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
OLD | NEW |