[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

vangelis at chromium.org vangelis at chromium.org
Wed Dec 22 13:28:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 02fd6b133d3ab8c246c9f729834c2f7af3216a92
Author: vangelis at chromium.org <vangelis at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 16 15:58:41 2010 +0000

    2010-09-16  Vangelis Kokkevis  <vangelis at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [chromium] ImageLayerChromium needs to keep a ref to the Image it uses
            so that it never tries to access an already destroyed Image.
            https://bugs.webkit.org/show_bug.cgi?id=45869
    
            * platform/graphics/chromium/GraphicsLayerChromium.cpp:
            (WebCore::GraphicsLayerChromium::setContentsToImage):
            * platform/graphics/chromium/ImageLayerChromium.cpp:
            (WebCore::ImageLayerChromium::setContents):
            (WebCore::ImageLayerChromium::updateContents):
            * platform/graphics/chromium/ImageLayerChromium.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67625 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 648c3a2..c45dcb8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-16  Vangelis Kokkevis  <vangelis at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [chromium] ImageLayerChromium needs to keep a ref to the Image it uses
+        so that it never tries to access an already destroyed Image.
+        https://bugs.webkit.org/show_bug.cgi?id=45869
+
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::setContentsToImage):
+        * platform/graphics/chromium/ImageLayerChromium.cpp:
+        (WebCore::ImageLayerChromium::setContents):
+        (WebCore::ImageLayerChromium::updateContents):
+        * platform/graphics/chromium/ImageLayerChromium.h:
+
 2010-09-16  Patrick Gansterer  <paroga at paroga.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
index d934f46..21dcd8e 100644
--- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -319,7 +319,6 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
 {
     bool childrenChanged = false;
     if (image) {
-        NativeImagePtr nativeImage = image->nativeImageForCurrentFrame();
         if (!m_contentsLayer.get() || m_contentsLayerPurpose != ContentsLayerForImage) {
             RefPtr<ImageLayerChromium> imageLayer = ImageLayerChromium::create(this);
             setupContentsLayer(imageLayer.get());
@@ -328,7 +327,7 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
             childrenChanged = true;
         }
         ImageLayerChromium* imageLayer = static_cast<ImageLayerChromium*>(m_contentsLayer.get());
-        imageLayer->setContents(nativeImage);
+        imageLayer->setContents(image);
         updateContentsRect();
     } else {
         if (m_contentsLayer) {
diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
index f4cad7a..0ed3973 100644
--- a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
@@ -34,6 +34,7 @@
 
 #include "ImageLayerChromium.h"
 
+#include "Image.h"
 #include "LayerRendererChromium.h"
 
 #if PLATFORM(SKIA)
@@ -61,7 +62,7 @@ ImageLayerChromium::ImageLayerChromium(GraphicsLayerChromium* owner)
 {
 }
 
-void ImageLayerChromium::setContents(NativeImagePtr contents)
+void ImageLayerChromium::setContents(Image* contents)
 {
     // Check if the image has changed.
     if (m_contents == contents)
@@ -79,9 +80,11 @@ void ImageLayerChromium::updateContents()
     IntSize requiredTextureSize;
     IntSize bitmapSize;
 
+    NativeImagePtr nativeImage = m_contents->nativeImageForCurrentFrame();
+
 #if PLATFORM(SKIA)
     // The layer contains an Image.
-    NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(m_contents);
+    NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(nativeImage);
     const SkBitmap* skiaBitmap = skiaImage;
     requiredTextureSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
     ASSERT(skiaBitmap);
@@ -95,9 +98,8 @@ void ImageLayerChromium::updateContents()
     }
 #elif PLATFORM(CG)
     // NativeImagePtr is a CGImageRef on Mac OS X.
-    CGImageRef cgImage = m_contents.get();
-    int width = CGImageGetWidth(cgImage);
-    int height = CGImageGetHeight(cgImage);
+    int width = CGImageGetWidth(nativeImage);
+    int height = CGImageGetHeight(nativeImage);
     requiredTextureSize = IntSize(width, height);
     bitmapSize = requiredTextureSize;
     // FIXME: we should get rid of this temporary copy where possible.
@@ -109,7 +111,7 @@ void ImageLayerChromium::updateContents()
     // Try to reuse the color space from the image to preserve its colors.
     // Some images use a color space (such as indexed) unsupported by the bitmap context.
     RetainPtr<CGColorSpaceRef> colorSpaceReleaser;
-    CGColorSpaceRef colorSpace = CGImageGetColorSpace(cgImage);
+    CGColorSpaceRef colorSpace = CGImageGetColorSpace(nativeImage);
     CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);
     switch (colorSpaceModel) {
     case kCGColorSpaceModelMonochrome:
@@ -130,7 +132,7 @@ void ImageLayerChromium::updateContents()
     CGContextSetBlendMode(tempContext.get(), kCGBlendModeCopy);
     CGContextDrawImage(tempContext.get(),
                        CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
-                       cgImage);
+                       nativeImage);
     pixels = tempVector.data();
 #else
 #error "Need to implement for your platform."
diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.h b/WebCore/platform/graphics/chromium/ImageLayerChromium.h
index eed116c..b91f04a 100644
--- a/WebCore/platform/graphics/chromium/ImageLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.h
@@ -42,6 +42,8 @@
 
 namespace WebCore {
 
+class Image;
+
 // A Layer that contains only an Image element.
 class ImageLayerChromium : public ContentLayerChromium {
 public:
@@ -50,17 +52,12 @@ public:
     virtual void updateContents();
     virtual bool drawsContent() { return m_contents; }
 
-    void setContents(NativeImagePtr);
+    void setContents(Image* image);
 
 private:
     ImageLayerChromium(GraphicsLayerChromium* owner);
 
-#if PLATFORM(CG)
-    RetainPtr<CGImageRef> m_contents;
-#else
-    // FIXME: This needs to be an owning type.
-    NativeImagePtr m_contents;
-#endif
+    RefPtr<Image> m_contents;
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list