diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-30 12:46:56 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-30 12:46:56 +0000 |
commit | 9e0c115f468fd538bf7f424e0c77438846c7f69c (patch) | |
tree | 3a2e5dd23f533bdddf12f63bbe2fd29aff1d6a38 /webkit/appcache | |
parent | 4c6107e480336940a0fc929d2c5fa4bc138e61fc (diff) | |
download | chromium_src-9e0c115f468fd538bf7f424e0c77438846c7f69c.zip chromium_src-9e0c115f468fd538bf7f424e0c77438846c7f69c.tar.gz chromium_src-9e0c115f468fd538bf7f424e0c77438846c7f69c.tar.bz2 |
Session-only appcache.
BUG=47049
TEST=ChromeAppCacheServiceTest.*
Review URL: http://codereview.chromium.org/7741040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_storage_impl.cc | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index 58a3720..63c0554 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -68,9 +68,17 @@ bool DeleteGroupAndRelatedRecords(AppCacheDatabase* database, return success; } -void ClearOnExit( +// Deletes all appcache data (if clear_all_data is true), or session-only +// appcache data. Also, schedules the database to be destroyed. +void CleanUpOnDatabaseThread( AppCacheDatabase* database, - scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { + scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, + bool clear_all_appcaches) { + scoped_ptr<AppCacheDatabase> database_to_delete(database); + + if (!clear_all_appcaches && !special_storage_policy) + return; + std::set<GURL> origins; database->FindOriginsWithGroups(&origins); if (origins.empty()) @@ -84,6 +92,9 @@ void ClearOnExit( std::set<GURL>::const_iterator origin; for (origin = origins.begin(); origin != origins.end(); ++origin) { + if (!clear_all_appcaches && + !special_storage_policy->IsStorageSessionOnly(*origin)) + continue; if (special_storage_policy && special_storage_policy->IsStorageProtected(*origin)) continue; @@ -1148,16 +1159,14 @@ AppCacheStorageImpl::~AppCacheStorageImpl() { std::mem_fun(&DatabaseTask::CancelCompletion)); if (database_) { - if (service()->clear_local_state_on_exit()) { - AppCacheThread::PostTask( - AppCacheThread::db(), - FROM_HERE, - NewRunnableFunction( - ClearOnExit, - database_, - make_scoped_refptr(service_->special_storage_policy()))); - } - AppCacheThread::DeleteSoon(AppCacheThread::db(), FROM_HERE, database_); + AppCacheThread::PostTask( + AppCacheThread::db(), + FROM_HERE, + NewRunnableFunction( + CleanUpOnDatabaseThread, + database_, + make_scoped_refptr(service_->special_storage_policy()), + service()->clear_local_state_on_exit())); } } |