Index: webkit/appcache/appcache_storage_impl.cc |
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc |
index 58a3720e2331218a94c616d4e849ef410d20ca82..1a57b5384fdcedc827a4affef94317cc48a3f372 100644 |
--- a/webkit/appcache/appcache_storage_impl.cc |
+++ b/webkit/appcache/appcache_storage_impl.cc |
@@ -68,9 +68,11 @@ bool DeleteGroupAndRelatedRecords(AppCacheDatabase* database, |
return success; |
} |
+// delete_permanent is false if we're deleting only session-only origins. |
void ClearOnExit( |
AppCacheDatabase* database, |
- scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { |
+ scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
+ bool delete_permanent) { |
michaeln
2011/08/26 21:31:01
naming nit: Thoughout the project, this flag goes
marja
2011/08/29 09:41:42
I renamed the flag to clear_all_appcaches (as oppo
|
std::set<GURL> origins; |
database->FindOriginsWithGroups(&origins); |
if (origins.empty()) |
@@ -82,8 +84,18 @@ void ClearOnExit( |
return; |
} |
+ // We're deleting only session-only data, and there is no policy. Delete |
+ // nothing. |
+ if (!delete_permanent && !special_storage_policy) |
+ return; |
+ |
std::set<GURL>::const_iterator origin; |
for (origin = origins.begin(); origin != origins.end(); ++origin) { |
+ // We're deleting session-only origins, and this origin is not a |
+ // session-only origin. |
+ if (!delete_permanent && |
+ !special_storage_policy->IsStorageSessionOnly(*origin)) |
+ continue; |
if (special_storage_policy && |
special_storage_policy->IsStorageProtected(*origin)) |
continue; |
@@ -1148,15 +1160,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::PostTask( |
+ AppCacheThread::db(), |
+ FROM_HERE, |
+ NewRunnableFunction( |
+ ClearOnExit, |
michaeln
2011/08/26 21:31:01
Since this is now done unconditionally, maybe rena
marja
2011/08/29 09:41:42
Renamed to CleanUpOnDatabaseThread.
|
+ database_, |
+ make_scoped_refptr(service_->special_storage_policy()), |
+ service()->clear_local_state_on_exit())); |
AppCacheThread::DeleteSoon(AppCacheThread::db(), FROM_HERE, database_); |
michaeln
2011/08/26 21:31:01
if you buy that, this line could be deleted
marja
2011/08/29 09:41:42
Done.
|
} |
} |