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

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: Code review comments. 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..63c05549bcda7a80f147edccb9a7594dba4b782a 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()));
}
}
« 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