Index: content/browser/dom_storage/dom_storage_context_impl.cc |
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc |
index 3ef365c2bb045af1bd4c4f3931d2fc9d5f7a5da9..325bbab2c18ae62dfad39ac086ab7aa1b79e72de 100644 |
--- a/content/browser/dom_storage/dom_storage_context_impl.cc |
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc |
@@ -445,9 +445,6 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) { |
// Purging is done based on the cache sizes without including the database |
// size since it can be expensive trying to estimate the sqlite usage for |
// all databases. For low end devices purge all inactive areas. |
- if (!initial_stats.inactive_area_count) |
- return; |
- |
if (initial_stats.total_cache_size > kMaxCacheSize) |
purge_reason = "SizeLimitExceeded"; |
else if (initial_stats.total_area_count > kMaxStorageAreaCount) |
@@ -460,13 +457,18 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) { |
purge_option = PURGE_UNOPENED; |
} |
+ // Return if no areas can be purged with the given option. |
bool aggressively = purge_option == PURGE_AGGRESSIVE; |
+ if ((aggressively && !initial_stats.total_area_count) || |
+ (!aggressively && !initial_stats.inactive_area_count)) { |
+ return; |
+ } |
for (const auto& it : namespaces_) |
it.second->PurgeMemory(aggressively); |
// Track the size of cache purged. |
if (!purge_reason) { |
michaeln
2016/06/27 21:51:15
nit: it might be nice to set purge_reason in all c
ssid
2016/06/27 22:00:37
Done.
|
- if (purge_option == PURGE_AGGRESSIVE) |
+ if (aggressively) |
purge_reason = "AggressivePurgeTriggered"; |
else |
purge_reason = "ModeratePurgeTriggered"; |