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

Unified Diff: base/metrics/histogram_samples.cc

Issue 2973603002: Remove typically unused local_metadata_ field. (Closed)
Patch Set: Created 3 years, 5 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_samples.h ('k') | base/metrics/sample_map.cc » ('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 59f38fc8ab5c24bcc2350b2636a97f56e5a889cf..965d178378f14528523ac0ae3cfdba6d2a564faf 100644
--- a/base/metrics/histogram_samples.cc
+++ b/base/metrics/histogram_samples.cc
@@ -164,17 +164,6 @@ HistogramSamples::LocalMetadata::LocalMetadata() {
memset(this, 0, sizeof(*this));
}
-// Don't try to delegate behavior to the constructor below that accepts a
-// Matadata pointer by passing &local_meta_. Such cannot be reliably passed
-// because it has not yet been constructed -- no member variables have; the
-// class itself is in the middle of being constructed. Using it to
-// initialize meta_ is okay because the object now exists and local_meta_
-// is before meta_ in the construction order.
-HistogramSamples::HistogramSamples(uint64_t id)
- : meta_(&local_meta_) {
- meta_->id = id;
-}
-
HistogramSamples::HistogramSamples(uint64_t id, Metadata* meta)
: meta_(meta) {
DCHECK(meta_->id == 0 || meta_->id == id);
@@ -185,6 +174,8 @@ HistogramSamples::HistogramSamples(uint64_t id, Metadata* meta)
meta_->id = id;
}
+// This mustn't do anything with |meta_|. It was passed to the ctor and may
+// be invalid by the time this dtor gets called.
HistogramSamples::~HistogramSamples() {}
void HistogramSamples::Add(const HistogramSamples& other) {
« no previous file with comments | « base/metrics/histogram_samples.h ('k') | base/metrics/sample_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698