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

Unified Diff: base/metrics/histogram_samples.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_persistence.cc ('k') | base/metrics/histogram_snapshot_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_samples.cc
diff --git a/base/metrics/histogram_samples.cc b/base/metrics/histogram_samples.cc
index 4cd8e556b81c556dff9c2050348c47449c2d06c9..246a020495222be9806c90e36c153d378fe8d854 100644
--- a/base/metrics/histogram_samples.cc
+++ b/base/metrics/histogram_samples.cc
@@ -73,7 +73,11 @@ HistogramSamples::HistogramSamples(uint64_t id)
HistogramSamples::HistogramSamples(uint64_t id, Metadata* meta)
: meta_(meta) {
DCHECK(meta_->id == 0 || meta_->id == id);
- meta_->id = id;
+
+ // It's possible that |meta| is contained in initialized, read-only memory
+ // so it's essential that no write be done in that case.
+ if (!meta_->id)
+ meta_->id = id;
}
HistogramSamples::~HistogramSamples() {}
« no previous file with comments | « base/metrics/histogram_persistence.cc ('k') | base/metrics/histogram_snapshot_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698