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

Unified Diff: base/metrics/statistics_recorder.cc

Issue 1181293005: Optimize memory use of registered histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comments. Created 5 years, 6 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/statistics_recorder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/statistics_recorder.cc
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index 85408e1fa496dec8dae7574213a3f3b21a1b123d..f14f037b9e7413cfe643a4af14d6ab84676439c0 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -57,9 +57,9 @@ HistogramBase* StatisticsRecorder::RegisterOrDeleteDuplicate(
histogram_to_return = histogram;
} else {
const std::string& name = histogram->histogram_name();
- HistogramMap::iterator it = histograms_->find(name);
+ HistogramMap::iterator it = histograms_->find(HistogramNameRef(name));
if (histograms_->end() == it) {
- (*histograms_)[name] = histogram;
+ (*histograms_)[HistogramNameRef(name)] = histogram;
ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322
histogram_to_return = histogram;
} else if (histogram == it->second) {
@@ -190,7 +190,7 @@ void StatisticsRecorder::GetHistograms(Histograms* output) {
return;
for (const auto& entry : *histograms_) {
- DCHECK_EQ(entry.first, entry.second->histogram_name());
+ DCHECK_EQ(entry.first.name_, entry.second->histogram_name());
output->push_back(entry.second);
}
}
@@ -219,7 +219,7 @@ HistogramBase* StatisticsRecorder::FindHistogram(const std::string& name) {
if (histograms_ == NULL)
return NULL;
- HistogramMap::iterator it = histograms_->find(name);
+ HistogramMap::iterator it = histograms_->find(HistogramNameRef(name));
if (histograms_->end() == it)
return NULL;
return it->second;
@@ -235,7 +235,7 @@ void StatisticsRecorder::GetSnapshot(const std::string& query,
return;
for (const auto& entry : *histograms_) {
- if (entry.first.find(query) != std::string::npos)
+ if (entry.first.name_.find(query) != std::string::npos)
snapshot->push_back(entry.second);
}
}
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698