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

hclam at chromium.org hclam at chromium.org
Wed Dec 22 14:15:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d528f6c4b18a1c1468db7028b513bccb5ba756d5
Author: hclam at chromium.org <hclam at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 6 01:40:43 2010 +0000

    VideoLayerChromium releases old resources if the LayerRenderer changes.
    https://bugs.webkit.org/show_bug.cgi?id=47030
    
    Submitted for Victoria Kirst <vrk at google.com>.
    Reviewed by James Robinson.
    
    Refactored LayerChromium to have a virtual cleanupResources() method
    that will release textures/other context-dependent resources when a
    LayerRenderer changes. ContentLayerChromium and VideoLayerChromium now
    override this method to perform cleanup.
    
    * platform/graphics/chromium/ContentLayerChromium.cpp:
    * platform/graphics/chromium/ContentLayerChromium.h:
    * platform/graphics/chromium/LayerChromium.cpp:
    (WebCore::LayerChromium::setLayerRenderer):
    * platform/graphics/chromium/LayerChromium.h:
    (WebCore::LayerChromium::cleanupResources):
    * platform/graphics/chromium/VideoLayerChromium.cpp:
    (WebCore::VideoLayerChromium::~VideoLayerChromium):
    (WebCore::VideoLayerChromium::cleanupResources):
    * platform/graphics/chromium/VideoLayerChromium.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69166 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c340dba..ca04b87 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-10-05  Victoria Kirst  <vrk at google.com>
+
+        Reviewed by James Robinson.
+
+        VideoLayerChromium releases old resources if the LayerRenderer changes.
+        https://bugs.webkit.org/show_bug.cgi?id=47030
+
+        Refactored LayerChromium to have a virtual cleanupResources() method
+        that will release textures/other context-dependent resources when a
+        LayerRenderer changes. ContentLayerChromium and VideoLayerChromium now
+        override this method to perform cleanup.
+
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        * platform/graphics/chromium/ContentLayerChromium.h:
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::setLayerRenderer):
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::cleanupResources):
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::~VideoLayerChromium):
+        (WebCore::VideoLayerChromium::cleanupResources):
+        * platform/graphics/chromium/VideoLayerChromium.h:
+
 2010-10-05  Kinuko Yasuda  <kinuko at chromium.org>
 
         Reviewed by Jian Li.
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 8dda4d6..635e6d8 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -129,16 +129,6 @@ ContentLayerChromium::~ContentLayerChromium()
     cleanupResources();
 }
 
-void ContentLayerChromium::setLayerRenderer(LayerRendererChromium* renderer)
-{
-    // If we're changing layer renderers then we need to free up any resources
-    // allocated by the old renderer.
-    if (layerRenderer() && layerRenderer() != renderer)
-        cleanupResources();
-
-    LayerChromium::setLayerRenderer(renderer);
-}
-
 void ContentLayerChromium::cleanupResources()
 {
     if (layerRenderer()) {
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/WebCore/platform/graphics/chromium/ContentLayerChromium.h
index 412ba06..7f302fc 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.h
@@ -49,7 +49,6 @@ public:
     virtual void updateContents();
     virtual void draw();
     virtual bool drawsContent() { return m_owner && m_owner->drawsContent(); }
-    virtual void setLayerRenderer(LayerRendererChromium*);
 
     // Stores values that are shared between instances of this class that are
     // associated with the same LayerRendererChromium (and hence the same GL
@@ -80,7 +79,7 @@ protected:
     void updateTextureRect(void* pixels, const IntSize& bitmapSize, const IntSize& requiredTextureSize,
                            const IntRect& updateRect, unsigned textureId);
 
-    void cleanupResources();
+    virtual void cleanupResources();
 
     unsigned m_contentsTexture;
     IntSize m_allocatedTextureSize;
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index 5dba58d..a1f7611 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -174,6 +174,11 @@ LayerChromium::~LayerChromium()
 
 void LayerChromium::setLayerRenderer(LayerRendererChromium* renderer)
 {
+    // If we're changing layer renderers then we need to free up any resources
+    // allocated by the old renderer.
+    if (layerRenderer() && layerRenderer() != renderer)
+        cleanupResources();
+
     m_layerRenderer = renderer;
 }
 
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h
index 0a66318..7325189 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -202,6 +202,11 @@ protected:
     GraphicsLayerChromium* m_owner;
     LayerChromium(GraphicsLayerChromium* owner);
 
+    // This is called to clean up resources being held in the same context as
+    // layerRendererContext(). Subclasses should override this method if they
+    // hold context-dependent resources such as textures.
+    virtual void cleanupResources() { }
+
     LayerRendererChromium* layerRenderer() const { return m_layerRenderer.get(); }
     GraphicsContext3D* layerRendererContext() const;
 
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 8781084..01b4d6e 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -182,8 +182,12 @@ VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameP
 
 VideoLayerChromium::~VideoLayerChromium()
 {
-    releaseCurrentFrame();
+    cleanupResources();
+}
 
+void VideoLayerChromium::cleanupResources()
+{
+    releaseCurrentFrame();
     ASSERT(layerRenderer());
     GraphicsContext3D* context = layerRendererContext();
     for (unsigned plane = 0; plane < VideoFrameChromium::maxPlanes; plane++) {
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.h b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
index 92b6fc2..05b6578 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
@@ -89,8 +89,12 @@ public:
         bool m_initialized;
     };
 
+protected:
+    virtual void cleanupResources();
+
 private:
     VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider*);
+
     static unsigned determineTextureFormat(VideoFrameChromium*);
     bool allocateTexturesIfNeeded(GraphicsContext3D*, VideoFrameChromium*, unsigned textureFormat);
     void updateYUVContents(GraphicsContext3D*, const VideoFrameChromium*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list