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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // well as that user data. | 181 // well as that user data. |
182 void GetUserDataForAllRegistrations( | 182 void GetUserDataForAllRegistrations( |
183 const std::string& key, | 183 const std::string& key, |
184 const GetUserDataForAllRegistrationsCallback& callback); | 184 const GetUserDataForAllRegistrationsCallback& callback); |
185 | 185 |
186 // Deletes the storage and starts over. | 186 // Deletes the storage and starts over. |
187 void DeleteAndStartOver(const StatusCallback& callback); | 187 void DeleteAndStartOver(const StatusCallback& callback); |
188 | 188 |
189 // Returns new IDs which are guaranteed to be unique in the storage. | 189 // Returns new IDs which are guaranteed to be unique in the storage. |
190 int64 NewRegistrationId(); | 190 int64 NewRegistrationId(); |
191 int64 NewVersionId(); | 191 std::string NewVersionId(); |
192 int64 NewResourceId(); | 192 int64 NewResourceId(); |
193 | 193 |
194 // Intended for use only by ServiceWorkerRegisterJob and | 194 // Intended for use only by ServiceWorkerRegisterJob and |
195 // ServiceWorkerRegistration. | 195 // ServiceWorkerRegistration. |
196 void NotifyInstallingRegistration( | 196 void NotifyInstallingRegistration( |
197 ServiceWorkerRegistration* registration); | 197 ServiceWorkerRegistration* registration); |
198 void NotifyDoneInstallingRegistration( | 198 void NotifyDoneInstallingRegistration( |
199 ServiceWorkerRegistration* registration, | 199 ServiceWorkerRegistration* registration, |
200 ServiceWorkerVersion* version, | 200 ServiceWorkerVersion* version, |
201 ServiceWorkerStatusCode status); | 201 ServiceWorkerStatusCode status); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 ClearOnExit); | 243 ClearOnExit); |
244 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, | 244 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, |
245 DeleteAndStartOver); | 245 DeleteAndStartOver); |
246 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, | 246 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, |
247 DeleteAndStartOver_UnrelatedFileExists); | 247 DeleteAndStartOver_UnrelatedFileExists); |
248 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, | 248 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, |
249 DeleteAndStartOver_OpenedFileExists); | 249 DeleteAndStartOver_OpenedFileExists); |
250 | 250 |
251 struct InitialData { | 251 struct InitialData { |
252 int64 next_registration_id; | 252 int64 next_registration_id; |
253 int64 next_version_id; | |
254 int64 next_resource_id; | 253 int64 next_resource_id; |
255 std::set<GURL> origins; | 254 std::set<GURL> origins; |
256 bool disk_cache_migration_needed; | 255 bool disk_cache_migration_needed; |
257 bool old_disk_cache_deletion_needed; | 256 bool old_disk_cache_deletion_needed; |
258 | 257 |
259 InitialData(); | 258 InitialData(); |
260 ~InitialData(); | 259 ~InitialData(); |
261 }; | 260 }; |
262 | 261 |
263 // Because there are too many params for base::Bind to wrap a closure around. | 262 // Because there are too many params for base::Bind to wrap a closure around. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 RegistrationRefsById installing_registrations_; | 490 RegistrationRefsById installing_registrations_; |
492 RegistrationRefsById uninstalling_registrations_; | 491 RegistrationRefsById uninstalling_registrations_; |
493 | 492 |
494 // Origins having registations. | 493 // Origins having registations. |
495 std::set<GURL> registered_origins_; | 494 std::set<GURL> registered_origins_; |
496 | 495 |
497 // Pending database tasks waiting for initialization. | 496 // Pending database tasks waiting for initialization. |
498 std::vector<base::Closure> pending_tasks_; | 497 std::vector<base::Closure> pending_tasks_; |
499 | 498 |
500 int64 next_registration_id_; | 499 int64 next_registration_id_; |
501 int64 next_version_id_; | |
502 int64 next_resource_id_; | 500 int64 next_resource_id_; |
503 | 501 |
504 enum State { | 502 enum State { |
505 UNINITIALIZED, | 503 UNINITIALIZED, |
506 INITIALIZING, | 504 INITIALIZING, |
507 INITIALIZED, | 505 INITIALIZED, |
508 DISABLED, | 506 DISABLED, |
509 }; | 507 }; |
510 State state_; | 508 State state_; |
511 | 509 |
(...skipping 19 matching lines...) Expand all Loading... |
531 std::set<int64> pending_deletions_; | 529 std::set<int64> pending_deletions_; |
532 | 530 |
533 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 531 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
534 | 532 |
535 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 533 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
536 }; | 534 }; |
537 | 535 |
538 } // namespace content | 536 } // namespace content |
539 | 537 |
540 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 538 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |