| Index: chromecast/base/metrics/grouped_histogram.cc
|
| diff --git a/chromecast/base/metrics/grouped_histogram.cc b/chromecast/base/metrics/grouped_histogram.cc
|
| index 1101a7992c55f6f25658d743d992404087298065..34bf5382e161f6b5c223aab6aa7f17cb5636e9ec 100644
|
| --- a/chromecast/base/metrics/grouped_histogram.cc
|
| +++ b/chromecast/base/metrics/grouped_histogram.cc
|
| @@ -143,20 +143,23 @@ void PreregisterHistogram(const std::string& name,
|
| DCHECK(!base::StatisticsRecorder::FindHistogram(name))
|
| << "Failed to preregister " << name << ", Histogram already exists.";
|
|
|
| - // To avoid racy destruction at shutdown, the following will be leaked.
|
| - base::BucketRanges* ranges = new base::BucketRanges(bucket_count + 1);
|
| - base::Histogram::InitializeBucketRanges(minimum, maximum, ranges);
|
| + scoped_ptr<base::BucketRanges> ranges(
|
| + new base::BucketRanges(bucket_count + 1));
|
| + base::Histogram::InitializeBucketRanges(minimum, maximum, ranges.get());
|
| const base::BucketRanges* registered_ranges =
|
| - base::StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges);
|
| + base::StatisticsRecorder::RegisterOrDeleteDuplicateRanges(
|
| + std::move(ranges));
|
|
|
| - GroupedHistogram* tentative_histogram =
|
| - new GroupedHistogram(name, minimum, maximum, registered_ranges);
|
| + scoped_ptr<GroupedHistogram> tentative_histogram(
|
| + new GroupedHistogram(name, minimum, maximum, registered_ranges));
|
|
|
| tentative_histogram->SetFlags(flags);
|
| + const void* allocated_histogram = tentative_histogram.get();
|
| base::HistogramBase* histogram =
|
| - base::StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
|
| + base::StatisticsRecorder::RegisterOrDeleteDuplicate(
|
| + std::move(tentative_histogram));
|
|
|
| - DCHECK_EQ(histogram, tentative_histogram);
|
| + DCHECK_EQ(histogram, allocated_histogram);
|
| DCHECK_EQ(base::HISTOGRAM, histogram->GetHistogramType());
|
| DCHECK(histogram->HasConstructionArguments(minimum, maximum, bucket_count));
|
| }
|
|
|