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 "platform/graphics/BitmapImageMetrics.h" | 5 #include "platform/graphics/BitmapImageMetrics.h" |
6 | 6 |
7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
8 #include "wtf/Threading.h" | 8 #include "wtf/Threading.h" |
9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 void BitmapImageMetrics::countImageOrientation( | 36 void BitmapImageMetrics::countImageOrientation( |
37 const ImageOrientationEnum orientation) { | 37 const ImageOrientationEnum orientation) { |
38 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 38 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
39 EnumerationHistogram, orientationHistogram, | 39 EnumerationHistogram, orientationHistogram, |
40 new EnumerationHistogram("Blink.DecodedImage.Orientation", | 40 new EnumerationHistogram("Blink.DecodedImage.Orientation", |
41 ImageOrientationEnumEnd)); | 41 ImageOrientationEnumEnd)); |
42 orientationHistogram.count(orientation); | 42 orientationHistogram.count(orientation); |
43 } | 43 } |
44 | 44 |
45 void BitmapImageMetrics::countGamma(SkColorSpace* colorSpace) { | 45 void BitmapImageMetrics::countImageGamma(SkColorSpace* colorSpace) { |
| 46 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 47 EnumerationHistogram, gammaNamedHistogram, |
| 48 new EnumerationHistogram("Blink.ColorSpace.Source", GammaEnd)); |
| 49 gammaNamedHistogram.count(getColorSpaceGamma(colorSpace)); |
| 50 } |
| 51 |
| 52 void BitmapImageMetrics::countOutputGamma(SkColorSpace* colorSpace) { |
46 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 53 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
47 EnumerationHistogram, gammaNamedHistogram, | 54 EnumerationHistogram, gammaNamedHistogram, |
48 new EnumerationHistogram("Blink.ColorSpace.Destination", GammaEnd)); | 55 new EnumerationHistogram("Blink.ColorSpace.Destination", GammaEnd)); |
| 56 gammaNamedHistogram.count(getColorSpaceGamma(colorSpace)); |
| 57 } |
49 | 58 |
| 59 BitmapImageMetrics::Gamma BitmapImageMetrics::getColorSpaceGamma( |
| 60 SkColorSpace* colorSpace) { |
| 61 Gamma gamma = GammaNull; |
50 if (colorSpace) { | 62 if (colorSpace) { |
51 Gamma gamma; | |
52 if (colorSpace->gammaCloseToSRGB()) { | 63 if (colorSpace->gammaCloseToSRGB()) { |
53 gamma = GammaSRGB; | 64 gamma = GammaSRGB; |
54 } else if (colorSpace->gammaIsLinear()) { | 65 } else if (colorSpace->gammaIsLinear()) { |
55 gamma = GammaLinear; | 66 gamma = GammaLinear; |
56 } else { | 67 } else { |
57 gamma = GammaNonStandard; | 68 gamma = GammaNonStandard; |
58 } | 69 } |
59 | |
60 gammaNamedHistogram.count(gamma); | |
61 } else { | |
62 gammaNamedHistogram.count(GammaNull); | |
63 } | 70 } |
| 71 return gamma; |
64 } | 72 } |
65 | 73 |
66 } // namespace blink | 74 } // namespace blink |
OLD | NEW |