| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // (the callback may be called prior to the method returning) or | 80 // (the callback may be called prior to the method returning) or |
| 81 // asynchronously. | 81 // asynchronously. |
| 82 void FindRegistrationForDocument(const GURL& document_url, | 82 void FindRegistrationForDocument(const GURL& document_url, |
| 83 const FindRegistrationCallback& callback); | 83 const FindRegistrationCallback& callback); |
| 84 void FindRegistrationForPattern(const GURL& scope, | 84 void FindRegistrationForPattern(const GURL& scope, |
| 85 const FindRegistrationCallback& callback); | 85 const FindRegistrationCallback& callback); |
| 86 void FindRegistrationForId(int64 registration_id, | 86 void FindRegistrationForId(int64 registration_id, |
| 87 const GURL& origin, | 87 const GURL& origin, |
| 88 const FindRegistrationCallback& callback); | 88 const FindRegistrationCallback& callback); |
| 89 | 89 |
| 90 scoped_refptr<ServiceWorkerRegistration> GetUninstallingRegistration( |
| 91 const GURL& scope); |
| 92 |
| 90 // Returns info about all stored and initially installing registrations. | 93 // Returns info about all stored and initially installing registrations. |
| 91 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); | 94 void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); |
| 92 | 95 |
| 93 // Commits |registration| with the installed but not activated |version| | 96 // Commits |registration| with the installed but not activated |version| |
| 94 // to storage, overwritting any pre-existing registration data for the scope. | 97 // to storage, overwritting any pre-existing registration data for the scope. |
| 95 // A pre-existing version's script resources remain available if that version | 98 // A pre-existing version's script resources remain available if that version |
| 96 // is live. PurgeResources should be called when it's OK to delete them. | 99 // is live. PurgeResources should be called when it's OK to delete them. |
| 97 void StoreRegistration( | 100 void StoreRegistration( |
| 98 ServiceWorkerRegistration* registration, | 101 ServiceWorkerRegistration* registration, |
| 99 ServiceWorkerVersion* version, | 102 ServiceWorkerVersion* version, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 int64 NewVersionId(); | 139 int64 NewVersionId(); |
| 137 int64 NewResourceId(); | 140 int64 NewResourceId(); |
| 138 | 141 |
| 139 // Intended for use only by ServiceWorkerRegisterJob. | 142 // Intended for use only by ServiceWorkerRegisterJob. |
| 140 void NotifyInstallingRegistration( | 143 void NotifyInstallingRegistration( |
| 141 ServiceWorkerRegistration* registration); | 144 ServiceWorkerRegistration* registration); |
| 142 void NotifyDoneInstallingRegistration( | 145 void NotifyDoneInstallingRegistration( |
| 143 ServiceWorkerRegistration* registration, | 146 ServiceWorkerRegistration* registration, |
| 144 ServiceWorkerVersion* version, | 147 ServiceWorkerVersion* version, |
| 145 ServiceWorkerStatusCode status); | 148 ServiceWorkerStatusCode status); |
| 149 // Intended for use only by ServiceWorkerRegistration. |
| 150 void NotifyUninstallingRegistration(ServiceWorkerRegistration* registration); |
| 151 void NotifyDoneUninstallingRegistration( |
| 152 ServiceWorkerRegistration* registration); |
| 146 | 153 |
| 147 void Disable(); | 154 void Disable(); |
| 148 bool IsDisabled() const; | 155 bool IsDisabled() const; |
| 149 | 156 |
| 150 // |resources| must already be on the purgeable list. | 157 // |resources| must already be on the purgeable list. |
| 151 void PurgeResources(const ResourceList& resources); | 158 void PurgeResources(const ResourceList& resources); |
| 152 | 159 |
| 153 private: | 160 private: |
| 154 friend class ServiceWorkerResourceStorageTest; | 161 friend class ServiceWorkerResourceStorageTest; |
| 155 friend class ServiceWorkerControlleeRequestHandlerTest; | 162 friend class ServiceWorkerControlleeRequestHandlerTest; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 const FindInDBCallback& callback); | 335 const FindInDBCallback& callback); |
| 329 | 336 |
| 330 void ScheduleDeleteAndStartOver(); | 337 void ScheduleDeleteAndStartOver(); |
| 331 void DidDeleteDatabase( | 338 void DidDeleteDatabase( |
| 332 const StatusCallback& callback, | 339 const StatusCallback& callback, |
| 333 ServiceWorkerDatabase::Status status); | 340 ServiceWorkerDatabase::Status status); |
| 334 void DidDeleteDiskCache( | 341 void DidDeleteDiskCache( |
| 335 const StatusCallback& callback, | 342 const StatusCallback& callback, |
| 336 bool result); | 343 bool result); |
| 337 | 344 |
| 338 // For finding registrations being installed. | 345 // For finding registrations being installed or uninstalled. |
| 339 RegistrationRefsById installing_registrations_; | 346 RegistrationRefsById installing_registrations_; |
| 347 RegistrationRefsById uninstalling_registrations_; |
| 340 | 348 |
| 341 // Origins having registations. | 349 // Origins having registations. |
| 342 std::set<GURL> registered_origins_; | 350 std::set<GURL> registered_origins_; |
| 343 | 351 |
| 344 // Pending database tasks waiting for initialization. | 352 // Pending database tasks waiting for initialization. |
| 345 std::vector<base::Closure> pending_tasks_; | 353 std::vector<base::Closure> pending_tasks_; |
| 346 | 354 |
| 347 int64 next_registration_id_; | 355 int64 next_registration_id_; |
| 348 int64 next_version_id_; | 356 int64 next_version_id_; |
| 349 int64 next_resource_id_; | 357 int64 next_resource_id_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 372 std::set<int64> pending_deletions_; | 380 std::set<int64> pending_deletions_; |
| 373 | 381 |
| 374 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 382 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
| 375 | 383 |
| 376 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 384 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
| 377 }; | 385 }; |
| 378 | 386 |
| 379 } // namespace content | 387 } // namespace content |
| 380 | 388 |
| 381 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 389 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| OLD | NEW |