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

Unified Diff: Source/platform/graphics/BitmapImage.cpp

Issue 1242263011: Record UMA stats for Blink decoded image types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move enum to source file Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/BitmapImage.cpp
diff --git a/Source/platform/graphics/BitmapImage.cpp b/Source/platform/graphics/BitmapImage.cpp
index e3a3a72d0a680ad01fc0836f3cdaa754899df775..aace74ea038c13c8d6bc3a05fe1047b532300181 100644
--- a/Source/platform/graphics/BitmapImage.cpp
+++ b/Source/platform/graphics/BitmapImage.cpp
@@ -333,6 +333,29 @@ size_t BitmapImage::frameCount()
return m_frameCount;
}
+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 LastDecodedImageType
+ // so that it equals the last real image type).
+ // Also, this enum should be in sync with the 'DecodedImageType' enum in
+ // src/tools/metrics/histograms/histograms.xml
+ ImageUnknown = 0,
+ ImageJPEG,
+ ImagePNG,
+ ImageGIF,
+ ImageWebP,
+ ImageICO,
+ ImageBMP,
+
+ LastDecodedImageType = ImageBMP
+};
+
+static inline bool hasVisibleImageSize(IntSize size)
+{
+ return (size.width() > 1 || size.height() > 1);
+}
+
bool BitmapImage::isSizeAvailable()
{
if (m_sizeAvailable)
@@ -340,6 +363,19 @@ bool BitmapImage::isSizeAvailable()
m_sizeAvailable = m_source.isSizeAvailable();
+ if (m_sizeAvailable && hasVisibleImageSize(size())) {
+ String fileExtention = m_source.filenameExtension();
+ DecodedImageType type =
+ fileExtention == "jpg" ? ImageJPEG :
+ fileExtention == "png" ? ImagePNG :
+ fileExtention == "gif" ? ImageGIF :
+ fileExtention == "webp" ? ImageWebP :
+ fileExtention == "ico" ? ImageICO :
+ fileExtention == "bmp" ? ImageBMP :
+ ImageUnknown;
+ Platform::current()->histogramEnumeration("Blink.DecodedImageType", type, LastDecodedImageType + 1);
+ }
+
return m_sizeAvailable;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698