Index: Source/platform/image-decoders/ImageDecoder.h |
diff --git a/Source/platform/image-decoders/ImageDecoder.h b/Source/platform/image-decoders/ImageDecoder.h |
index 83c0cb9b0380e2e5e95850be4014a720a054b030..7224eecb02f30d222b8f1cb2508c5f5327b67d7e 100644 |
--- a/Source/platform/image-decoders/ImageDecoder.h |
+++ b/Source/platform/image-decoders/ImageDecoder.h |
@@ -49,6 +49,23 @@ typedef Vector<char> ColorProfile; |
namespace blink { |
+enum DecodedImageType { |
+ // These values are histogrammed over time; do not change their ordinal |
+ // values. When deleting an image type, replace it with a dummy value; |
+ // when adding an image type, do so at the bottom (and update DecodedImageTypeMax). |
+ // Also, this enum should be in sync with the 'DecodedImageType' enum in |
+ // tools/metrics/histograms/histograms.xml |
+ ImageUnknown = 0, |
+ ImageJPEG, |
+ ImagePNG, |
+ ImageGIF, |
+ ImageWebP, |
+ ImageICO, |
+ ImageBMP, |
+ |
+ DecodedImageTypeMax = ImageBMP // Must equal the last "real" image type above. |
+}; |
+ |
// ImagePlanes can be used to decode color components into provided buffers instead of using an ImageFrame. |
class PLATFORM_EXPORT ImagePlanes { |
public: |
@@ -326,6 +343,14 @@ protected: |
// Decodes the requested frame. |
virtual void decode(size_t) = 0; |
+ // Report image stats if it's NOT a trivial 1x1 image. |
+ void reportStats(DecodedImageType type) const |
+ { |
+ if (isDecodedSizeAvailable() && (size().width() > 1 || size().height() > 1)) { |
+ Platform::current()->histogramEnumeration("Blink.DecodedImageType", type, DecodedImageTypeMax + 1); |
+ } |
+ } |
+ |
RefPtr<SharedBuffer> m_data; // The encoded data. |
Vector<ImageFrame, 1> m_frameBufferCache; |
bool m_premultiplyAlpha; |