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

Unified Diff: base/metrics/sparse_histogram.cc

Issue 2973863002: Remove std::string histogram name from HistogramBase object.
Patch Set: rebased Created 3 years, 4 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/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/sparse_histogram.cc
diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc
index e9bacd1ab2af62c8a472a217aac56ca6fdf1470c..9063b85df910979454784dc1d042bbd8ae426fd9 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -45,7 +45,7 @@ HistogramBase* SparseHistogram::FactoryGet(const std::string& name,
DCHECK(!histogram_ref); // Should never have been set.
DCHECK(!allocator); // Shouldn't have failed.
flags &= ~HistogramBase::kIsPersistent;
- tentative_histogram.reset(new SparseHistogram(name));
+ tentative_histogram.reset(new SparseHistogram(GetPermanentName(name)));
tentative_histogram->SetFlags(flags);
}
@@ -75,7 +75,7 @@ HistogramBase* SparseHistogram::FactoryGet(const std::string& name,
// static
std::unique_ptr<HistogramBase> SparseHistogram::PersistentCreate(
PersistentHistogramAllocator* allocator,
- const std::string& name,
+ const char* name,
HistogramSamples::Metadata* meta,
HistogramSamples::Metadata* logged_meta) {
return WrapUnique(
@@ -173,13 +173,13 @@ bool SparseHistogram::SerializeInfoImpl(Pickle* pickle) const {
return pickle->WriteString(histogram_name()) && pickle->WriteInt(flags());
}
-SparseHistogram::SparseHistogram(const std::string& name)
+SparseHistogram::SparseHistogram(const char* name)
: HistogramBase(name),
unlogged_samples_(new SampleMap(HashMetricName(name))),
logged_samples_(new SampleMap(unlogged_samples_->id())) {}
SparseHistogram::SparseHistogram(PersistentHistogramAllocator* allocator,
- const std::string& name,
+ const char* name,
HistogramSamples::Metadata* meta,
HistogramSamples::Metadata* logged_meta)
: HistogramBase(name),
@@ -277,9 +277,7 @@ void SparseHistogram::WriteAsciiImpl(bool graph_it,
void SparseHistogram::WriteAsciiHeader(const Count total_count,
std::string* output) const {
- StringAppendF(output,
- "Histogram: %s recorded %d samples",
- histogram_name().c_str(),
+ StringAppendF(output, "Histogram: %s recorded %d samples", histogram_name(),
total_count);
if (flags())
StringAppendF(output, " (flags = 0x%x)", flags());
« no previous file with comments | « base/metrics/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698