diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 20:38:06 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 20:38:06 +0000 |
commit | cc70801856ea67a98ac0ff0b9064a6b56e67288d (patch) | |
tree | 64239c53473984558fe246e99c20fb9b72fb9ff4 /webkit/appcache/appcache_storage_impl.h | |
parent | 27e469a6fb9942076a2cf27d36f071c31c63dd94 (diff) | |
download | chromium_src-cc70801856ea67a98ac0ff0b9064a6b56e67288d.zip chromium_src-cc70801856ea67a98ac0ff0b9064a6b56e67288d.tar.gz chromium_src-cc70801856ea67a98ac0ff0b9064a6b56e67288d.tar.bz2 |
Lazily delete unused responses from the disk cache.
TEST=not yet
BUG=none
Review URL: http://codereview.chromium.org/545001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_storage_impl.h')
-rw-r--r-- | webkit/appcache/appcache_storage_impl.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/webkit/appcache/appcache_storage_impl.h b/webkit/appcache/appcache_storage_impl.h index 71fe34e..dc28396 100644 --- a/webkit/appcache/appcache_storage_impl.h +++ b/webkit/appcache/appcache_storage_impl.h @@ -46,8 +46,9 @@ class AppCacheStorageImpl : public AppCacheStorage { private: friend class AppCacheStorageImplTest; - // A handful of tasks used to perform database operations on the - // background database thread. + // The AppCacheStorageImpl class methods and datamembers may only be + // accessed on the IO thread. This class manufactures seperate DatabaseTasks + // which access the DB on a seperate background thread. class DatabaseTask; class InitTask; class CloseConnectionTask; @@ -58,6 +59,9 @@ class AppCacheStorageImpl : public AppCacheStorage { class FindMainResponseTask; class MarkEntryAsForeignTask; class MakeGroupObsoleteTask; + class GetDeletableResponseIdsTask; + class InsertDeletableResponseIdsTask; + class DeleteDeletableResponseIdsTask; typedef std::deque<DatabaseTask*> DatabaseTaskQueue; typedef std::map<int64, CacheLoadTask*> PendingCacheLoads; @@ -76,6 +80,11 @@ class AppCacheStorageImpl : public AppCacheStorage { void ScheduleSimpleTask(Task* task); void RunOnePendingSimpleTask(); + void DelayedStartDeletingUnusedResponses(); + void StartDeletingResponses(const std::vector<int64>& response_ids); + void ScheduleDeleteOneResponse(); + void DeleteOneResponse(); + // Sometimes we can respond without having to query the database. void DeliverShortCircuitedFindMainResponse( const GURL& url, AppCacheEntry found_entry, @@ -94,6 +103,13 @@ class AppCacheStorageImpl : public AppCacheStorage { PendingGroupLoads pending_group_loads_; PendingForeignMarkings pending_foreign_markings_; + // Structures to keep track of lazy response deletion. + std::deque<int64> deletable_response_ids_; + std::vector<int64> deleted_response_ids_; + bool is_response_deletion_scheduled_; + bool did_start_deleting_responses_; + int64 last_deletable_response_rowid_; + // Created on the IO thread, but only used on the DB thread. AppCacheDatabase* database_; |