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

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: fix rebase failure 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 a43521239015e3c4e90700a83440c843d8167e16..addf3c2d3ae85eb99aa03dbb46c6e04c14895349 100644
--- a/content/browser/service_worker/service_worker_database.h
+++ b/content/browser/service_worker/service_worker_database.h
@@ -92,6 +92,16 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
int64* next_avail_version_id,
int64* next_avail_resource_id);
+ // Used for diskcache migration (http://crbug.com/487482). Returns true if the
+ // storage needs to migrate a disk cache.
+ Status IsDiskCacheMigrationNeeded(bool* migration_needed);
+ Status SetDiskCacheMigrationNotNeeded();
+
+ // Used for diskcache migration (http://crbug.com/487482). Returns true if the
+ // storage needs to delete an old disk cache.
+ Status IsOldDiskCacheDeletionNeeded(bool* deletion_needed);
+ Status SetOldDiskCacheDeletionNotNeeded();
+
// 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.
@@ -366,6 +376,13 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
};
State state_;
+ // Used for testing. Skips writing kDiskCacheMigrationNotNeededKey and
+ // kOldDiskCacheDeletionNotNeededKey when initializing a new database.
michaeln 2015/06/15 23:03:24 #if defined(UNIT_TEST) and the comment might not b
nhiroki 2015/06/16 03:46:25 Done.
+ void set_skip_writing_diskcache_migration_state_on_init() {
+ skip_writing_diskcache_migration_state_on_init_ = true;
+ };
+ bool skip_writing_diskcache_migration_state_on_init_;
+
base::SequenceChecker sequence_checker_;
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase);
@@ -377,7 +394,12 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
UserData_UninitializedDatabase);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DiskCacheMigrationState);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, UpgradeSchemaToVersion2);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest,
+ MigrateOnDiskCacheAccess);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest,
+ NotMigrateOnDatabaseAccess);
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase);
};

Powered by Google App Engine
This is Rietveld 408576698