Chromium Code Reviews| Index: content/browser/service_worker/service_worker_storage.h |
| diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h |
| index 5241d265d6c37427e88c669336006d9610882019..8554fcb0eb865d91f4a18327daa6f9d6ee4ff7ec 100644 |
| --- a/content/browser/service_worker/service_worker_storage.h |
| +++ b/content/browser/service_worker/service_worker_storage.h |
| @@ -5,6 +5,7 @@ |
| #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| +#include <algorithm> |
| #include <deque> |
| #include <map> |
| #include <set> |
| @@ -57,6 +58,8 @@ class CONTENT_EXPORT ServiceWorkerStorage |
| typedef base::Callback< |
| void(ServiceWorkerStatusCode status, bool are_equal)> |
| CompareCallback; |
| + typedef base::Callback<void(const std::map<GURL, int64>& origin_usage)> |
| + OriginUsageCallback; |
| ~ServiceWorkerStorage() override; |
| @@ -95,14 +98,15 @@ class CONTENT_EXPORT ServiceWorkerStorage |
| // Returns info about all stored and initially installing registrations. |
| void GetAllRegistrations(const GetAllRegistrationInfosCallback& callback); |
| + void GetAllUsageByOrigin(const OriginUsageCallback& callback); |
| + |
| // Commits |registration| with the installed but not activated |version| |
| // to storage, overwritting any pre-existing registration data for the scope. |
| // A pre-existing version's script resources remain available if that version |
| // is live. PurgeResources should be called when it's OK to delete them. |
| - void StoreRegistration( |
| - ServiceWorkerRegistration* registration, |
| - ServiceWorkerVersion* version, |
| - const StatusCallback& callback); |
| + void StoreRegistration(ServiceWorkerRegistration* registration, |
| + ServiceWorkerVersion* version, |
| + const StatusCallback& callback); |
| // Updates the state of the registration's stored version to active. |
| void UpdateToActiveState( |
| @@ -208,16 +212,18 @@ class CONTENT_EXPORT ServiceWorkerStorage |
| typedef base::Callback<void( |
| InitialData* data, |
| ServiceWorkerDatabase::Status status)> InitializeCallback; |
| - typedef base::Callback< |
| - void(const GURL& origin, |
| - int64 deleted_version_id, |
| - const std::vector<int64>& newly_purgeable_resources, |
| - ServiceWorkerDatabase::Status status)> WriteRegistrationCallback; |
| - typedef base::Callback< |
| - void(bool origin_is_deletable, |
| - int64 version_id, |
| - const std::vector<int64>& newly_purgeable_resources, |
| - ServiceWorkerDatabase::Status status)> DeleteRegistrationCallback; |
| + // The registration data is owned by the callback. |
| + typedef base::Callback<void( |
| + const GURL& origin, |
| + ServiceWorkerDatabase::RegistrationData* deleted_version_data, |
| + const std::vector<int64>& newly_purgeable_resources, |
| + ServiceWorkerDatabase::Status status)> WriteRegistrationCallback; |
| + // The registration data is owned by the callback. |
| + typedef base::Callback<void( |
| + bool origin_is_deletable, |
| + ServiceWorkerDatabase::RegistrationData* deleted_version_data, |
| + const std::vector<int64>& newly_purgeable_resources, |
| + ServiceWorkerDatabase::Status status)> DeleteRegistrationCallback; |
| typedef base::Callback<void( |
| const ServiceWorkerDatabase::RegistrationData& data, |
| const ResourceList& resources, |
| @@ -264,18 +270,23 @@ class CONTENT_EXPORT ServiceWorkerStorage |
| const GetAllRegistrationInfosCallback& callback, |
| RegistrationList* registrations, |
| ServiceWorkerDatabase::Status status); |
| - void DidStoreRegistration(const StatusCallback& callback, |
| - const GURL& origin, |
| - int64 deleted_version_id, |
| - const std::vector<int64>& newly_purgeable_resources, |
| - ServiceWorkerDatabase::Status status); |
| + void DidGetRegistrationsForUsage(const OriginUsageCallback& callback, |
| + RegistrationList* registrations, |
| + ServiceWorkerDatabase::Status status); |
| + void DidStoreRegistration( |
| + const StatusCallback& callback, |
| + const ServiceWorkerDatabase::RegistrationData& new_version, |
| + const GURL& origin, |
| + ServiceWorkerDatabase::RegistrationData* deleted_version, |
|
michaeln
2014/10/28 22:00:40
or maybe use a const T& for this arg to simplify t
dmurph
2014/10/29 22:18:25
Done.
|
| + const std::vector<int64>& newly_purgeable_resources, |
| + ServiceWorkerDatabase::Status status); |
| void DidUpdateToActiveState( |
| const StatusCallback& callback, |
| ServiceWorkerDatabase::Status status); |
| void DidDeleteRegistration( |
| const DidDeleteRegistrationParams& params, |
| bool origin_is_deletable, |
| - int64 version_id, |
| + ServiceWorkerDatabase::RegistrationData* version, |
| const std::vector<int64>& newly_purgeable_resources, |
| ServiceWorkerDatabase::Status status); |
| void ReturnFoundRegistration( |