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

Unified Diff: webkit/dom_storage/dom_storage_context.cc

Issue 9718029: DomStorage commit task sequencing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « webkit/dom_storage/dom_storage_context.h ('k') | webkit/dom_storage/dom_storage_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_context.cc
===================================================================
--- webkit/dom_storage/dom_storage_context.cc (revision 127736)
+++ webkit/dom_storage/dom_storage_context.cc (working copy)
@@ -30,6 +30,7 @@
DomStorageTaskRunner* task_runner)
: directory_(directory),
task_runner_(task_runner),
+ is_shutdown_(false),
clear_local_state_(false),
save_session_state_(false),
special_storage_policy_(special_storage_policy) {
@@ -44,6 +45,8 @@
DomStorageNamespace* DomStorageContext::GetStorageNamespace(
int64 namespace_id) {
+ if (is_shutdown_)
+ return NULL;
StorageNamespaceMap::iterator found = namespaces_.find(namespace_id);
if (found == namespaces_.end()) {
if (namespace_id == kLocalStorageNamespaceId) {
@@ -89,11 +92,19 @@
}
void DomStorageContext::PurgeMemory() {
- // TODO(michaeln): write me
+ // We can only purge memory from the local storage namespace
+ // which is backed by disk.
+ StorageNamespaceMap::iterator found =
+ namespaces_.find(kLocalStorageNamespaceId);
+ if (found != namespaces_.end())
+ found->second->PurgeMemory();
}
void DomStorageContext::Shutdown() {
- // TODO(michaeln): write me
+ is_shutdown_ = true;
+ StorageNamespaceMap::const_iterator it = namespaces_.begin();
+ for (; it != namespaces_.end(); ++it)
+ it->second->Shutdown();
}
void DomStorageContext::AddEventObserver(EventObserver* observer) {
@@ -135,6 +146,8 @@
void DomStorageContext::CreateSessionNamespace(
int64 namespace_id) {
+ if (is_shutdown_)
+ return;
DCHECK(namespace_id != kLocalStorageNamespaceId);
DCHECK(namespaces_.find(namespace_id) == namespaces_.end());
namespaces_[namespace_id] = new DomStorageNamespace(
@@ -149,6 +162,8 @@
void DomStorageContext::CloneSessionNamespace(
int64 existing_id, int64 new_id) {
+ if (is_shutdown_)
+ return;
DCHECK_NE(kLocalStorageNamespaceId, existing_id);
DCHECK_NE(kLocalStorageNamespaceId, new_id);
StorageNamespaceMap::iterator found = namespaces_.find(existing_id);
« no previous file with comments | « webkit/dom_storage/dom_storage_context.h ('k') | webkit/dom_storage/dom_storage_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698