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

Unified Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 2010173005: Support experiment to store persistent metrics in memory-mapped file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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
Index: chrome/browser/metrics/chrome_metrics_service_client.cc
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
index 2861db7cdd25856894100c062c4ab3cc835428f0..3f0bd7d2efe89d38effad86da9d89041f1cbac33 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -213,6 +213,20 @@ ChromeMetricsServiceClient::ChromeMetricsServiceClient(
ChromeMetricsServiceClient::~ChromeMetricsServiceClient() {
DCHECK(thread_checker_.CalledOnValidThread());
+
+ // If there is a global metrics file being updated on disk, mark it to be
Alexei Svitkine (slow) 2016/06/16 11:36:57 Please make a function in the anon namespace that
bcwhite 2016/06/16 14:21:08 Done. I checked that the object is deleted on cle
+ // deleted when the process exits. A normal shutdown is almost complete
+ // so there is no benefit in keeping a file with no new data to be processed
+ // during the next startup sequence.
+ base::GlobalHistogramAllocator* allocator =
+ base::GlobalHistogramAllocator::Get();
+ if (allocator) {
+ base::FilePath path = allocator->GetPersistentLocation();
+ if (!path.empty()) {
+ base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ |
+ base::File::FLAG_DELETE_ON_CLOSE);
+ }
+ }
}
// static

Powered by Google App Engine
This is Rietveld 408576698