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

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

Issue 462027: Use factory to create histograms, and refcounts to track lifetimes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/buffered_resource_handler.h" 5 #include "chrome/browser/renderer_host/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "net/http/http_response_headers.h" 23 #include "net/http/http_response_headers.h"
24 #include "webkit/glue/plugins/plugin_list.h" 24 #include "webkit/glue/plugins/plugin_list.h"
25 25
26 namespace { 26 namespace {
27 27
28 const int kMaxBytesToSniff = 512; 28 const int kMaxBytesToSniff = 512;
29 29
30 void RecordSnifferMetrics(bool sniffing_blocked, 30 void RecordSnifferMetrics(bool sniffing_blocked,
31 bool we_would_like_to_sniff, 31 bool we_would_like_to_sniff,
32 const std::string& mime_type) { 32 const std::string& mime_type) {
33 static BooleanHistogram nosniff_usage("nosniff.usage"); 33 static scoped_refptr<Histogram> nosniff_usage =
34 nosniff_usage.SetFlags(kUmaTargetedHistogramFlag); 34 BooleanHistogram::BooleanHistogramFactoryGet("nosniff.usage");
35 nosniff_usage.AddBoolean(sniffing_blocked); 35 nosniff_usage->SetFlags(kUmaTargetedHistogramFlag);
36 nosniff_usage->AddBoolean(sniffing_blocked);
36 37
37 if (sniffing_blocked) { 38 if (sniffing_blocked) {
38 static BooleanHistogram nosniff_otherwise("nosniff.otherwise"); 39 static scoped_refptr<Histogram> nosniff_otherwise =
39 nosniff_otherwise.SetFlags(kUmaTargetedHistogramFlag); 40 BooleanHistogram::BooleanHistogramFactoryGet(
40 nosniff_otherwise.AddBoolean(we_would_like_to_sniff); 41 "nosniff.otherwise");
42 nosniff_otherwise->SetFlags(kUmaTargetedHistogramFlag);
43 nosniff_otherwise->AddBoolean(we_would_like_to_sniff);
41 44
42 static BooleanHistogram nosniff_empty_mime_type("nosniff.empty_mime_type"); 45 static scoped_refptr<Histogram> nosniff_empty_mime_type =
43 nosniff_empty_mime_type.SetFlags(kUmaTargetedHistogramFlag); 46 BooleanHistogram::BooleanHistogramFactoryGet(
44 nosniff_empty_mime_type.AddBoolean(mime_type.empty()); 47 "nosniff.empty_mime_type");
48 nosniff_empty_mime_type->SetFlags(kUmaTargetedHistogramFlag);
49 nosniff_empty_mime_type->AddBoolean(mime_type.empty());
45 } 50 }
46 } 51 }
47 52
48 } // namespace 53 } // namespace
49 54
50 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, 55 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler,
51 ResourceDispatcherHost* host, 56 ResourceDispatcherHost* host,
52 URLRequest* request) 57 URLRequest* request)
53 : real_handler_(handler), 58 : real_handler_(handler),
54 host_(host), 59 host_(host),
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 wait_for_plugins_ = false; 484 wait_for_plugins_ = false;
480 if (!request_) 485 if (!request_)
481 return; 486 return;
482 487
483 ResourceDispatcherHostRequestInfo* info = 488 ResourceDispatcherHostRequestInfo* info =
484 ResourceDispatcherHost::InfoForRequest(request_); 489 ResourceDispatcherHost::InfoForRequest(request_);
485 host_->PauseRequest(info->child_id(), info->request_id(), false); 490 host_->PauseRequest(info->child_id(), info->request_id(), false);
486 if (!CompleteResponseStarted(info->request_id(), false)) 491 if (!CompleteResponseStarted(info->request_id(), false))
487 host_->CancelRequest(info->child_id(), info->request_id(), false); 492 host_->CancelRequest(info->child_id(), info->request_id(), false);
488 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698