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

Unified Diff: base/metrics/histogram_snapshot_manager.cc

Issue 1537743006: Persist setup metrics and have Chrome report them during UMA upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: addressed final review comments by Alexei Created 4 years, 10 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') | chrome/browser/metrics/chrome_metrics_service_client.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 e03213fc72104774fc9568601e6f537952693847..32dd4e67e36ad196e72555f5df2b3aba5c20b75d 100644
--- a/base/metrics/histogram_snapshot_manager.cc
+++ b/base/metrics/histogram_snapshot_manager.cc
@@ -27,8 +27,9 @@ void HistogramSnapshotManager::StartDeltas() {
DCHECK(!preparing_deltas_);
preparing_deltas_ = true;
+ DCHECK(owned_histograms_.empty());
+
#ifdef DEBUG
- for (const auto& iter : known_histograms) {
CHECK(!iter->second.histogram);
CHECK(!iter->second.accumulated_samples);
CHECK(!(iter->second.inconsistencies &
@@ -41,16 +42,28 @@ void HistogramSnapshotManager::PrepareDelta(HistogramBase* histogram) {
PrepareSamples(histogram, histogram->SnapshotDelta());
}
+void HistogramSnapshotManager::PrepareDeltaTakingOwnership(
+ scoped_ptr<HistogramBase> histogram) {
+ PrepareSamples(histogram.get(), histogram->SnapshotDelta());
+ owned_histograms_.push_back(std::move(histogram));
+}
+
void HistogramSnapshotManager::PrepareAbsolute(const HistogramBase* histogram) {
PrepareSamples(histogram, histogram->SnapshotSamples());
}
+void HistogramSnapshotManager::PrepareAbsoluteTakingOwnership(
+ scoped_ptr<const HistogramBase> histogram) {
+ PrepareSamples(histogram.get(), histogram->SnapshotSamples());
+ owned_histograms_.push_back(std::move(histogram));
+}
+
void HistogramSnapshotManager::FinishDeltas() {
DCHECK(preparing_deltas_);
// Iterate over all known histograms to see what should be recorded.
- for (auto& iter : known_histograms_) {
- SampleInfo* sample_info = &iter.second;
+ for (auto& hash_and_info : known_histograms_) {
+ SampleInfo* sample_info = &hash_and_info.second;
// First, record any histograms in which corruption was detected.
if (sample_info->inconsistencies & HistogramBase::NEW_INCONSISTENCY_FOUND) {
@@ -77,6 +90,7 @@ void HistogramSnapshotManager::FinishDeltas() {
sample_info->histogram = nullptr;
}
+ owned_histograms_.clear();
preparing_deltas_ = false;
}
« no previous file with comments | « base/metrics/histogram_snapshot_manager.h ('k') | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698