diff options
author | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 08:11:40 +0000 |
---|---|---|
committer | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 08:11:40 +0000 |
commit | 69b5cc1cd49d108cdb7ced431f8caf56e8d3bd43 (patch) | |
tree | 5e23089143869af08c57c928ea4288013c21b58c /base/metrics | |
parent | abe7c1dc8ceb77e57c9d782d6eab8b0276173bf9 (diff) | |
download | chromium_src-69b5cc1cd49d108cdb7ced431f8caf56e8d3bd43.zip chromium_src-69b5cc1cd49d108cdb7ced431f8caf56e8d3bd43.tar.gz chromium_src-69b5cc1cd49d108cdb7ced431f8caf56e8d3bd43.tar.bz2 |
Fix http://codereview.chromium.org/6869009 to ignore an existing object exactly once and land the CL again:
Introduce the ANNOTATE_LEAKING_OBJECT_PTR annotation that can be used to mark
heap allocated objects as intentionally leaked ones.
Annotate the histograms produced by {Histogram,BooleanHistogram,LinearHistogram,CustomHistogram}::FactoryGet(), as leaked.
Rename StatsHistogram::StatsHistogramFactoryGet to StatsHistogram::FactoryGet, annotate the result as leaky, update the suppressions.
BUG=79322
TBR=jar
Review URL: http://codereview.chromium.org/6976044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/metrics')
-rw-r--r-- | base/metrics/histogram.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 63e5ae6..5b6c59e 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc @@ -14,6 +14,7 @@ #include <algorithm> #include <string> +#include "base/debug/leak_annotations.h" #include "base/logging.h" #include "base/pickle.h" #include "base/stringprintf.h" @@ -97,6 +98,8 @@ Histogram* Histogram::FactoryGet(const std::string& name, tentative_histogram->SetFlags(flags); histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); + if (histogram == tentative_histogram) + ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322 } DCHECK_EQ(HISTOGRAM, histogram->histogram_type()); @@ -791,6 +794,8 @@ Histogram* LinearHistogram::FactoryGet(const std::string& name, tentative_histogram->SetFlags(flags); histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); + if (histogram == tentative_histogram) + ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322 } DCHECK_EQ(LINEAR_HISTOGRAM, histogram->histogram_type()); @@ -882,6 +887,8 @@ Histogram* BooleanHistogram::FactoryGet(const std::string& name, Flags flags) { tentative_histogram->SetFlags(flags); histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); + if (histogram == tentative_histogram) + ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322 } DCHECK_EQ(BOOLEAN_HISTOGRAM, histogram->histogram_type()); @@ -929,6 +936,8 @@ Histogram* CustomHistogram::FactoryGet(const std::string& name, tentative_histogram->SetFlags(flags); histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); + if (histogram == tentative_histogram) + ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322 } DCHECK_EQ(histogram->histogram_type(), CUSTOM_HISTOGRAM); |