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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 RegistrationData* deleted_version, | 191 RegistrationData* deleted_version, |
192 std::vector<int64_t>* newly_purgeable_resources); | 192 std::vector<int64_t>* newly_purgeable_resources); |
193 | 193 |
194 // Reads user data for |registration_id| and |user_data_names| from the | 194 // Reads user data for |registration_id| and |user_data_names| from the |
195 // database. Returns OK only if all keys are found; otherwise NOT_FOUND, and | 195 // database. Returns OK only if all keys are found; otherwise NOT_FOUND, and |
196 // |user_data_values| will be empty. | 196 // |user_data_values| will be empty. |
197 Status ReadUserData(int64_t registration_id, | 197 Status ReadUserData(int64_t registration_id, |
198 const std::vector<std::string>& user_data_names, | 198 const std::vector<std::string>& user_data_names, |
199 std::vector<std::string>* user_data_values); | 199 std::vector<std::string>* user_data_values); |
200 | 200 |
201 // Reads user data for |registration_id| and |key_prefix| from the database. | |
202 // Returns OK only if keys matched to |key_prefix| are found; otherwise | |
203 // NOT_FOUND, and |user_data_values| will be empty. | |
204 Status ReadUserDataByKeyPrefix(int64_t registration_id, | |
205 const std::string key_prefix, | |
206 std::vector<std::string>* user_data_values); | |
207 | |
208 // Writes |name_value_pairs| into the database. Returns NOT_FOUND if the | 201 // Writes |name_value_pairs| into the database. Returns NOT_FOUND if the |
209 // registration specified by |registration_id| does not exist in the database. | 202 // registration specified by |registration_id| does not exist in the database. |
210 Status WriteUserData( | 203 Status WriteUserData( |
211 int64_t registration_id, | 204 int64_t registration_id, |
212 const GURL& origin, | 205 const GURL& origin, |
213 const std::vector<std::pair<std::string, std::string>>& name_value_pairs); | 206 const std::vector<std::pair<std::string, std::string>>& name_value_pairs); |
214 | 207 |
215 // Deletes user data for |registration_id| and |user_data_names| from the | 208 // Deletes user data for |registration_id| and |user_data_names| from the |
216 // database. Returns OK if all are successfully deleted or not found in the | 209 // database. Returns OK if all are successfully deleted or not found in the |
217 // database. | 210 // database. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, | 401 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, |
409 UserData_UninitializedDatabase); | 402 UserData_UninitializedDatabase); |
410 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); | 403 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); |
411 | 404 |
412 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 405 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
413 }; | 406 }; |
414 | 407 |
415 } // namespace content | 408 } // namespace content |
416 | 409 |
417 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 410 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
OLD | NEW |