X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcontent%2Fbrowser%2Fservice_worker%2Fservice_worker_database.h;h=3a4b8ce6c4423250445ca83a586a29eebffb79cd;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=6475de04a99e759663456c9224fb40f568eca388;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/content/browser/service_worker/service_worker_database.h b/src/content/browser/service_worker/service_worker_database.h index 6475de0..3a4b8ce 100644 --- a/src/content/browser/service_worker/service_worker_database.h +++ b/src/content/browser/service_worker/service_worker_database.h @@ -57,7 +57,7 @@ class CONTENT_EXPORT ServiceWorkerDatabase { // Versions are first stored once they successfully install and become // the waiting version. Then transition to the active version. The stored - // version may be in the ACTIVE state or in the INSTALLED state. + // version may be in the ACTIVATED state or in the INSTALLED state. int64 version_id; bool is_active; bool has_fetch_handler; @@ -114,14 +114,17 @@ class CONTENT_EXPORT ServiceWorkerDatabase { // Writes |registration| and |resources| into the database and does following // things: - // - Deletes an old version of the registration if exists. + // - If an old version of the registration exists, deletes it and sets + // |deleted_version_id| to the old version id and + // |newly_purgeable_resources| to its resources. Otherwise, sets + // |deleted_version_id| to -1. // - Bumps the next registration id and the next version id if needed. // - Removes |resources| from the uncommitted list if exist. // Returns OK they are successfully written. Otherwise, returns an error. - Status WriteRegistration( - const RegistrationData& registration, - const std::vector& resources, - std::vector* newly_purgeable_resources); + Status WriteRegistration(const RegistrationData& registration, + const std::vector& resources, + int64* deleted_version_id, + std::vector* newly_purgeable_resources); // Updates a registration for |registration_id| to an active state. Returns OK // if it's successfully updated. Otherwise, returns an error. @@ -137,12 +140,15 @@ class CONTENT_EXPORT ServiceWorkerDatabase { const base::Time& time); // Deletes a registration for |registration_id| and moves resource records - // associated with it into the purgeable list. Returns OK if it's successfully - // deleted or not found in the database. Otherwise, returns an error. - Status DeleteRegistration( - int64 registration_id, - const GURL& origin, - std::vector* newly_purgeable_resources); + // associated with it into the purgeable list. If deletion occurred, sets + // |version_id| to the id of the version that was deleted and + // |newly_purgeable_resources| to its resources; otherwise, sets |version_id| + // to -1. Returns OK if it's successfully deleted or not found in the + // database. Otherwise, returns an error. + Status DeleteRegistration(int64 registration_id, + const GURL& origin, + int64* version_id, + std::vector* newly_purgeable_resources); // As new resources are put into the diskcache, they go into an uncommitted // list. When a registration is saved that refers to those ids, they're @@ -274,6 +280,9 @@ class CONTENT_EXPORT ServiceWorkerDatabase { void BumpNextRegistrationIdIfNeeded( int64 used_id, leveldb::WriteBatch* batch); + void BumpNextResourceIdIfNeeded( + int64 used_id, + leveldb::WriteBatch* batch); void BumpNextVersionIdIfNeeded( int64 used_id, leveldb::WriteBatch* batch);