Title: [103041] trunk/Source/WebCore
Revision
103041
Author
commit-qu...@webkit.org
Date
2011-12-16 00:35:07 -0800 (Fri, 16 Dec 2011)

Log Message

[Chromium] Add trace events for decoding and drawing images.
https://bugs.webkit.org/show_bug.cgi?id=74547

Patch by Daniel Sievers <siev...@chromium.org> on 2011-12-16
Reviewed by James Robinson.

* platform/graphics/skia/ImageSkia.cpp:
(WebCore::drawResampledBitmap):
(WebCore::paintSkBitmap):
(WebCore::Image::drawPattern):
* platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::NativeImageSkia::resizedBitmap):
* platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::decode):
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::decode):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::decode):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::decode):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::decode):
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103040 => 103041)


--- trunk/Source/WebCore/ChangeLog	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/ChangeLog	2011-12-16 08:35:07 UTC (rev 103041)
@@ -1,3 +1,29 @@
+2011-12-16  Daniel Sievers  <siev...@chromium.org>
+
+        [Chromium] Add trace events for decoding and drawing images.
+        https://bugs.webkit.org/show_bug.cgi?id=74547
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::drawResampledBitmap):
+        (WebCore::paintSkBitmap):
+        (WebCore::Image::drawPattern):
+        * platform/graphics/skia/NativeImageSkia.cpp:
+        (WebCore::NativeImageSkia::resizedBitmap):
+        * platform/image-decoders/bmp/BMPImageDecoder.cpp:
+        (WebCore::BMPImageDecoder::decode):
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::decode):
+        * platform/image-decoders/ico/ICOImageDecoder.cpp:
+        (WebCore::ICOImageDecoder::decode):
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::JPEGImageDecoder::decode):
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageDecoder::decode):
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::decode):
+
 2011-12-15  Martin Robinson  <mrobin...@igalia.com>
 
         Fix 'make dist' in preparation for the GTK+ release.

Modified: trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -50,6 +50,10 @@
 #include "skia/ext/image_operations.h"
 #include "skia/ext/platform_canvas.h"
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 // Used by computeResamplingMode to tell how bitmaps should be resampled.
@@ -166,6 +170,9 @@
 // scaling or translation.
 static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeImageSkia& bitmap, const SkIRect& srcIRect, const SkRect& destRect)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("drawResampledBitmap", &canvas, 0);
+#endif
     // Apply forward transform to destRect to estimate required size of
     // re-sampled bitmap, and use only in calls required to resize, or that
     // check for the required size.
@@ -212,6 +219,9 @@
 
 static void paintSkBitmap(PlatformContextSkia* platformContext, const NativeImageSkia& bitmap, const SkIRect& srcRect, const SkRect& destRect, const SkXfermode::Mode& compOp)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("paintSkBitmap", platformContext, 0);
+#endif
     SkPaint paint;
     paint.setXfermodeMode(compOp);
     paint.setFilterBitmap(true);
@@ -296,6 +306,9 @@
                         CompositeOperator compositeOp,
                         const FloatRect& destRect)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("Image::drawPattern", this, 0);
+#endif
     FloatRect normSrcRect = normalizeRect(floatSrcRect);
     if (destRect.isEmpty() || normSrcRect.isEmpty())
         return; // nothing to draw

Modified: trunk/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -36,6 +36,10 @@
 #include "GraphicsContext3D.h"
 #include "SkiaUtils.h"
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 NativeImageSkia::NativeImageSkia()
@@ -70,6 +74,9 @@
                                         int destHeight,
                                         const SkIRect& destVisibleSubset) const
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("NativeImageSkia::resizedBitmap", const_cast<NativeImageSkia*>(this), 0);
+#endif
     if (!hasResizedBitmap(srcSubset, destWidth, destHeight)) {
         bool shouldCache = m_isDataComplete
             && shouldCacheResampling(srcSubset, destWidth, destHeight, destVisibleSubset);
@@ -77,12 +84,18 @@
         SkBitmap subset;
         m_image.extractSubset(&subset, srcSubset);
         if (!shouldCache) {
+#if PLATFORM(CHROMIUM)
+            TRACE_EVENT("nonCachedResize", const_cast<NativeImageSkia*>(this), 0);
+#endif
             // Just resize the visible subset and return it.
             SkBitmap resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight, destVisibleSubset);
             return resizedImage;
+        } else {
+#if PLATFORM(CHROMIUM)
+            TRACE_EVENT("cachedResize", const_cast<NativeImageSkia*>(this), 0);
+#endif
+            m_resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight);
         }
-
-        m_resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight);
     }
 
     SkBitmap visibleBitmap;

Modified: trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -34,6 +34,10 @@
 #include "BMPImageReader.h"
 #include <wtf/PassOwnPtr.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 // Number of bits in .BMP used to store the file header (doesn't match
@@ -90,6 +94,9 @@
 
 void BMPImageDecoder::decode(bool onlySize)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("BMPImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return;
 

Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -29,6 +29,10 @@
 #include "GIFImageReader.h"
 #include <wtf/PassOwnPtr.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 GIFImageDecoder::GIFImageDecoder(ImageSource::AlphaOption alphaOption,
@@ -310,6 +314,9 @@
 
 void GIFImageDecoder::decode(unsigned haltAtFrame, GIFQuery query)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("GIFImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return;
 

Modified: trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -37,6 +37,10 @@
 #include "PNGImageDecoder.h"
 #include <wtf/PassOwnPtr.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 // Number of bits in .ICO/.CUR used to store the directory and its entries,
@@ -153,6 +157,9 @@
 
 void ICOImageDecoder::decode(size_t index, bool onlySize)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("ICOImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return;
 

Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -42,6 +42,10 @@
 #include <stdio.h>  // Needed by jpeglib.h for FILE.
 #include <wtf/PassOwnPtr.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 #if OS(WINCE)
 // Remove warning: 'FAR' macro redefinition
 #undef FAR
@@ -561,6 +565,9 @@
 
 void JPEGImageDecoder::decode(bool onlySize)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("JPEGImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return;
 

Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -43,6 +43,10 @@
 #include "png.h"
 #include <wtf/PassOwnPtr.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 #if defined(PNG_LIBPNG_VER_MAJOR) && defined(PNG_LIBPNG_VER_MINOR) && (PNG_LIBPNG_VER_MAJOR > 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4))
 #define JMPBUF(png_ptr) png_jmpbuf(png_ptr)
 #else
@@ -426,6 +430,9 @@
 
 void PNGImageDecoder::decode(bool onlySize)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("PNGImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return;
 

Modified: trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp (103040 => 103041)


--- trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp	2011-12-16 08:28:21 UTC (rev 103040)
+++ trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp	2011-12-16 08:35:07 UTC (rev 103041)
@@ -33,6 +33,10 @@
 
 #include "webp/decode.h"
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 #if CPU(BIG_ENDIAN) || CPU(MIDDLE_ENDIAN)
 inline WEBP_CSP_MODE outputMode() { return MODE_RGBA; }
 #else // LITTLE_ENDIAN, output BGRA pixels.
@@ -81,6 +85,9 @@
 
 bool WEBPImageDecoder::decode(bool onlySize)
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("WEBPImageDecoder::decode", this, 0);
+#endif
     if (failed())
         return false;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to