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

Unified Diff: base/metrics/histogram_snapshot_manager.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: removed some unnecessary includes Created 4 years, 7 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 | « base/metrics/histogram_snapshot_manager.h ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_snapshot_manager.cc
diff --git a/base/metrics/histogram_snapshot_manager.cc b/base/metrics/histogram_snapshot_manager.cc
index e21d512daba271dc43248a9e63b598ce98d55472..dc6cb8a86ed62c97cce03ecb5cc88676ba1b4282 100644
--- a/base/metrics/histogram_snapshot_manager.cc
+++ b/base/metrics/histogram_snapshot_manager.cc
@@ -31,11 +31,12 @@ void HistogramSnapshotManager::StartDeltas() {
DCHECK(owned_histograms_.empty());
-#ifdef DEBUG
- CHECK(!iter->second.histogram);
- CHECK(!iter->second.accumulated_samples);
- CHECK(!(iter->second.inconsistencies &
- HistogramBase::NEW_INCONSISTENCY_FOUND));
+#if DCHECK_IS_ON()
+ for (const auto& hash_and_info : known_histograms_) {
+ DCHECK(!hash_and_info.second.histogram);
+ DCHECK(!hash_and_info.second.accumulated_samples);
+ DCHECK(!(hash_and_info.second.inconsistencies &
+ HistogramBase::NEW_INCONSISTENCY_FOUND));
}
#endif
}
@@ -60,6 +61,12 @@ void HistogramSnapshotManager::PrepareAbsoluteTakingOwnership(
owned_histograms_.push_back(std::move(histogram));
}
+void HistogramSnapshotManager::PrepareFinalDeltaTakingOwnership(
+ std::unique_ptr<const HistogramBase> histogram) {
+ PrepareSamples(histogram.get(), histogram->SnapshotFinalDelta());
+ owned_histograms_.push_back(std::move(histogram));
+}
+
void HistogramSnapshotManager::FinishDeltas() {
DCHECK(preparing_deltas_);
« no previous file with comments | « base/metrics/histogram_snapshot_manager.h ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698