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

Side by Side Diff: ui/gl/angle_platform_impl.cc

Issue 2973863002: Remove std::string histogram name from HistogramBase object.
Patch Set: never rely on outside string permanence Created 3 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/gl/angle_platform_impl.h" 5 #include "ui/gl/angle_platform_impl.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "third_party/angle/include/platform/Platform.h" 10 #include "third_party/angle/include/platform/Platform.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const char* name, 81 const char* name,
82 int sample, 82 int sample,
83 int min, 83 int min,
84 int max, 84 int max,
85 int bucket_count) { 85 int bucket_count) {
86 // Copied from histogram macro, but without the static variable caching 86 // Copied from histogram macro, but without the static variable caching
87 // the histogram because name is dynamic. 87 // the histogram because name is dynamic.
88 base::HistogramBase* counter = base::Histogram::FactoryGet( 88 base::HistogramBase* counter = base::Histogram::FactoryGet(
89 name, min, max, bucket_count, 89 name, min, max, bucket_count,
90 base::HistogramBase::kUmaTargetedHistogramFlag); 90 base::HistogramBase::kUmaTargetedHistogramFlag);
91 DCHECK_EQ(name, counter->histogram_name());
92 counter->Add(sample); 91 counter->Add(sample);
93 } 92 }
94 93
95 void ANGLEPlatformImpl_histogramEnumeration(angle::PlatformMethods* platform, 94 void ANGLEPlatformImpl_histogramEnumeration(angle::PlatformMethods* platform,
96 const char* name, 95 const char* name,
97 int sample, 96 int sample,
98 int boundary_value) { 97 int boundary_value) {
99 // Copied from histogram macro, but without the static variable caching 98 // Copied from histogram macro, but without the static variable caching
100 // the histogram because name is dynamic. 99 // the histogram because name is dynamic.
101 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( 100 base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
102 name, 1, boundary_value, boundary_value + 1, 101 name, 1, boundary_value, boundary_value + 1,
103 base::HistogramBase::kUmaTargetedHistogramFlag); 102 base::HistogramBase::kUmaTargetedHistogramFlag);
104 DCHECK_EQ(name, counter->histogram_name());
105 counter->Add(sample); 103 counter->Add(sample);
106 } 104 }
107 105
108 void ANGLEPlatformImpl_histogramSparse(angle::PlatformMethods* platform, 106 void ANGLEPlatformImpl_histogramSparse(angle::PlatformMethods* platform,
109 const char* name, 107 const char* name,
110 int sample) { 108 int sample) {
111 // For sparse histograms, we can use the macro, as it does not incorporate a 109 // For sparse histograms, we can use the macro, as it does not incorporate a
112 // static. 110 // static.
113 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); 111 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
114 } 112 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return true; 156 return true;
159 } 157 }
160 158
161 void ResetANGLEPlatform(EGLDisplay display) { 159 void ResetANGLEPlatform(EGLDisplay display) {
162 if (!g_angle_reset_platform) 160 if (!g_angle_reset_platform)
163 return; 161 return;
164 g_angle_reset_platform(static_cast<angle::EGLDisplayType>(display)); 162 g_angle_reset_platform(static_cast<angle::EGLDisplayType>(display));
165 } 163 }
166 164
167 } // namespace gl 165 } // namespace gl
OLDNEW
« base/metrics/histogram_base.cc ('K') | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698