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

Side by Side Diff: content/browser/renderer_host/buffered_resource_handler.cc

Issue 6825056: Merge 78809 - Removed static variable for histograms to avoid race withhistogram initialization a... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/696/src/
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/url_info.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/buffered_resource_handler.h" 5 #include "content/browser/renderer_host/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 11 matching lines...) Expand all
22 #include "net/base/mime_util.h" 22 #include "net/base/mime_util.h"
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/http/http_response_headers.h" 24 #include "net/http/http_response_headers.h"
25 #include "webkit/plugins/npapi/plugin_list.h" 25 #include "webkit/plugins/npapi/plugin_list.h"
26 26
27 namespace { 27 namespace {
28 28
29 void RecordSnifferMetrics(bool sniffing_blocked, 29 void RecordSnifferMetrics(bool sniffing_blocked,
30 bool we_would_like_to_sniff, 30 bool we_would_like_to_sniff,
31 const std::string& mime_type) { 31 const std::string& mime_type) {
32 static scoped_refptr<base::Histogram> nosniff_usage = 32 scoped_refptr<base::Histogram> nosniff_usage =
33 base::BooleanHistogram::FactoryGet( 33 base::BooleanHistogram::FactoryGet(
34 "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag); 34 "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag);
35 nosniff_usage->AddBoolean(sniffing_blocked); 35 nosniff_usage->AddBoolean(sniffing_blocked);
36 36
37 if (sniffing_blocked) { 37 if (sniffing_blocked) {
38 static scoped_refptr<base::Histogram> nosniff_otherwise = 38 scoped_refptr<base::Histogram> nosniff_otherwise =
39 base::BooleanHistogram::FactoryGet( 39 base::BooleanHistogram::FactoryGet(
40 "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag); 40 "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag);
41 nosniff_otherwise->AddBoolean(we_would_like_to_sniff); 41 nosniff_otherwise->AddBoolean(we_would_like_to_sniff);
42 42
43 static scoped_refptr<base::Histogram> nosniff_empty_mime_type = 43 scoped_refptr<base::Histogram> nosniff_empty_mime_type =
44 base::BooleanHistogram::FactoryGet( 44 base::BooleanHistogram::FactoryGet(
45 "nosniff.empty_mime_type", 45 "nosniff.empty_mime_type",
46 base::Histogram::kUmaTargetedHistogramFlag); 46 base::Histogram::kUmaTargetedHistogramFlag);
47 nosniff_empty_mime_type->AddBoolean(mime_type.empty()); 47 nosniff_empty_mime_type->AddBoolean(mime_type.empty());
48 } 48 }
49 } 49 }
50 50
51 } // namespace 51 } // namespace
52 52
53 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, 53 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 wait_for_plugins_ = false; 482 wait_for_plugins_ = false;
483 if (!request_) 483 if (!request_)
484 return; 484 return;
485 485
486 ResourceDispatcherHostRequestInfo* info = 486 ResourceDispatcherHostRequestInfo* info =
487 ResourceDispatcherHost::InfoForRequest(request_); 487 ResourceDispatcherHost::InfoForRequest(request_);
488 host_->PauseRequest(info->child_id(), info->request_id(), false); 488 host_->PauseRequest(info->child_id(), info->request_id(), false);
489 if (!CompleteResponseStarted(info->request_id(), false)) 489 if (!CompleteResponseStarted(info->request_id(), false))
490 host_->CancelRequest(info->child_id(), info->request_id(), false); 490 host_->CancelRequest(info->child_id(), info->request_id(), false);
491 } 491 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_info.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698