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

Side by Side Diff: third_party/webrtc_overrides/init_webrtc.cc

Issue 2545703002: WebRTC overrides: Add linear histogram type w/ bucket count parameter (Closed)
Patch Set: Rename to HistogramFactoryGetCountsLinear Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "init_webrtc.h" 5 #include "init_webrtc.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // between the Histogram functions in this file. 44 // between the Histogram functions in this file.
45 class Histogram; 45 class Histogram;
46 46
47 Histogram* HistogramFactoryGetCounts( 47 Histogram* HistogramFactoryGetCounts(
48 const std::string& name, int min, int max, int bucket_count) { 48 const std::string& name, int min, int max, int bucket_count) {
49 return reinterpret_cast<Histogram*>( 49 return reinterpret_cast<Histogram*>(
50 base::Histogram::FactoryGet(name, min, max, bucket_count, 50 base::Histogram::FactoryGet(name, min, max, bucket_count,
51 base::HistogramBase::kUmaTargetedHistogramFlag)); 51 base::HistogramBase::kUmaTargetedHistogramFlag));
52 } 52 }
53 53
54 Histogram* HistogramFactoryGetCountsLinear(
55 const std::string& name, int min, int max, int bucket_count) {
56 return reinterpret_cast<Histogram*>(
57 base::LinearHistogram::FactoryGet(name, min, max, bucket_count,
58 base::HistogramBase::kUmaTargetedHistogramFlag));
59 }
60
54 Histogram* HistogramFactoryGetEnumeration( 61 Histogram* HistogramFactoryGetEnumeration(
55 const std::string& name, int boundary) { 62 const std::string& name, int boundary) {
56 return reinterpret_cast<Histogram*>( 63 return reinterpret_cast<Histogram*>(
57 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, 64 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1,
58 base::HistogramBase::kUmaTargetedHistogramFlag)); 65 base::HistogramBase::kUmaTargetedHistogramFlag));
59 } 66 }
60 67
61 const std::string& GetHistogramName(Histogram* histogram_pointer) { 68 const std::string& GetHistogramName(Histogram* histogram_pointer) {
62 base::HistogramBase* ptr = 69 base::HistogramBase* ptr =
63 reinterpret_cast<base::HistogramBase*>(histogram_pointer); 70 reinterpret_cast<base::HistogramBase*>(histogram_pointer);
64 return ptr->histogram_name(); 71 return ptr->histogram_name();
65 } 72 }
66 73
67 void HistogramAdd(Histogram* histogram_pointer, int sample) { 74 void HistogramAdd(Histogram* histogram_pointer, int sample) {
68 base::HistogramBase* ptr = 75 base::HistogramBase* ptr =
69 reinterpret_cast<base::HistogramBase*>(histogram_pointer); 76 reinterpret_cast<base::HistogramBase*>(histogram_pointer);
70 ptr->Add(sample); 77 ptr->Add(sample);
71 } 78 }
72 } // namespace metrics 79 } // namespace metrics
73 } // namespace webrtc 80 } // namespace webrtc
74 81
75 bool InitializeWebRtcModule() { 82 bool InitializeWebRtcModule() {
76 // Workaround for crbug.com/176522 83 // Workaround for crbug.com/176522
77 // On Linux, we can't fetch the number of cores after the sandbox has been 84 // On Linux, we can't fetch the number of cores after the sandbox has been
78 // initialized, so we call DetectNumberOfCores() here, to cache the value. 85 // initialized, so we call DetectNumberOfCores() here, to cache the value.
79 webrtc::CpuInfo::DetectNumberOfCores(); 86 webrtc::CpuInfo::DetectNumberOfCores();
80 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); 87 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent);
81 return true; 88 return true;
82 } 89 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698