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

Unified Diff: webkit/dom_storage/dom_storage_host.cc

Issue 12398008: Purge in-memory localStorage areas if the # of areas exceeds the limit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 7 years, 8 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_host.h ('k') | webkit/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_host.cc
diff --git a/webkit/dom_storage/dom_storage_host.cc b/webkit/dom_storage/dom_storage_host.cc
index a8637e0641bb9224623ef5c2e84f5bdf1a597e1c..7f4fca1f5b0412e8daf32a53b490cb042dfaac13 100644
--- a/webkit/dom_storage/dom_storage_host.cc
+++ b/webkit/dom_storage/dom_storage_host.cc
@@ -61,6 +61,15 @@ bool DomStorageHost::ExtractAreaValues(
// for sending a bad message.
return true;
}
+ if (!area->IsLoadedInMemory()) {
+ DomStorageNamespace* ns = GetNamespace(connection_id);
+ DCHECK(ns);
+ if (ns->CountInMemoryAreas() > kMaxInMemoryAreas) {
+ ns->PurgeMemory(DomStorageNamespace::PURGE_UNOPENED);
+ if (ns->CountInMemoryAreas() > kMaxInMemoryAreas)
+ ns->PurgeMemory(DomStorageNamespace::PURGE_AGGRESSIVE);
+ }
+ }
area->ExtractValues(map);
return true;
}
@@ -146,6 +155,13 @@ DomStorageArea* DomStorageHost::GetOpenArea(int connection_id) {
return found->second.area_;
}
+DomStorageNamespace* DomStorageHost::GetNamespace(int connection_id) {
+ AreaMap::iterator found = connections_.find(connection_id);
+ if (found == connections_.end())
+ return NULL;
+ return found->second.namespace_;
+}
+
// NamespaceAndArea
DomStorageHost::NamespaceAndArea::NamespaceAndArea() {}
« no previous file with comments | « webkit/dom_storage/dom_storage_host.h ('k') | webkit/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698