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

Unified Diff: components/metrics/file_metrics_provider.cc

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: back-out PrepareDifference change Created 4 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
Index: components/metrics/file_metrics_provider.cc
diff --git a/components/metrics/file_metrics_provider.cc b/components/metrics/file_metrics_provider.cc
index 36a60df799006f9684477f5f63ce7be256ed5948..65284556c7dbbdb3147823e83134d238179209b3 100644
--- a/components/metrics/file_metrics_provider.cc
+++ b/components/metrics/file_metrics_provider.cc
@@ -185,10 +185,11 @@ void FileMetricsProvider::RecordHistogramSnapshotsFromFile(
scoped_ptr<base::HistogramBase> histogram = histogram_iter.GetNext();
if (!histogram)
break;
- if (file->type == FILE_HISTOGRAMS_ATOMIC)
- snapshot_manager->PrepareAbsoluteTakingOwnership(std::move(histogram));
- else
- snapshot_manager->PrepareDeltaTakingOwnership(std::move(histogram));
+ // The "delta" is calculated, which updates the "logged" counts, even
+ // for "atomic" files that may be read-only. This is possible because
+ // the file contents are copied into read/write memory which is then
+ // discarded after the reporting is complete.
Ilya Sherman 2016/04/20 17:10:33 To clarify: What happens to the actual backing fil
bcwhite 2016/04/22 15:18:05 The backing file is atomically overwritten (using
+ snapshot_manager->PrepareDeltaTakingOwnership(std::move(histogram));
++histogram_count;
}

Powered by Google App Engine
This is Rietveld 408576698