Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Side by Side Diff: content/browser/service_worker/service_worker_database.h

Issue 1945753002: Make Service Worker DB UserData methods accept multiple keys at once (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid6encrypt
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map>
11 #include <memory> 10 #include <memory>
12 #include <set> 11 #include <set>
13 #include <string> 12 #include <string>
13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/sequence_checker.h" 19 #include "base/sequence_checker.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/common/service_worker/service_worker_status_code.h" 22 #include "content/common/service_worker/service_worker_status_code.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // associated with it into the purgeable list. If deletion occurred, sets 165 // associated with it into the purgeable list. If deletion occurred, sets
166 // |version_id| to the id of the version that was deleted and 166 // |version_id| to the id of the version that was deleted and
167 // |newly_purgeable_resources| to its resources; otherwise, sets |version_id| 167 // |newly_purgeable_resources| to its resources; otherwise, sets |version_id|
168 // to -1. Returns OK if it's successfully deleted or not found in the 168 // to -1. Returns OK if it's successfully deleted or not found in the
169 // database. Otherwise, returns an error. 169 // database. Otherwise, returns an error.
170 Status DeleteRegistration(int64_t registration_id, 170 Status DeleteRegistration(int64_t registration_id,
171 const GURL& origin, 171 const GURL& origin,
172 RegistrationData* deleted_version, 172 RegistrationData* deleted_version,
173 std::vector<int64_t>* newly_purgeable_resources); 173 std::vector<int64_t>* newly_purgeable_resources);
174 174
175 // Reads user data for |registration_id| and |user_data_name| from the 175 // Reads user data for |registration_id| and |user_data_names| from the
176 // database. 176 // database.
michaeln 2016/05/03 19:38:05 also document that the function returns OK only if
johnme 2016/05/05 10:54:04 Done.
177 Status ReadUserData(int64_t registration_id, 177 Status ReadUserData(int64_t registration_id,
178 const std::string& user_data_name, 178 const std::vector<std::string>& user_data_names,
179 std::string* user_data); 179 std::vector<std::string>* user_data_values);
180 180
181 // Writes |user_data| into the database. Returns NOT_FOUND if the registration 181 // Writes |name_value_pairs| into the database. Returns NOT_FOUND if the
182 // specified by |registration_id| does not exist in the database. 182 // registration specified by |registration_id| does not exist in the database.
183 Status WriteUserData(int64_t registration_id, 183 Status WriteUserData(
184 const GURL& origin, 184 int64_t registration_id,
185 const std::string& user_data_name, 185 const GURL& origin,
186 const std::string& user_data); 186 const std::vector<std::pair<std::string, std::string>>& name_value_pairs);
187 187
188 // Deletes user data for |registration_id| and |user_data_name| from the 188 // Deletes user data for |registration_id| and |user_data_names| from the
189 // database. Returns OK if it's successfully deleted or not found in the 189 // database. Returns OK if all are successfully deleted or not found in the
190 // database. 190 // database.
191 Status DeleteUserData(int64_t registration_id, 191 Status DeleteUserData(int64_t registration_id,
192 const std::string& user_data_name); 192 const std::vector<std::string>& user_data_names);
193 193
194 // Reads user data for all registrations that have data with |user_data_name| 194 // Reads user data for all registrations that have data with |user_data_name|
195 // from the database. Returns OK if they are successfully read or not found. 195 // from the database. Returns OK if they are successfully read or not found.
196 Status ReadUserDataForAllRegistrations( 196 Status ReadUserDataForAllRegistrations(
197 const std::string& user_data_name, 197 const std::string& user_data_name,
198 std::vector<std::pair<int64_t, std::string>>* user_data); 198 std::vector<std::pair<int64_t, std::string>>* user_data);
199 199
200 // Resources should belong to one of following resource lists: uncommitted, 200 // Resources should belong to one of following resource lists: uncommitted,
201 // committed and purgeable. 201 // committed and purgeable.
202 // As new resources are put into the diskcache, they go into the uncommitted 202 // As new resources are put into the diskcache, they go into the uncommitted
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, 379 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
380 UserData_UninitializedDatabase); 380 UserData_UninitializedDatabase);
381 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); 381 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase);
382 382
383 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); 383 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase);
384 }; 384 };
385 385
386 } // namespace content 386 } // namespace content
387 387
388 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 388 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698