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

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: addressed review comments by Ilya 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
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..7c6b906cf59da131165315f4541fda24b3555f50 100644
--- a/base/metrics/histogram_snapshot_manager.cc
+++ b/base/metrics/histogram_snapshot_manager.cc
@@ -31,10 +31,11 @@ void HistogramSnapshotManager::StartDeltas() {
DCHECK(owned_histograms_.empty());
-#ifdef DEBUG
- CHECK(!iter->second.histogram);
- CHECK(!iter->second.accumulated_samples);
- CHECK(!(iter->second.inconsistencies &
+#if DCHECK_IS_ON()
+ for (const auto& hash_and_info : known_histograms_) {
+ CHECK(!hash_and_info.second.histogram);
+ CHECK(!hash_and_info.second.accumulated_samples);
+ CHECK(!(hash_and_info.second.inconsistencies &
Ilya Sherman 2016/05/05 07:22:37 Should these be DCHECKs? It's odd for them to be
bcwhite 2016/05/05 16:01:17 They could be. Didn't seem to be any difference.
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_);

Powered by Google App Engine
This is Rietveld 408576698