diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 04:01:56 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 04:01:56 +0000 |
commit | afbb80036f3f52f8f1d94ebf7f05df47172f734f (patch) | |
tree | 7a7e23f224e115dbfc64a04cbea1a4d45aeb4a28 /net | |
parent | b151ba78727d81aac36a66b8ce4f984cb78a611e (diff) | |
download | chromium_src-afbb80036f3f52f8f1d94ebf7f05df47172f734f.zip chromium_src-afbb80036f3f52f8f1d94ebf7f05df47172f734f.tar.gz chromium_src-afbb80036f3f52f8f1d94ebf7f05df47172f734f.tar.bz2 |
Removed static variable for histograms to avoid race with
histogram initialization across threads.
BUG=76092
TEST=histogram unit tests. Sync tests
R=jar
Review URL: http://codereview.chromium.org/6712040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/mime_sniffer.cc | 16 | ||||
-rw-r--r-- | net/disk_cache/histogram_macros.h | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc index bd16462f..25b94ec 100644 --- a/net/base/mime_sniffer.cc +++ b/net/base/mime_sniffer.cc @@ -308,7 +308,7 @@ static bool SniffForHTML(const char* content, if (!IsAsciiWhitespace(*pos)) break; } - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTags2", arraysize(kSniffableTags)); // |pos| now points to first non-whitespace character (or at end). @@ -326,7 +326,7 @@ static bool SniffForMagicNumbers(const char* content, *have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size); // Check our big table of Magic Numbers - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicNumbers2", arraysize(kMagicNumbers)); return CheckForMagicNumbers(content, size, @@ -367,7 +367,7 @@ static bool SniffXML(const char* content, // We want to skip XML processing instructions (of the form "<?xml ...") // and stop at the first "plain" tag, then make a decision on the mime-type // based on the name (or possibly attributes) of that tag. - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicXML2", arraysize(kMagicXML)); const int kMaxTagIterations = 5; @@ -451,7 +451,7 @@ static bool SniffBinary(const char* content, const bool is_truncated = TruncateSize(kMaxBytesToSniff, &size); // First, we look for a BOM. - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kByteOrderMark2", arraysize(kByteOrderMark)); std::string unused; @@ -493,7 +493,7 @@ static bool IsUnknownMimeType(const std::string& mime_type) { // Firefox rejects a mime type if it is exactly */* "*/*", }; - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kUnknownMimeTypes2", arraysize(kUnknownMimeTypes) + 1); for (size_t i = 0; i < arraysize(kUnknownMimeTypes); ++i) { @@ -519,7 +519,7 @@ static bool SniffCRX(const char* content, const std::string& type_hint, bool* have_enough_content, std::string* result) { - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffCRX", 3); // Technically, the crx magic number is just Cr24, but the bytes after that @@ -557,7 +557,7 @@ static bool SniffCRX(const char* content, } bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { - static scoped_refptr<base::Histogram> should_sniff_counter = + scoped_refptr<base::Histogram> should_sniff_counter = UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3); // We are willing to sniff the mime type for HTTP, HTTPS, and FTP bool sniffable_scheme = url.is_empty() || @@ -582,7 +582,7 @@ bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { "text/xml", "application/xml", }; - static scoped_refptr<base::Histogram> counter = + scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTypes2", arraysize(kSniffableTypes) + 1); for (size_t i = 0; i < arraysize(kSniffableTypes); ++i) { diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h index 044302c..e238599 100644 --- a/net/disk_cache/histogram_macros.h +++ b/net/disk_cache/histogram_macros.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ #define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<base::Histogram> counter; \ + scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ counter = base::Histogram::FactoryGet( \ name, min, max, bucket_count, \ @@ -39,7 +39,7 @@ #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<base::Histogram> counter; \ + scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ counter = base::Histogram::FactoryTimeGet( \ name, min, max, bucket_count, \ @@ -52,7 +52,7 @@ base::TimeDelta::FromSeconds(10), 50) #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ - static scoped_refptr<base::Histogram> counter; \ + scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ counter = base::LinearHistogram::FactoryGet( \ name, 1, boundary_value, boundary_value + 1, \ |