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

Unified Diff: webkit/dom_storage/dom_storage_namespace.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_namespace.h ('k') | webkit/dom_storage/dom_storage_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_namespace.cc
diff --git a/webkit/dom_storage/dom_storage_namespace.cc b/webkit/dom_storage/dom_storage_namespace.cc
index 4c1cbd7466c63818c755b183a3bcd628882e0225..941a169275a3b57d8cc5d043234b6bd4ba8f41de 100644
--- a/webkit/dom_storage/dom_storage_namespace.cc
+++ b/webkit/dom_storage/dom_storage_namespace.cc
@@ -117,7 +117,7 @@ void DomStorageNamespace::DeleteSessionStorageOrigin(const GURL& origin) {
CloseStorageArea(area);
}
-void DomStorageNamespace::PurgeMemory() {
+void DomStorageNamespace::PurgeMemory(PurgeOption option) {
if (directory_.empty())
return; // We can't purge w/o backing on disk.
AreaMap::iterator it = areas_.begin();
@@ -136,8 +136,12 @@ void DomStorageNamespace::PurgeMemory() {
continue;
}
- // Otherwise, we can clear caches and such.
- it->second.area_->PurgeMemory();
+ if (option == PURGE_AGGRESSIVE) {
+ // If aggressive is true, we clear caches and such
+ // for opened areas.
+ it->second.area_->PurgeMemory();
+ }
+
++it;
}
}
@@ -148,6 +152,14 @@ void DomStorageNamespace::Shutdown() {
it->second.area_->Shutdown();
}
+unsigned int DomStorageNamespace::CountInMemoryAreas() const {
+ unsigned int area_count = 0;
+ for (AreaMap::const_iterator it = areas_.begin(); it != areas_.end(); ++it) {
+ if (it->second.area_->IsLoadedInMemory())
+ ++area_count;
+ }
+ return area_count;
+}
DomStorageNamespace::AreaHolder*
DomStorageNamespace::GetAreaHolder(const GURL& origin) {
« no previous file with comments | « webkit/dom_storage/dom_storage_namespace.h ('k') | webkit/dom_storage/dom_storage_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698