summaryrefslogtreecommitdiffstats
path: root/webkit/dom_storage
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 11:20:33 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 11:20:33 +0000
commit2665ad3364ffd45c983eb5c274cd6662a1430bd0 (patch)
tree9b51c5edb5886134ceaaf9dcf7e77d48deccd7dd /webkit/dom_storage
parent196d7b5294190a1edc5bdc95453e606ee3d36640 (diff)
downloadchromium_src-2665ad3364ffd45c983eb5c274cd6662a1430bd0.zip
chromium_src-2665ad3364ffd45c983eb5c274cd6662a1430bd0.tar.gz
chromium_src-2665ad3364ffd45c983eb5c274cd6662a1430bd0.tar.bz2
Fix: commit pending sessionStorage changes at shutdown.
BUG=156444 Review URL: https://chromiumcodereview.appspot.com/11362005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage')
-rw-r--r--webkit/dom_storage/dom_storage_area.cc12
-rw-r--r--webkit/dom_storage/dom_storage_area.h2
-rw-r--r--webkit/dom_storage/dom_storage_context.cc10
3 files changed, 10 insertions, 14 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc
index c72b107..5bb0b62 100644
--- a/webkit/dom_storage/dom_storage_area.cc
+++ b/webkit/dom_storage/dom_storage_area.cc
@@ -24,8 +24,7 @@ using webkit_database::DatabaseUtil;
namespace dom_storage {
-// Non-const for testing.
-static int commit_timer_seconds = 1;
+static const int kCommitTimerSeconds = 1;
DomStorageArea::CommitBatch::CommitBatch()
: clear_all_first(false) {
@@ -272,11 +271,6 @@ void DomStorageArea::Shutdown() {
DCHECK(success);
}
-// static
-void DomStorageArea::DisableCommitDelayForTesting() {
- commit_timer_seconds = 0;
-}
-
void DomStorageArea::InitialImportIfNeeded() {
if (is_initial_import_done_)
return;
@@ -301,7 +295,7 @@ DomStorageArea::CommitBatch* DomStorageArea::CreateCommitBatchIfNeeded() {
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&DomStorageArea::OnCommitTimer, this),
- base::TimeDelta::FromSeconds(commit_timer_seconds));
+ base::TimeDelta::FromSeconds(kCommitTimerSeconds));
}
}
return commit_batch_.get();
@@ -352,7 +346,7 @@ void DomStorageArea::OnCommitComplete() {
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&DomStorageArea::OnCommitTimer, this),
- base::TimeDelta::FromSeconds(commit_timer_seconds));
+ base::TimeDelta::FromSeconds(kCommitTimerSeconds));
}
}
diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h
index e0953ff..9a08acf 100644
--- a/webkit/dom_storage/dom_storage_area.h
+++ b/webkit/dom_storage/dom_storage_area.h
@@ -80,8 +80,6 @@ class WEBKIT_STORAGE_EXPORT DomStorageArea
// no longer do anything.
void Shutdown();
- static void DisableCommitDelayForTesting();
-
private:
friend class DomStorageAreaTest;
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics);
diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc
index 8036503..ce8d3a3 100644
--- a/webkit/dom_storage/dom_storage_context.cc
+++ b/webkit/dom_storage/dom_storage_context.cc
@@ -279,9 +279,13 @@ void DomStorageContext::DeleteSessionNamespace(
base::IgnoreResult(&SessionStorageDatabase::DeleteNamespace),
session_storage_database_,
persistent_namespace_id));
- } else if (!scavenging_started_) {
- // Protect the persistent namespace ID from scavenging.
- protected_persistent_session_ids_.insert(persistent_namespace_id);
+ } else {
+ // Ensure that the data gets committed before we shut down.
+ it->second->Shutdown();
+ if (!scavenging_started_) {
+ // Protect the persistent namespace ID from scavenging.
+ protected_persistent_session_ids_.insert(persistent_namespace_id);
+ }
}
}
persistent_namespace_id_to_namespace_id_.erase(persistent_namespace_id);