Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1048)

Unified Diff: chrome/browser/net/url_info.cc

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/url_info.cc
===================================================================
--- chrome/browser/net/url_info.cc (revision 80382)
+++ chrome/browser/net/url_info.cc (working copy)
@@ -120,10 +120,11 @@
}
// Make a custom linear histogram for the region from 0 to boundary.
const size_t kBucketCount = 52;
- scoped_refptr<base::Histogram> histogram =
- base::LinearHistogram::FactoryTimeGet(
- "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount,
- base::Histogram::kUmaTargetedHistogramFlag);
+ static base::Histogram* histogram(NULL);
+ if (!histogram)
+ histogram = base::LinearHistogram::FactoryTimeGet(
+ "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount,
+ base::Histogram::kUmaTargetedHistogramFlag);
histogram->AddTime(queue_duration_);
}
« no previous file with comments | « chrome/browser/metrics/thread_watcher.cc ('k') | chrome/browser/net/websocket_experiment/websocket_experiment_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698