Chromium Code Reviews| 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( | |
|
michaeln
2014/08/12 02:15:36
nit: can this be a rawptr so there's that much les
falken
2014/08/12 09:06:06
Ah of course. Done.
| |
| 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 NotifyAbortedUninstallingRegistration( | |
| 152 ServiceWorkerRegistration* registration); | |
| 153 void NotifyUninstalledRegistration(ServiceWorkerRegistration* registration); | |
|
michaeln
2014/08/12 02:15:36
for consistency, can this be NotifyDoneXxxxx
falken
2014/08/12 09:06:06
Done.
| |
| 146 | 154 |
| 147 void Disable(); | 155 void Disable(); |
| 148 bool IsDisabled() const; | 156 bool IsDisabled() const; |
| 149 | 157 |
| 150 // |resources| must already be on the purgeable list. | 158 // |resources| must already be on the purgeable list. |
| 151 void PurgeResources(const ResourceList& resources); | 159 void PurgeResources(const ResourceList& resources); |
| 152 | 160 |
| 153 private: | 161 private: |
| 154 friend class ServiceWorkerResourceStorageTest; | 162 friend class ServiceWorkerResourceStorageTest; |
| 155 friend class ServiceWorkerControlleeRequestHandlerTest; | 163 friend class ServiceWorkerControlleeRequestHandlerTest; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 ServiceWorkerDatabase::Status status); | 249 ServiceWorkerDatabase::Status status); |
| 242 void DidGetAllRegistrations( | 250 void DidGetAllRegistrations( |
| 243 const GetAllRegistrationInfosCallback& callback, | 251 const GetAllRegistrationInfosCallback& callback, |
| 244 RegistrationList* registrations, | 252 RegistrationList* registrations, |
| 245 ServiceWorkerDatabase::Status status); | 253 ServiceWorkerDatabase::Status status); |
| 246 void DidStoreRegistration(const StatusCallback& callback, | 254 void DidStoreRegistration(const StatusCallback& callback, |
| 247 const GURL& origin, | 255 const GURL& origin, |
| 248 int64 deleted_version_id, | 256 int64 deleted_version_id, |
| 249 const std::vector<int64>& newly_purgeable_resources, | 257 const std::vector<int64>& newly_purgeable_resources, |
| 250 ServiceWorkerDatabase::Status status); | 258 ServiceWorkerDatabase::Status status); |
| 259 void DidRestoreRegistration(int64 registration_id, | |
| 260 ServiceWorkerStatusCode status); | |
| 261 | |
| 251 void DidUpdateToActiveState( | 262 void DidUpdateToActiveState( |
| 252 const StatusCallback& callback, | 263 const StatusCallback& callback, |
| 253 ServiceWorkerDatabase::Status status); | 264 ServiceWorkerDatabase::Status status); |
| 254 void DidDeleteRegistration( | 265 void DidDeleteRegistration( |
| 255 const DidDeleteRegistrationParams& params, | 266 const DidDeleteRegistrationParams& params, |
| 256 bool origin_is_deletable, | 267 bool origin_is_deletable, |
| 257 int64 version_id, | 268 int64 version_id, |
| 258 const std::vector<int64>& newly_purgeable_resources, | 269 const std::vector<int64>& newly_purgeable_resources, |
| 259 ServiceWorkerDatabase::Status status); | 270 ServiceWorkerDatabase::Status status); |
| 260 void ReturnFoundRegistration( | 271 void ReturnFoundRegistration( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 const FindInDBCallback& callback); | 339 const FindInDBCallback& callback); |
| 329 | 340 |
| 330 void ScheduleDeleteAndStartOver(); | 341 void ScheduleDeleteAndStartOver(); |
| 331 void DidDeleteDatabase( | 342 void DidDeleteDatabase( |
| 332 const StatusCallback& callback, | 343 const StatusCallback& callback, |
| 333 ServiceWorkerDatabase::Status status); | 344 ServiceWorkerDatabase::Status status); |
| 334 void DidDeleteDiskCache( | 345 void DidDeleteDiskCache( |
| 335 const StatusCallback& callback, | 346 const StatusCallback& callback, |
| 336 bool result); | 347 bool result); |
| 337 | 348 |
| 338 // For finding registrations being installed. | 349 // For finding registrations being installed or uninstalled. |
| 339 RegistrationRefsById installing_registrations_; | 350 RegistrationRefsById installing_registrations_; |
| 351 RegistrationRefsById uninstalling_registrations_; | |
| 340 | 352 |
| 341 // Origins having registations. | 353 // Origins having registations. |
| 342 std::set<GURL> registered_origins_; | 354 std::set<GURL> registered_origins_; |
| 343 | 355 |
| 344 // Pending database tasks waiting for initialization. | 356 // Pending database tasks waiting for initialization. |
| 345 std::vector<base::Closure> pending_tasks_; | 357 std::vector<base::Closure> pending_tasks_; |
| 346 | 358 |
| 347 int64 next_registration_id_; | 359 int64 next_registration_id_; |
| 348 int64 next_version_id_; | 360 int64 next_version_id_; |
| 349 int64 next_resource_id_; | 361 int64 next_resource_id_; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 372 std::set<int64> pending_deletions_; | 384 std::set<int64> pending_deletions_; |
| 373 | 385 |
| 374 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 386 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
| 375 | 387 |
| 376 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 388 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
| 377 }; | 389 }; |
| 378 | 390 |
| 379 } // namespace content | 391 } // namespace content |
| 380 | 392 |
| 381 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 393 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| OLD | NEW |