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

Unified Diff: base/metrics/sparse_histogram.cc

Issue 1689833002: Add ownership-transfer to histogram management calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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_unittest.cc ('k') | base/metrics/statistics_recorder.h » ('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 5653456a29fb552470871f8611cb6337ec65bc50..afe677712dcffd74e1b4ceefdf5e91e48cab645e 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -25,10 +25,10 @@ HistogramBase* SparseHistogram::FactoryGet(const std::string& name,
if (!histogram) {
// To avoid racy destruction at shutdown, the following will be leaked.
- HistogramBase* tentative_histogram = new SparseHistogram(name);
+ scoped_ptr<HistogramBase> tentative_histogram(new SparseHistogram(name));
tentative_histogram->SetFlags(flags);
- histogram =
- StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
+ histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(
+ std::move(tentative_histogram));
}
DCHECK_EQ(SPARSE_HISTOGRAM, histogram->GetHistogramType());
return histogram;
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698