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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Otherwise, returns an error. | 116 // Otherwise, returns an error. |
117 Status ReadRegistration( | 117 Status ReadRegistration( |
118 int64 registration_id, | 118 int64 registration_id, |
119 const GURL& origin, | 119 const GURL& origin, |
120 RegistrationData* registration, | 120 RegistrationData* registration, |
121 std::vector<ResourceRecord>* resources); | 121 std::vector<ResourceRecord>* resources); |
122 | 122 |
123 // Writes |registration| and |resources| into the database and does following | 123 // Writes |registration| and |resources| into the database and does following |
124 // things: | 124 // things: |
125 // - If an old version of the registration exists, deletes it and sets | 125 // - If an old version of the registration exists, deletes it and sets |
126 // |deleted_version_id| to the old version id and | 126 // |deleted_version| to the old version registration data object |
127 // |newly_purgeable_resources| to its resources. Otherwise, sets | 127 // |newly_purgeable_resources| to its resources. Otherwise, sets |
128 // |deleted_version_id| to -1. | 128 // |deleted_version->version_id| to -1. |
129 // - Bumps the next registration id and the next version id if needed. | 129 // - Bumps the next registration id and the next version id if needed. |
130 // - Removes |resources| from the uncommitted list if exist. | 130 // - Removes |resources| from the uncommitted list if exist. |
131 // Returns OK they are successfully written. Otherwise, returns an error. | 131 // Returns OK they are successfully written. Otherwise, returns an error. |
132 Status WriteRegistration(const RegistrationData& registration, | 132 Status WriteRegistration(const RegistrationData& registration, |
133 const std::vector<ResourceRecord>& resources, | 133 const std::vector<ResourceRecord>& resources, |
134 int64* deleted_version_id, | 134 RegistrationData* deleted_version, |
135 std::vector<int64>* newly_purgeable_resources); | 135 std::vector<int64>* newly_purgeable_resources); |
136 | 136 |
137 // Updates a registration for |registration_id| to an active state. Returns OK | 137 // Updates a registration for |registration_id| to an active state. Returns OK |
138 // if it's successfully updated. Otherwise, returns an error. | 138 // if it's successfully updated. Otherwise, returns an error. |
139 Status UpdateVersionToActive( | 139 Status UpdateVersionToActive( |
140 int64 registration_id, | 140 int64 registration_id, |
141 const GURL& origin); | 141 const GURL& origin); |
142 | 142 |
143 // Updates last check time of a registration for |registration_id| by |time|. | 143 // Updates last check time of a registration for |registration_id| by |time|. |
144 // Returns OK if it's successfully updated. Otherwise, returns an error. | 144 // Returns OK if it's successfully updated. Otherwise, returns an error. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); | 331 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); |
332 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); | 332 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); |
333 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); | 333 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); |
334 | 334 |
335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
336 }; | 336 }; |
337 | 337 |
338 } // namespace content | 338 } // namespace content |
339 | 339 |
340 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 340 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
OLD | NEW |