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() {} |