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..1883d8aff9b232a3514975cef509fef65d6f1b4c 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->PurgeUnopenedAreas(); |
+ if (ns->CountInMemoryAreas() > kMaxInMemoryAreas) |
+ ns->PurgeMemory(); |
+ } |
+ } |
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() {} |