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

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

Issue 2073523003: Add tagged histogram with reasons of purging the dom storage databases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 e4ccfe0dec5f62f9f7117751b5856eee252c91e0..053c613bc35356004d073c3aa16cb386a6d1c950 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -439,15 +439,20 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) {
initial_stats.total_cache_size / 1024, 1, 100000,
50);
+ const char* purge_reason = nullptr;
if (purge_option == PURGE_IF_NEEDED) {
// 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.
- bool should_purge =
- initial_stats.inactive_area_count &&
- (is_low_end_device_ || initial_stats.total_cache_size > kMaxCacheSize ||
- initial_stats.total_area_count > kMaxStorageAreaCount);
- if (!should_purge)
+ if (!initial_stats.inactive_area_count)
+ return;
+ if (is_low_end_device_)
+ purge_reason = "InactiveOnLowEndDevice";
+ else if (initial_stats.total_cache_size > kMaxCacheSize)
+ purge_reason = "SizeLimitExceeded";
+ else if (initial_stats.total_area_count > kMaxStorageAreaCount)
+ purge_reason = "AreaCountLimitExceeded";
+ if (!purge_reason)
return;
purge_option = PURGE_UNOPENED;
@@ -458,12 +463,20 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) {
it.second->PurgeMemory(aggressively);
// Track the size of cache purged.
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "LocalStorage.BrowserLocalStorageCachePurgedInKB",
+ size_t purged_size_kib =
(initial_stats.total_cache_size -
GetTotalNamespaceStatistics(namespaces_).total_cache_size) /
- 1024,
- 1, 100000, 50);
+ 1024;
+ std::string full_histogram_name =
+ std::string("LocalStorage.BrowserLocalStorageCachePurgedInKB.") +
Maria 2016/06/16 00:08:15 you also need to update histograms.xml file with t
ssid 2016/06/16 01:01:24 I copied the pattern from "Sqlite.SizeKB" it also
+ purge_reason;
+ base::HistogramBase* histogram = base::Histogram::FactoryGet(
+ full_histogram_name, 1, 100000, 50,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ if (histogram)
+ histogram->Add(purged_size_kib);
+ UMA_HISTOGRAM_CUSTOM_COUNTS("LocalStorage.BrowserLocalStorageCachePurgedInKB",
+ purged_size_kib, 1, 100000, 50);
}
bool DOMStorageContextImpl::OnMemoryDump(
« 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