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

Unified Diff: webkit/database/database_tracker.cc

Issue 10447117: Unwire the clear on exit preference from the storage systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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
Index: webkit/database/database_tracker.cc
diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc
index 68899deed6fc088e2529d6c759cd5c7971e0536b..2daeef1af92b11bd0e65b88725550988adc63f46 100644
--- a/webkit/database/database_tracker.cc
+++ b/webkit/database/database_tracker.cc
@@ -98,8 +98,7 @@ DatabaseTracker::DatabaseTracker(
base::MessageLoopProxy* db_tracker_thread)
: is_initialized_(false),
is_incognito_(is_incognito),
- clear_local_state_on_exit_(false),
- save_session_state_(false),
+ force_keep_session_state_(false),
shutting_down_(false),
profile_path_(profile_path),
db_dir_(is_incognito_ ?
@@ -810,7 +809,7 @@ void DatabaseTracker::DeleteIncognitoDBDirectory() {
file_util::Delete(incognito_db_dir, true);
}
-void DatabaseTracker::ClearLocalState(bool clear_all_databases) {
+void DatabaseTracker::ClearSessionOnlyOrigins() {
shutting_down_ = true;
bool has_session_only_databases =
@@ -818,7 +817,7 @@ void DatabaseTracker::ClearLocalState(bool clear_all_databases) {
special_storage_policy_->HasSessionOnlyOrigins();
// Clearing only session-only databases, and there are none.
- if (!clear_all_databases && !has_session_only_databases)
+ if (!has_session_only_databases)
return;
if (!LazyInit())
@@ -831,14 +830,10 @@ void DatabaseTracker::ClearLocalState(bool clear_all_databases) {
origin != origin_identifiers.end(); ++origin) {
GURL origin_url =
webkit_database::DatabaseUtil::GetOriginFromIdentifier(*origin);
- if (!clear_all_databases &&
- !special_storage_policy_->IsStorageSessionOnly(origin_url)) {
+ if (!special_storage_policy_->IsStorageSessionOnly(origin_url))
continue;
- }
- if (special_storage_policy_.get() &&
- special_storage_policy_->IsStorageProtected(origin_url)) {
+ if (special_storage_policy_->IsStorageProtected(origin_url))
continue;
- }
webkit_database::OriginInfo origin_info;
std::vector<string16> databases;
GetOriginInfo(*origin, &origin_info);
@@ -869,35 +864,19 @@ void DatabaseTracker::Shutdown() {
}
if (is_incognito_)
DeleteIncognitoDBDirectory();
- else if (!save_session_state_)
- ClearLocalState(clear_local_state_on_exit_);
-}
-
-void DatabaseTracker::SetClearLocalStateOnExit(bool clear_local_state_on_exit) {
- DCHECK(db_tracker_thread_.get());
- if (!db_tracker_thread_->BelongsToCurrentThread()) {
- db_tracker_thread_->PostTask(
- FROM_HERE,
- base::Bind(&DatabaseTracker::SetClearLocalStateOnExit, this,
- clear_local_state_on_exit));
- return;
- }
- if (shutting_down_) {
- NOTREACHED();
- return;
- }
- clear_local_state_on_exit_ = clear_local_state_on_exit;
+ else if (!force_keep_session_state_)
+ ClearSessionOnlyOrigins();
}
-void DatabaseTracker::SaveSessionState() {
+void DatabaseTracker::SetForceKeepSessionState() {
DCHECK(db_tracker_thread_.get());
if (!db_tracker_thread_->BelongsToCurrentThread()) {
db_tracker_thread_->PostTask(
FROM_HERE,
- base::Bind(&DatabaseTracker::SaveSessionState, this));
+ base::Bind(&DatabaseTracker::SetForceKeepSessionState, this));
return;
}
- save_session_state_ = true;
+ force_keep_session_state_ = true;
}
} // namespace webkit_database

Powered by Google App Engine
This is Rietveld 408576698