Fix WindowAndroid leak in Android WebView
[chromium-blink-merge.git] / ui / gl / angle_platform_impl.cc
blob2ce12b823afb36bb1a3f3cb46f7e3e4c7699822f
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
3 // found in the LICENSE file.
5 #include "ui/gl/angle_platform_impl.h"
7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h"
10 namespace gfx {
12 ANGLEPlatformImpl::ANGLEPlatformImpl() {
15 ANGLEPlatformImpl::~ANGLEPlatformImpl() {
18 void ANGLEPlatformImpl::histogramCustomCounts(const char* name,
19 int sample,
20 int min,
21 int max,
22 int bucket_count) {
23 // Copied from histogram macro, but without the static variable caching
24 // the histogram because name is dynamic.
25 base::HistogramBase* counter = base::Histogram::FactoryGet(
26 name, min, max, bucket_count,
27 base::HistogramBase::kUmaTargetedHistogramFlag);
28 DCHECK_EQ(name, counter->histogram_name());
29 counter->Add(sample);
32 void ANGLEPlatformImpl::histogramEnumeration(const char* name,
33 int sample,
34 int boundary_value) {
35 // Copied from histogram macro, but without the static variable caching
36 // the histogram because name is dynamic.
37 base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
38 name, 1, boundary_value, boundary_value + 1,
39 base::HistogramBase::kUmaTargetedHistogramFlag);
40 DCHECK_EQ(name, counter->histogram_name());
41 counter->Add(sample);
44 void ANGLEPlatformImpl::histogramSparse(const char* name, int sample) {
45 // For sparse histograms, we can use the macro, as it does not incorporate a
46 // static.
47 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
50 } // namespace gfx