diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 06:04:56 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 06:04:56 +0000 |
commit | 05d8c3ab7688cc2c009f4514779f1f9f40e8e36c (patch) | |
tree | 029631c66090abb67c21a6f7f3ecda8f37a4e81c /webkit/dom_storage/dom_storage_host.cc | |
parent | 45c9010caec464904fe9cb0fd68173895e562a61 (diff) | |
download | chromium_src-05d8c3ab7688cc2c009f4514779f1f9f40e8e36c.zip chromium_src-05d8c3ab7688cc2c009f4514779f1f9f40e8e36c.tar.gz chromium_src-05d8c3ab7688cc2c009f4514779f1f9f40e8e36c.tar.bz2 |
Purge in-memory localStorage areas if the # of areas exceeds the limit
BUG=178980
TEST=manual (verified the memory stops increasing at a certain level)
Review URL: https://chromiumcodereview.appspot.com/12398008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage/dom_storage_host.cc')
-rw-r--r-- | webkit/dom_storage/dom_storage_host.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/webkit/dom_storage/dom_storage_host.cc b/webkit/dom_storage/dom_storage_host.cc index a8637e0..7f4fca1 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() {} |