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

Unified Diff: content/browser/renderer_host/buffered_resource_handler.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
« no previous file with comments | « chrome/renderer/renderer_main.cc ('k') | net/base/connection_type_histograms.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/buffered_resource_handler.cc
===================================================================
--- content/browser/renderer_host/buffered_resource_handler.cc (revision 80382)
+++ content/browser/renderer_host/buffered_resource_handler.cc (working copy)
@@ -29,21 +29,24 @@
void RecordSnifferMetrics(bool sniffing_blocked,
bool we_would_like_to_sniff,
const std::string& mime_type) {
- scoped_refptr<base::Histogram> nosniff_usage =
- base::BooleanHistogram::FactoryGet(
- "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag);
+ static base::Histogram* nosniff_usage(NULL);
+ if (!nosniff_usage)
+ nosniff_usage = base::BooleanHistogram::FactoryGet(
+ "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag);
nosniff_usage->AddBoolean(sniffing_blocked);
if (sniffing_blocked) {
- scoped_refptr<base::Histogram> nosniff_otherwise =
- base::BooleanHistogram::FactoryGet(
- "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag);
+ static base::Histogram* nosniff_otherwise(NULL);
+ if (!nosniff_otherwise)
+ nosniff_otherwise = base::BooleanHistogram::FactoryGet(
+ "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag);
nosniff_otherwise->AddBoolean(we_would_like_to_sniff);
- scoped_refptr<base::Histogram> nosniff_empty_mime_type =
- base::BooleanHistogram::FactoryGet(
- "nosniff.empty_mime_type",
- base::Histogram::kUmaTargetedHistogramFlag);
+ static base::Histogram* nosniff_empty_mime_type(NULL);
+ if (!nosniff_empty_mime_type)
+ nosniff_empty_mime_type = base::BooleanHistogram::FactoryGet(
+ "nosniff.empty_mime_type",
+ base::Histogram::kUmaTargetedHistogramFlag);
nosniff_empty_mime_type->AddBoolean(mime_type.empty());
}
}
« no previous file with comments | « chrome/renderer/renderer_main.cc ('k') | net/base/connection_type_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698