From 81ce9f3b1eb34dc7f6954f0f6657a76b0f01fc12 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Tue, 5 Apr 2011 04:48:53 +0000 Subject: Use lock-free lazy initialization for static histogram references Make all histogram macros thread safe, and fast by again using statics to achieve performance. ...at the cost of: Leak all histograms to avoid races at shutdown. Also included leak suppression for valgrind. r=rtenneti BUG=78207 Review URL: http://codereview.chromium.org/6780035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80412 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webkitclient_impl.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'webkit/glue') diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index 4fc05e6..4e2b10a 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -264,24 +264,22 @@ void WebKitClientImpl::histogramCustomCounts( const char* name, int sample, int min, int max, int bucket_count) { // Copied from histogram macro, but without the static variable caching // the histogram because name is dynamic. - scoped_refptr counter = + base::Histogram* counter = base::Histogram::FactoryGet(name, min, max, bucket_count, base::Histogram::kUmaTargetedHistogramFlag); DCHECK_EQ(name, counter->histogram_name()); - if (counter.get()) - counter->Add(sample); + counter->Add(sample); } void WebKitClientImpl::histogramEnumeration( const char* name, int sample, int boundary_value) { // Copied from histogram macro, but without the static variable caching // the histogram because name is dynamic. - scoped_refptr counter = + base::Histogram* counter = base::LinearHistogram::FactoryGet(name, 1, boundary_value, boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); DCHECK_EQ(name, counter->histogram_name()); - if (counter.get()) - counter->Add(sample); + counter->Add(sample); } void WebKitClientImpl::traceEventBegin(const char* name, void* id, -- cgit v1.1