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

Unified Diff: webkit/appcache/appcache_storage_impl.cc

Issue 7741040: Session-only appcache. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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
« no previous file with comments | « content/browser/appcache/chrome_appcache_service_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
}
}
« no previous file with comments | « content/browser/appcache/chrome_appcache_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698