summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_storage_impl.cc33
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()));
}
}