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

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

Issue 2337913002: Add functions needed by the new WebRTC histogram API. (Closed)
Patch Set: Created 4 years, 3 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
« 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 base::HistogramBase::kUmaTargetedHistogramFlag)); 51 base::HistogramBase::kUmaTargetedHistogramFlag));
52 } 52 }
53 53
54 Histogram* HistogramFactoryGetEnumeration( 54 Histogram* HistogramFactoryGetEnumeration(
55 const std::string& name, int boundary) { 55 const std::string& name, int boundary) {
56 return reinterpret_cast<Histogram*>( 56 return reinterpret_cast<Histogram*>(
57 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, 57 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1,
58 base::HistogramBase::kUmaTargetedHistogramFlag)); 58 base::HistogramBase::kUmaTargetedHistogramFlag));
59 } 59 }
60 60
61 const std::string& GetHistogramName(Histogram* histogram_pointer) {
62 base::HistogramBase* ptr =
63 reinterpret_cast<base::HistogramBase*>(histogram_pointer);
64 return ptr->histogram_name();
65 }
66
67 void HistogramAdd(Histogram* histogram_pointer, int sample) {
68 base::HistogramBase* ptr =
69 reinterpret_cast<base::HistogramBase*>(histogram_pointer);
70 ptr->Add(sample);
71 }
72
61 void HistogramAdd( 73 void HistogramAdd(
62 Histogram* histogram_pointer, const std::string& name, int sample) { 74 Histogram* histogram_pointer, const std::string& name, int sample) {
63 base::HistogramBase* ptr = 75 base::HistogramBase* ptr =
64 reinterpret_cast<base::HistogramBase*>(histogram_pointer); 76 reinterpret_cast<base::HistogramBase*>(histogram_pointer);
65 // The name should not vary. 77 // The name should not vary.
66 DCHECK(ptr->histogram_name() == name); 78 DCHECK(ptr->histogram_name() == name);
67 ptr->Add(sample); 79 ptr->Add(sample);
68 } 80 }
69 } // namespace metrics 81 } // namespace metrics
70 } // namespace webrtc 82 } // namespace webrtc
71 83
72 bool InitializeWebRtcModule() { 84 bool InitializeWebRtcModule() {
73 // Workaround for crbug.com/176522 85 // Workaround for crbug.com/176522
74 // On Linux, we can't fetch the number of cores after the sandbox has been 86 // On Linux, we can't fetch the number of cores after the sandbox has been
75 // initialized, so we call DetectNumberOfCores() here, to cache the value. 87 // initialized, so we call DetectNumberOfCores() here, to cache the value.
76 webrtc::CpuInfo::DetectNumberOfCores(); 88 webrtc::CpuInfo::DetectNumberOfCores();
77 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); 89 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent);
78 return true; 90 return true;
79 } 91 }
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