OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 ServiceWorkerRegistration* GetUninstallingRegistration(const GURL& scope); | 93 ServiceWorkerRegistration* GetUninstallingRegistration(const GURL& scope); |
94 | 94 |
95 // Returns info about all stored and initially installing registrations. | 95 // Returns info about all stored and initially installing registrations. |
96 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); | 96 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); |
97 | 97 |
98 // Commits |registration| with the installed but not activated |version| | 98 // Commits |registration| with the installed but not activated |version| |
99 // to storage, overwritting any pre-existing registration data for the scope. | 99 // to storage, overwritting any pre-existing registration data for the scope. |
100 // A pre-existing version's script resources remain available if that version | 100 // A pre-existing version's script resources remain available if that version |
101 // is live. PurgeResources should be called when it's OK to delete them. | 101 // is live. PurgeResources should be called when it's OK to delete them. |
102 void StoreRegistration( | 102 void StoreRegistration(ServiceWorkerRegistration* registration, |
103 ServiceWorkerRegistration* registration, | 103 ServiceWorkerVersion* version, |
104 ServiceWorkerVersion* version, | 104 const StatusCallback& callback); |
105 const StatusCallback& callback); | |
106 | 105 |
107 // Updates the state of the registration's stored version to active. | 106 // Updates the state of the registration's stored version to active. |
108 void UpdateToActiveState( | 107 void UpdateToActiveState( |
109 ServiceWorkerRegistration* registration, | 108 ServiceWorkerRegistration* registration, |
110 const StatusCallback& callback); | 109 const StatusCallback& callback); |
111 | 110 |
112 // Updates the stored time to match the value of | 111 // Updates the stored time to match the value of |
113 // registration->last_update_check(). | 112 // registration->last_update_check(). |
114 void UpdateLastUpdateCheckTime(ServiceWorkerRegistration* registration); | 113 void UpdateLastUpdateCheckTime(ServiceWorkerRegistration* registration); |
115 | 114 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 DidDeleteRegistrationParams(); | 200 DidDeleteRegistrationParams(); |
202 ~DidDeleteRegistrationParams(); | 201 ~DidDeleteRegistrationParams(); |
203 }; | 202 }; |
204 | 203 |
205 typedef std::vector<ServiceWorkerDatabase::RegistrationData> RegistrationList; | 204 typedef std::vector<ServiceWorkerDatabase::RegistrationData> RegistrationList; |
206 typedef std::map<int64, scoped_refptr<ServiceWorkerRegistration> > | 205 typedef std::map<int64, scoped_refptr<ServiceWorkerRegistration> > |
207 RegistrationRefsById; | 206 RegistrationRefsById; |
208 typedef base::Callback<void( | 207 typedef base::Callback<void( |
209 InitialData* data, | 208 InitialData* data, |
210 ServiceWorkerDatabase::Status status)> InitializeCallback; | 209 ServiceWorkerDatabase::Status status)> InitializeCallback; |
211 typedef base::Callback< | 210 typedef base::Callback<void( |
212 void(const GURL& origin, | 211 const GURL& origin, |
213 int64 deleted_version_id, | 212 const ServiceWorkerDatabase::RegistrationData& deleted_version_data, |
214 const std::vector<int64>& newly_purgeable_resources, | 213 const std::vector<int64>& newly_purgeable_resources, |
215 ServiceWorkerDatabase::Status status)> WriteRegistrationCallback; | 214 ServiceWorkerDatabase::Status status)> WriteRegistrationCallback; |
216 typedef base::Callback< | 215 typedef base::Callback<void( |
217 void(bool origin_is_deletable, | 216 bool origin_is_deletable, |
218 int64 version_id, | 217 const ServiceWorkerDatabase::RegistrationData& deleted_version_data, |
219 const std::vector<int64>& newly_purgeable_resources, | 218 const std::vector<int64>& newly_purgeable_resources, |
220 ServiceWorkerDatabase::Status status)> DeleteRegistrationCallback; | 219 ServiceWorkerDatabase::Status status)> DeleteRegistrationCallback; |
221 typedef base::Callback<void( | 220 typedef base::Callback<void( |
222 const ServiceWorkerDatabase::RegistrationData& data, | 221 const ServiceWorkerDatabase::RegistrationData& data, |
223 const ResourceList& resources, | 222 const ResourceList& resources, |
224 ServiceWorkerDatabase::Status status)> FindInDBCallback; | 223 ServiceWorkerDatabase::Status status)> FindInDBCallback; |
225 typedef base::Callback<void(const std::vector<int64>& resource_ids, | 224 typedef base::Callback<void(const std::vector<int64>& resource_ids, |
226 ServiceWorkerDatabase::Status status)> | 225 ServiceWorkerDatabase::Status status)> |
227 GetResourcesCallback; | 226 GetResourcesCallback; |
228 | 227 |
229 ServiceWorkerStorage( | 228 ServiceWorkerStorage( |
230 const base::FilePath& path, | 229 const base::FilePath& path, |
(...skipping 26 matching lines...) Expand all Loading... |
257 ServiceWorkerDatabase::Status status); | 256 ServiceWorkerDatabase::Status status); |
258 void DidFindRegistrationForId( | 257 void DidFindRegistrationForId( |
259 const FindRegistrationCallback& callback, | 258 const FindRegistrationCallback& callback, |
260 const ServiceWorkerDatabase::RegistrationData& data, | 259 const ServiceWorkerDatabase::RegistrationData& data, |
261 const ResourceList& resources, | 260 const ResourceList& resources, |
262 ServiceWorkerDatabase::Status status); | 261 ServiceWorkerDatabase::Status status); |
263 void DidGetAllRegistrations( | 262 void DidGetAllRegistrations( |
264 const GetAllRegistrationInfosCallback& callback, | 263 const GetAllRegistrationInfosCallback& callback, |
265 RegistrationList* registrations, | 264 RegistrationList* registrations, |
266 ServiceWorkerDatabase::Status status); | 265 ServiceWorkerDatabase::Status status); |
267 void DidStoreRegistration(const StatusCallback& callback, | 266 void DidStoreRegistration( |
268 const GURL& origin, | 267 const StatusCallback& callback, |
269 int64 deleted_version_id, | 268 const ServiceWorkerDatabase::RegistrationData& new_version, |
270 const std::vector<int64>& newly_purgeable_resources, | 269 const GURL& origin, |
271 ServiceWorkerDatabase::Status status); | 270 const ServiceWorkerDatabase::RegistrationData& deleted_version, |
| 271 const std::vector<int64>& newly_purgeable_resources, |
| 272 ServiceWorkerDatabase::Status status); |
272 void DidUpdateToActiveState( | 273 void DidUpdateToActiveState( |
273 const StatusCallback& callback, | 274 const StatusCallback& callback, |
274 ServiceWorkerDatabase::Status status); | 275 ServiceWorkerDatabase::Status status); |
275 void DidDeleteRegistration( | 276 void DidDeleteRegistration( |
276 const DidDeleteRegistrationParams& params, | 277 const DidDeleteRegistrationParams& params, |
277 bool origin_is_deletable, | 278 bool origin_is_deletable, |
278 int64 version_id, | 279 const ServiceWorkerDatabase::RegistrationData& deleted_version, |
279 const std::vector<int64>& newly_purgeable_resources, | 280 const std::vector<int64>& newly_purgeable_resources, |
280 ServiceWorkerDatabase::Status status); | 281 ServiceWorkerDatabase::Status status); |
281 void ReturnFoundRegistration( | 282 void ReturnFoundRegistration( |
282 const FindRegistrationCallback& callback, | 283 const FindRegistrationCallback& callback, |
283 const ServiceWorkerDatabase::RegistrationData& data, | 284 const ServiceWorkerDatabase::RegistrationData& data, |
284 const ResourceList& resources); | 285 const ResourceList& resources); |
285 | 286 |
286 scoped_refptr<ServiceWorkerRegistration> GetOrCreateRegistration( | 287 scoped_refptr<ServiceWorkerRegistration> GetOrCreateRegistration( |
287 const ServiceWorkerDatabase::RegistrationData& data, | 288 const ServiceWorkerDatabase::RegistrationData& data, |
288 const ResourceList& resources); | 289 const ResourceList& resources); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 std::set<int64> pending_deletions_; | 401 std::set<int64> pending_deletions_; |
401 | 402 |
402 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 403 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
403 | 404 |
404 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 405 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
405 }; | 406 }; |
406 | 407 |
407 } // namespace content | 408 } // namespace content |
408 | 409 |
409 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 410 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |