| OLD | NEW |
| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const char* name, | 91 const char* name, |
| 92 int sample, | 92 int sample, |
| 93 int min, | 93 int min, |
| 94 int max, | 94 int max, |
| 95 int bucket_count) { | 95 int bucket_count) { |
| 96 // Copied from histogram macro, but without the static variable caching | 96 // Copied from histogram macro, but without the static variable caching |
| 97 // the histogram because name is dynamic. | 97 // the histogram because name is dynamic. |
| 98 base::HistogramBase* counter = base::Histogram::FactoryGet( | 98 base::HistogramBase* counter = base::Histogram::FactoryGet( |
| 99 name, min, max, bucket_count, | 99 name, min, max, bucket_count, |
| 100 base::HistogramBase::kUmaTargetedHistogramFlag); | 100 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 101 DCHECK_EQ(name, counter->histogram_name()); | |
| 102 counter->Add(sample); | 101 counter->Add(sample); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void ANGLEPlatformImpl_histogramEnumeration(PlatformMethods* platform, | 104 void ANGLEPlatformImpl_histogramEnumeration(PlatformMethods* platform, |
| 106 const char* name, | 105 const char* name, |
| 107 int sample, | 106 int sample, |
| 108 int boundary_value) { | 107 int boundary_value) { |
| 109 // Copied from histogram macro, but without the static variable caching | 108 // Copied from histogram macro, but without the static variable caching |
| 110 // the histogram because name is dynamic. | 109 // the histogram because name is dynamic. |
| 111 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( | 110 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( |
| 112 name, 1, boundary_value, boundary_value + 1, | 111 name, 1, boundary_value, boundary_value + 1, |
| 113 base::HistogramBase::kUmaTargetedHistogramFlag); | 112 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 114 DCHECK_EQ(name, counter->histogram_name()); | |
| 115 counter->Add(sample); | 113 counter->Add(sample); |
| 116 } | 114 } |
| 117 | 115 |
| 118 void ANGLEPlatformImpl_histogramSparse(PlatformMethods* platform, | 116 void ANGLEPlatformImpl_histogramSparse(PlatformMethods* platform, |
| 119 const char* name, | 117 const char* name, |
| 120 int sample) { | 118 int sample) { |
| 121 // For sparse histograms, we can use the macro, as it does not incorporate a | 119 // For sparse histograms, we can use the macro, as it does not incorporate a |
| 122 // static. | 120 // static. |
| 123 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | 121 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); |
| 124 } | 122 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 195 |
| 198 void SetCacheProgramCallback(CacheProgramCallback callback) { | 196 void SetCacheProgramCallback(CacheProgramCallback callback) { |
| 199 g_platform_context.Get().cache_program_callback = callback; | 197 g_platform_context.Get().cache_program_callback = callback; |
| 200 } | 198 } |
| 201 | 199 |
| 202 void ResetCacheProgramCallback() { | 200 void ResetCacheProgramCallback() { |
| 203 g_platform_context.Get().cache_program_callback.Reset(); | 201 g_platform_context.Get().cache_program_callback.Reset(); |
| 204 } | 202 } |
| 205 | 203 |
| 206 } // namespace angle | 204 } // namespace angle |
| OLD | NEW |