summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 08:31:43 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 08:31:43 +0000
commitbf510ed89ae0469951d8a9d39ca40e6c171db663 (patch)
tree781235082dd354a4731d32ac9322aff8ff30c73f /webkit/appcache
parent52d213e0e78f33a43364913c1328cac0bac42299 (diff)
downloadchromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.zip
chromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.tar.gz
chromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.tar.bz2
Unwire the clear on exit preference from the storage systems.
The "session only" rules should cover the functionality now UI changes and migration code will follow BUG=129349 TEST=added unit tests for the chrome/browser/net/sqlite* classes Review URL: https://chromiumcodereview.appspot.com/10447117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_service.cc4
-rw-r--r--webkit/appcache/appcache_service.h16
-rw-r--r--webkit/appcache/appcache_storage_impl.cc20
3 files changed, 14 insertions, 26 deletions
diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc
index 2bb99cf..0c4d9a9 100644
--- a/webkit/appcache/appcache_service.cc
+++ b/webkit/appcache/appcache_service.cc
@@ -425,8 +425,8 @@ void AppCacheService::CheckResponseHelper::OnReadDataComplete(int result) {
AppCacheService::AppCacheService(quota::QuotaManagerProxy* quota_manager_proxy)
: appcache_policy_(NULL), quota_client_(NULL),
quota_manager_proxy_(quota_manager_proxy),
- request_context_(NULL), clear_local_state_on_exit_(false),
- save_session_state_(false) {
+ request_context_(NULL),
+ force_keep_session_state_(false) {
if (quota_manager_proxy_) {
quota_client_ = new AppCacheQuotaClient(this);
quota_manager_proxy_->RegisterClient(quota_client_);
diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h
index c05bea4..3d9f8bb 100644
--- a/webkit/appcache/appcache_service.h
+++ b/webkit/appcache/appcache_service.h
@@ -143,16 +143,9 @@ class APPCACHE_EXPORT AppCacheService {
AppCacheStorage* storage() const { return storage_.get(); }
- bool clear_local_state_on_exit() const { return clear_local_state_on_exit_; }
- void set_clear_local_state_on_exit(bool clear_local_state_on_exit) {
- clear_local_state_on_exit_ = clear_local_state_on_exit; }
-
- bool save_session_state() const { return save_session_state_; }
- // If |save_session_state| is true, disables the exit-time deletion for all
- // data (also session-only data).
- void set_save_session_state(bool save_session_state) {
- save_session_state_ = save_session_state;
- }
+ // Disables the exit-time deletion of session-only data.
+ void set_force_keep_session_state() { force_keep_session_state_ = true; }
+ bool force_keep_session_state() const { return force_keep_session_state_; }
protected:
friend class AppCacheStorageImplTest;
@@ -177,9 +170,8 @@ class APPCACHE_EXPORT AppCacheService {
BackendMap backends_; // One 'backend' per child process.
// Context for use during cache updates.
net::URLRequestContext* request_context_;
- bool clear_local_state_on_exit_;
// If true, nothing (not even session-only data) should be deleted on exit.
- bool save_session_state_;
+ bool force_keep_session_state_;
DISALLOW_COPY_AND_ASSIGN(AppCacheService);
};
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index 1ddfaa4..3d8c785 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -75,17 +75,15 @@ bool DeleteGroupAndRelatedRecords(AppCacheDatabase* database,
}
// Destroys |database|. If there is appcache data to be deleted
-// (|save_session_state| is false), deletes all appcache data (if
-// |clear_all_data| is true), or session-only appcache data (otherwise).
-void CleanUpOnDatabaseThread(
+// (|force_keep_session_state| is false), deletes session-only appcache data.
+void ClearSessionOnlyOrigins(
AppCacheDatabase* database,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
- bool clear_all_appcaches,
- bool save_session_state) {
+ bool force_keep_session_state) {
scoped_ptr<AppCacheDatabase> database_to_delete(database);
// If saving session state, only delete the database.
- if (save_session_state)
+ if (force_keep_session_state)
return;
bool has_session_only_appcaches =
@@ -93,7 +91,7 @@ void CleanUpOnDatabaseThread(
special_storage_policy->HasSessionOnlyOrigins();
// Clearning only session-only databases, and there are none.
- if (!clear_all_appcaches && !has_session_only_appcaches)
+ if (!has_session_only_appcaches)
return;
std::set<GURL> origins;
@@ -109,8 +107,7 @@ void CleanUpOnDatabaseThread(
std::set<GURL>::const_iterator origin;
for (origin = origins.begin(); origin != origins.end(); ++origin) {
- if (!clear_all_appcaches &&
- !special_storage_policy->IsStorageSessionOnly(*origin))
+ if (!special_storage_policy->IsStorageSessionOnly(*origin))
continue;
if (special_storage_policy &&
special_storage_policy->IsStorageProtected(*origin))
@@ -1315,10 +1312,9 @@ AppCacheStorageImpl::~AppCacheStorageImpl() {
if (database_ &&
!db_thread_->PostTask(
FROM_HERE,
- base::Bind(&CleanUpOnDatabaseThread, database_,
+ base::Bind(&ClearSessionOnlyOrigins, database_,
make_scoped_refptr(service_->special_storage_policy()),
- service()->clear_local_state_on_exit(),
- service()->save_session_state()))) {
+ service()->force_keep_session_state()))) {
delete database_;
}
}