| Index: base/metrics/statistics_recorder.cc
|
| diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
|
| index 7efe16b10c15596f968a4fcced8ad4ae4d7d9ee4..65a9b18b9b62bc39c9c8b626e6d3df758f386271 100644
|
| --- a/base/metrics/statistics_recorder.cc
|
| +++ b/base/metrics/statistics_recorder.cc
|
| @@ -393,24 +393,24 @@ StatisticsRecorder::StatisticsRecorder() {
|
|
|
| // static
|
| void StatisticsRecorder::ResetForTesting() {
|
| - if (histograms_) {
|
| - STLDeleteValues(histograms_);
|
| - delete histograms_;
|
| - histograms_= nullptr;
|
| - }
|
| - if (ranges_) {
|
| - for (auto& iter : *ranges_) {
|
| - STLDeleteElements(iter.second);
|
| - delete iter.second;
|
| - }
|
| - delete ranges_;
|
| - ranges_ = nullptr;
|
| - }
|
| + // This leaks a lot of objects but they've already been annotated for such.
|
| + // Deleting them isn't possible because there could be other pointers to
|
| + // them somewhere.
|
| + delete histograms_;
|
| + histograms_= nullptr;
|
| + delete ranges_;
|
| + ranges_ = nullptr;
|
| delete callbacks_;
|
| callbacks_ = nullptr;
|
| }
|
|
|
| // static
|
| +void StatisticsRecorder::ForgetHistogramForTesting(const std::string& name) {
|
| + if (histograms_)
|
| + histograms_->erase(HashMetricName(name));
|
| +}
|
| +
|
| +// static
|
| void StatisticsRecorder::DumpHistogramsToVlog(void* instance) {
|
| std::string output;
|
| StatisticsRecorder::WriteGraph(std::string(), &output);
|
|
|