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/base/mime_sniffer.cc | |
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/base/mime_sniffer.cc')
-rw-r--r-- | net/base/mime_sniffer.cc | 16 |
1 files changed, 8 insertions, 8 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) { |