From e8829a1981a2d9d849c377c28f9444fdefee0f44 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Sun, 6 Dec 2009 00:09:37 +0000 Subject: Use factory to create histograms, and refcounts to track lifetimes This is CL patch 377028 by Raman Tenneti, with minor changes to make the try-bots happier. It is cleanup that better ensures lifetimes of histograms (making it harder for users to abuse them). bug=16495 (repairs leak induced by the first landing) bug=18840 (should make leaks less possible) tbr=raman.tenneti Review URL: http://codereview.chromium.org/462027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33933 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/diagnostics/sqlite_diagnostics.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'chrome/browser/diagnostics') diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index f3ca31d..b266002 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc @@ -43,9 +43,11 @@ class BasicSqliteErrrorHandler : public sql::ErrorDelegate { static void RecordErrorInHistogram(int error) { // The histogram values from sqlite result codes go currently from 1 to // 26 currently but 50 gives them room to grow. - static LinearHistogram histogram(kHistogramNames[unique], 1, 50, 51); - histogram.SetFlags(kUmaTargetedHistogramFlag); - histogram.Add(error); + static scoped_refptr histogram = + LinearHistogram::LinearHistogramFactoryGet(kHistogramNames[unique], 1, + 50, 51); + histogram->SetFlags(kUmaTargetedHistogramFlag); + histogram->Add(error); } }; -- cgit v1.1