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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

Issue 2092133003: [DOMStorage] Do not try purging caches when no database is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter_args
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698