Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1401)

Unified Diff: content/browser/service_worker/service_worker_database.h

Issue 1152543002: ServiceWorker: Migrate the script cache backend from BlockFile to Simple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove needs_disk_cache_migration Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_database.h
diff --git a/content/browser/service_worker/service_worker_database.h b/content/browser/service_worker/service_worker_database.h
index 13c0ed480a2623772118475ea4c07264a302d825..21da4658f13af0fa74dcb41c2381bbd90e8a5027 100644
--- a/content/browser/service_worker/service_worker_database.h
+++ b/content/browser/service_worker/service_worker_database.h
@@ -92,6 +92,14 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
int64* next_avail_version_id,
int64* next_avail_resource_id);
+ // Reads the current diskcache version from the database. If the database
+ // hasn't been written anything yet, sets |disk_cache_version| to 0 and
+ // returns OK.
+ Status ReadDiskCacheVersion(int64* disk_cache_version);
+
+ // Writes the current diskcache version into the database.
+ Status WriteDiskCacheVersion(int64 disk_cache_version);
+
// Reads origins that have one or more than one registration from the
// database. Returns OK if they are successfully read or not found.
// Otherwise, returns an error.
@@ -224,6 +232,23 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
// Returns OK on success. Otherwise deletes nothing and returns an error.
Status PurgeUncommittedResourceIds(const std::set<int64>& ids);
+ // These *PurgeableFile functions are used for tracking purgeable files placed
+ // under the service worker directory (ie. kServiceWorkerDirectory defined in
+ // ServiceWorkerContextCore). The files should be deletable on the diskcache
+ // thread.
+
+ // Reads filenames of purgeable files from the database. Returns OK on success
+ // even if there are no purgeable files in the database.
+ Status GetPurgeableFiles(std::vector<std::string>* filenames);
+
+ // Writes |filename| into the database as a purgeable file. Returns OK on
+ // success.
+ Status WritePurgeableFile(const std::string& filename);
+
+ // Deletes a purgeable file specified by |filename| from the database. Returns
+ // OK on success.
+ Status ClearPurgeableFile(const std::string& filename);
+
// Deletes all data for |origins|, namely, unique origin, registrations and
// resource records. Resources are moved to the purgeable list. Returns OK if
// they are successfully deleted or not found in the database. Otherwise,
@@ -370,6 +395,7 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase_InMemory);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DiskCacheVersion);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
Registration_UninitializedDatabase);

Powered by Google App Engine
This is Rietveld 408576698