Title: [127077] trunk
Revision
127077
Author
[email protected]
Date
2012-08-29 18:34:14 -0700 (Wed, 29 Aug 2012)

Log Message

[chromium] Register/unregister contents layers with GraphicsLayerChromium
https://bugs.webkit.org/show_bug.cgi?id=95379

Reviewed by Adrienne Walker.

Source/WebCore:

Several composited layer types in WebCore are represented by a painted layer and a child "contents layer" that
represents some non-painted specific content type. For example, a composited video has a WebCore-painted layer
for CSS background and border effects and a child platform video layer backed by a WebVideoLayer with the output
of the video decoding pipeline. Cross-platform code associates the PlatformLayer from the various composited
systems with the right GraphicsLayer, but the object owning the layer and the GraphicsLayer holding the pointer
otherwise have no relationship. This makes shutdown a bit tricky since the object destroying the contents layer
has no direct way to notify the GraphicsLayer holding the contents layer pointer that it is going away. The
GraphicsLayer will be notified after the next style recalc that its contents layer is gone, but may need to do
any number of bookkeeping operations before that happens.

On most platforms the PlatformLayer is refcounted, so the GraphicsLayer simply holds a ref to its contents layer
from the time it is orphaned until the next style recalc and compositing tree rebuild. In Chromium, however,
PlatformLayer is not refcounted. This adds an explicit registration mechanism for layers that may be contents
layers.  A layer has to be registered with GraphicsLayerChromium before it can be used as a contents layer -
typically this is just done at creation - and unregistered before it is destroyed.

Tests: fast/canvas/transformed-canvas-reset.html
       platform/chromium/virtual/gpu/fast/canvas/transformed-canvas-reset.html

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::~ScrollingCoordinatorPrivate):
(WebCore::createScrollbarLayer):
* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
(WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::clearBackgroundColor):
(WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
(WebCore::GraphicsLayerChromium::setContentsToImage):
(WebCore):
(WebCore::GraphicsLayerChromium::registerContentsLayer):
(WebCore::GraphicsLayerChromium::unregisterContentsLayer):
(WebCore::GraphicsLayerChromium::clearContentsLayerIfUnregistered):
(WebCore::GraphicsLayerChromium::setContentsTo):
(WebCore::GraphicsLayerChromium::updateChildList):
(WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
(WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
(WebCore::GraphicsLayerChromium::updateContentsRect):
* platform/graphics/chromium/GraphicsLayerChromium.h:
(GraphicsLayerChromium):

Source/WebKit/chromium:

* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl):
(WebKit::WebMediaPlayerClientImpl::readyStateChanged):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::setBackingTextureId):
(WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
(WebKit::WebPluginContainerImpl::~WebPluginContainerImpl):

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/canvas/transformed-canvas-reset-expected.txt (0 => 127077)


--- trunk/LayoutTests/fast/canvas/transformed-canvas-reset-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/transformed-canvas-reset-expected.txt	2012-08-30 01:34:14 UTC (rev 127077)
@@ -0,0 +1 @@
+ Test passes if DRT doesn't crash.
Property changes on: trunk/LayoutTests/fast/canvas/transformed-canvas-reset-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/canvas/transformed-canvas-reset.html (0 => 127077)


--- trunk/LayoutTests/fast/canvas/transformed-canvas-reset.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/transformed-canvas-reset.html	2012-08-30 01:34:14 UTC (rev 127077)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<canvas id="can" width=200 height=256 style="-webkit-transform: translateZ(0)"></canvas>
+Test passes if DRT doesn't crash.
+<script>
+var can = document.querySelector("#can");
+var ctx = can.getContext("2d");
+ctx.fillStyle = "green";
+ctx.fillRect(0, 0, 300, 300);
+document.body.offsetTop;
+can.width = 300;
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
Property changes on: trunk/LayoutTests/fast/canvas/transformed-canvas-reset.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (127076 => 127077)


--- trunk/Source/WebCore/ChangeLog	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/ChangeLog	2012-08-30 01:34:14 UTC (rev 127077)
@@ -1,3 +1,55 @@
+2012-08-29  James Robinson  <[email protected]>
+
+        [chromium] Register/unregister contents layers with GraphicsLayerChromium
+        https://bugs.webkit.org/show_bug.cgi?id=95379
+
+        Reviewed by Adrienne Walker.
+
+        Several composited layer types in WebCore are represented by a painted layer and a child "contents layer" that
+        represents some non-painted specific content type. For example, a composited video has a WebCore-painted layer
+        for CSS background and border effects and a child platform video layer backed by a WebVideoLayer with the output
+        of the video decoding pipeline. Cross-platform code associates the PlatformLayer from the various composited
+        systems with the right GraphicsLayer, but the object owning the layer and the GraphicsLayer holding the pointer
+        otherwise have no relationship. This makes shutdown a bit tricky since the object destroying the contents layer
+        has no direct way to notify the GraphicsLayer holding the contents layer pointer that it is going away. The
+        GraphicsLayer will be notified after the next style recalc that its contents layer is gone, but may need to do
+        any number of bookkeeping operations before that happens.
+
+        On most platforms the PlatformLayer is refcounted, so the GraphicsLayer simply holds a ref to its contents layer
+        from the time it is orphaned until the next style recalc and compositing tree rebuild. In Chromium, however,
+        PlatformLayer is not refcounted. This adds an explicit registration mechanism for layers that may be contents
+        layers.  A layer has to be registered with GraphicsLayerChromium before it can be used as a contents layer -
+        typically this is just done at creation - and unregistered before it is destroyed.
+
+        Tests: fast/canvas/transformed-canvas-reset.html
+               platform/chromium/virtual/gpu/fast/canvas/transformed-canvas-reset.html
+
+        * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+        (WebCore::ScrollingCoordinatorPrivate::~ScrollingCoordinatorPrivate):
+        (WebCore::createScrollbarLayer):
+        * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+        (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+        (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+        (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::updateNames):
+        (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+        (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+        (WebCore::GraphicsLayerChromium::setContentsToImage):
+        (WebCore):
+        (WebCore::GraphicsLayerChromium::registerContentsLayer):
+        (WebCore::GraphicsLayerChromium::unregisterContentsLayer):
+        (WebCore::GraphicsLayerChromium::clearContentsLayerIfUnregistered):
+        (WebCore::GraphicsLayerChromium::setContentsTo):
+        (WebCore::GraphicsLayerChromium::updateChildList):
+        (WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
+        (WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
+        (WebCore::GraphicsLayerChromium::updateContentsRect):
+        * platform/graphics/chromium/GraphicsLayerChromium.h:
+        (GraphicsLayerChromium):
+
 2012-08-29  Rafael Brandao  <[email protected]>
 
         [Texmap] CSS Transform flicks at the end of animation

Modified: trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp (127076 => 127077)


--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -29,6 +29,7 @@
 
 #include "Frame.h"
 #include "FrameView.h"
+#include "GraphicsLayerChromium.h"
 #include "Page.h"
 #include "Region.h"
 #include "RenderLayerCompositor.h"
@@ -56,7 +57,13 @@
     {
     }
 
-    ~ScrollingCoordinatorPrivate() { }
+    ~ScrollingCoordinatorPrivate()
+    {
+        if (m_horizontalScrollbarLayer)
+            GraphicsLayerChromium::unregisterContentsLayer(m_horizontalScrollbarLayer->layer());
+        if (m_verticalScrollbarLayer)
+            GraphicsLayerChromium::unregisterContentsLayer(m_verticalScrollbarLayer->layer());
+    }
 
     void setScrollLayer(WebLayer* layer)
     {
@@ -157,6 +164,7 @@
     OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebScrollbarLayer::create(new WebKit::WebScrollbarImpl(scrollbar), painter, geometry.leakPtr()));
     scrollbarLayer->setScrollLayer(scrollLayer);
 
+    GraphicsLayerChromium::registerContentsLayer(scrollbarLayer->layer());
     scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer());
     scrollbarGraphicsLayer->setDrawsContent(false);
     scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque());

Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp (127076 => 127077)


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -32,6 +32,7 @@
 #include "GrContext.h"
 #include "GraphicsContext3D.h"
 #include "GraphicsContext3DPrivate.h"
+#include "GraphicsLayerChromium.h"
 #include "TraceEvent.h"
 #include <public/WebCompositor.h>
 #include <public/WebGraphicsContext3D.h>
@@ -76,10 +77,12 @@
     m_layer = adoptPtr(WebExternalTextureLayer::create(this));
     m_layer->setTextureId(textureId);
     m_layer->setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
+    GraphicsLayerChromium::registerContentsLayer(m_layer->layer());
 }
 
 Canvas2DLayerBridge::~Canvas2DLayerBridge()
 {
+    GraphicsLayerChromium::unregisterContentsLayer(m_layer->layer());
     Canvas2DLayerManager::get().layerToBeDestroyed(this);
     if (SkDeferredCanvas* deferred = deferredCanvas())
         deferred->setNotificationClient(0);

Modified: trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp (127076 => 127077)


--- trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -36,6 +36,7 @@
 #include "Extensions3DChromium.h"
 #include "GraphicsContext3D.h"
 #include "GraphicsContext3DPrivate.h"
+#include "GraphicsLayerChromium.h"
 #include <algorithm>
 #include <public/WebCompositor.h>
 #include <public/WebExternalTextureLayer.h>
@@ -167,10 +168,12 @@
         GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
         m_layer->setOpaque(!attributes.alpha);
         m_layer->setPremultipliedAlpha(attributes.premultipliedAlpha);
+        GraphicsLayerChromium::registerContentsLayer(m_layer->layer());
     }
 
     virtual ~DrawingBufferPrivate()
     {
+        GraphicsLayerChromium::unregisterContentsLayer(m_layer->layer());
     }
 
     virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (127076 => 127077)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -56,7 +56,6 @@
 #include "PlatformString.h"
 #include "SkMatrix44.h"
 #include "SystemTime.h"
-
 #include <public/WebAnimation.h>
 #include <public/WebFilterOperation.h>
 #include <public/WebFilterOperations.h>
@@ -66,6 +65,7 @@
 #include <public/WebSize.h>
 #include <public/WebTransformationMatrix.h>
 #include <wtf/CurrentTime.h>
+#include <wtf/HashSet.h>
 #include <wtf/StringExtras.h>
 #include <wtf/text/CString.h>
 
@@ -129,9 +129,9 @@
         String debugName = "TransformLayer for " + m_nameBase;
         m_transformLayer->setDebugName(debugName);
     }
-    if (m_contentsLayer) {
+    if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
         String debugName = "ContentsLayer for " + m_nameBase;
-        m_contentsLayer->setDebugName(debugName);
+        contentsLayer->setDebugName(debugName);
     }
     if (m_linkHighlight) {
         String debugName = "LinkHighlight for " + m_nameBase;
@@ -289,7 +289,9 @@
 void GraphicsLayerChromium::clearBackgroundColor()
 {
     GraphicsLayer::clearBackgroundColor();
-    m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
+
+    if (WebLayer* contentsLayer = contentsLayerIfRegistered())
+        contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::setContentsOpaque(bool opaque)
@@ -431,8 +433,8 @@
 
 void GraphicsLayerChromium::setContentsNeedsDisplay()
 {
-    if (m_contentsLayer)
-        m_contentsLayer->invalidate();
+    if (WebLayer* contentsLayer = contentsLayerIfRegistered())
+        contentsLayer->invalidate();
 }
 
 void GraphicsLayerChromium::setNeedsDisplay()
@@ -468,6 +470,7 @@
     if (image) {
         if (m_contentsLayerPurpose != ContentsLayerForImage) {
             m_imageLayer = adoptPtr(WebImageLayer::create());
+            registerContentsLayer(m_imageLayer->layer());
             setupContentsLayer(m_imageLayer->layer());
             m_contentsLayerPurpose = ContentsLayerForImage;
             childrenChanged = true;
@@ -480,6 +483,7 @@
         if (m_imageLayer) {
             childrenChanged = true;
 
+            unregisterContentsLayer(m_imageLayer->layer());
             m_imageLayer.clear();
         }
         // The old contents layer will be removed via updateChildList.
@@ -490,6 +494,40 @@
         updateChildList();
 }
 
+static HashSet<int>* s_registeredLayerSet;
+
+void GraphicsLayerChromium::registerContentsLayer(WebLayer* layer)
+{
+    if (!s_registeredLayerSet)
+        s_registeredLayerSet = new HashSet<int>;
+    if (s_registeredLayerSet->contains(layer->id()))
+        CRASH();
+    s_registeredLayerSet->add(layer->id());
+}
+
+void GraphicsLayerChromium::unregisterContentsLayer(WebLayer* layer)
+{
+    ASSERT(s_registeredLayerSet);
+    if (!s_registeredLayerSet->contains(layer->id()))
+        CRASH();
+    s_registeredLayerSet->remove(layer->id());
+}
+
+void GraphicsLayerChromium::clearContentsLayerIfUnregistered()
+{
+    if (!m_contentsLayerId || s_registeredLayerSet->contains(m_contentsLayerId))
+        return;
+
+    m_contentsLayer = 0;
+    m_contentsLayerId = 0;
+}
+
+WebLayer* GraphicsLayerChromium::contentsLayerIfRegistered()
+{
+    clearContentsLayerIfUnregistered();
+    return m_contentsLayer;
+}
+
 void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
 {
     setContentsTo(ContentsLayerForCanvas, layer);
@@ -504,6 +542,9 @@
 {
     bool childrenChanged = false;
     if (layer) {
+        ASSERT(s_registeredLayerSet);
+        if (!s_registeredLayerSet->contains(layer->id()))
+            CRASH();
         if (m_contentsLayerId != layer->id()) {
             setupContentsLayer(layer);
             m_contentsLayerPurpose = purpose;
@@ -606,6 +647,8 @@
     WebLayer* childHost = m_transformLayer ? m_transformLayer.get() : m_layer->layer();
     childHost->removeAllChildren();
 
+    clearContentsLayerIfUnregistered();
+
     if (m_transformLayer) {
         // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
         childHost->addChild(m_layer->layer());
@@ -742,10 +785,9 @@
     // so it is only given contentsVisible.
 
     m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
+    if (WebLayer* contentsLayer = contentsLayerIfRegistered())
+        contentsLayer->setDrawsContent(m_contentsVisible);
 
-    if (m_contentsLayer)
-        m_contentsLayer->setDrawsContent(m_contentsVisible);
-
     if (m_drawsContent) {
         m_layer->layer()->invalidate();
         if (m_linkHighlight)
@@ -757,14 +799,15 @@
 
 void GraphicsLayerChromium::updateLayerBackgroundColor()
 {
-    if (!m_contentsLayer)
+    WebLayer* contentsLayer = contentsLayerIfRegistered();
+    if (!contentsLayer)
         return;
 
     // We never create the contents layer just for background color yet.
     if (m_backgroundColorSet)
-        m_contentsLayer->setBackgroundColor(m_backgroundColor.rgb());
+        contentsLayer->setBackgroundColor(m_backgroundColor.rgb());
     else
-        m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
+        contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
 }
 
 void GraphicsLayerChromium::updateContentsVideo()
@@ -774,11 +817,12 @@
 
 void GraphicsLayerChromium::updateContentsRect()
 {
-    if (!m_contentsLayer)
+    WebLayer* contentsLayer = contentsLayerIfRegistered();
+    if (!contentsLayer)
         return;
 
-    m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
-    m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
+    contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
+    contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
 }
 
 void GraphicsLayerChromium::updateContentsScale()

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h (127076 => 127077)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h	2012-08-30 01:34:14 UTC (rev 127077)
@@ -110,6 +110,9 @@
 
     virtual void setContentsRect(const IntRect&);
 
+    static void registerContentsLayer(WebKit::WebLayer*);
+    static void unregisterContentsLayer(WebKit::WebLayer*);
+
     virtual void setContentsToImage(Image*);
     virtual void setContentsToMedia(PlatformLayer*);
     virtual void setContentsToCanvas(PlatformLayer*);
@@ -125,7 +128,7 @@
     // Next function for testing purposes.
     LinkHighlightClient* linkHighlight() { return m_linkHighlight; }
 
-    virtual PlatformLayer* platformLayer() const;
+    virtual WebKit::WebLayer* platformLayer() const;
 
     virtual void setDebugBackgroundColor(const Color&);
     virtual void setDebugBorder(const Color&, float borderWidth);
@@ -171,6 +174,8 @@
 
     void setContentsTo(ContentsLayerPurpose, WebKit::WebLayer*);
     void setupContentsLayer(WebKit::WebLayer*);
+    void clearContentsLayerIfUnregistered();
+    WebKit::WebLayer* contentsLayerIfRegistered();
 
     String m_nameBase;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (127076 => 127077)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-30 01:34:14 UTC (rev 127077)
@@ -1,3 +1,18 @@
+2012-08-29  James Robinson  <[email protected]>
+
+        [chromium] Register/unregister contents layers with GraphicsLayerChromium
+        https://bugs.webkit.org/show_bug.cgi?id=95379
+
+        Reviewed by Adrienne Walker.
+
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl):
+        (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::setBackingTextureId):
+        (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+        (WebKit::WebPluginContainerImpl::~WebPluginContainerImpl):
+
 2012-08-29  W. James MacLean  <[email protected]>
 
         [chromium] Add WebSettings support for flag to enable/disable gesture tap highlights.

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (127076 => 127077)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -12,6 +12,7 @@
 #include "AudioSourceProviderClient.h"
 #include "Frame.h"
 #include "GraphicsContext.h"
+#include "GraphicsLayerChromium.h"
 #include "HTMLMediaElement.h"
 #include "IntSize.h"
 #include "KURL.h"
@@ -97,6 +98,10 @@
 #endif
     if (m_helperPlugin)
         closeHelperPlugin();
+#if USE(ACCELERATED_COMPOSITING)
+    if (m_videoLayer)
+        GraphicsLayerChromium::unregisterContentsLayer(m_videoLayer->layer());
+#endif
 }
 
 void WebMediaPlayerClientImpl::networkStateChanged()
@@ -113,6 +118,7 @@
     if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
         m_videoLayer = adoptPtr(WebVideoLayer::create(this));
         m_videoLayer->layer()->setOpaque(m_opaque);
+        GraphicsLayerChromium::registerContentsLayer(m_videoLayer->layer());
     }
 #endif
 }

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (127076 => 127077)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-08-30 01:23:52 UTC (rev 127076)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-08-30 01:34:14 UTC (rev 127077)
@@ -51,6 +51,7 @@
 #include "FrameView.h"
 #include "GestureEvent.h"
 #include "GraphicsContext.h"
+#include "GraphicsLayerChromium.h"
 #include "HitTestResult.h"
 #include "HostWindow.h"
 #include "HTMLFormElement.h"
@@ -368,8 +369,10 @@
 
     ASSERT(!m_ioSurfaceLayer);
 
-    if (!m_textureLayer)
+    if (!m_textureLayer) {
         m_textureLayer = adoptPtr(WebExternalTextureLayer::create());
+        GraphicsLayerChromium::registerContentsLayer(m_textureLayer->layer());
+    }
     m_textureLayer->setTextureId(textureId);
 
     // If anyone of the IDs is zero we need to switch between hardware
@@ -392,8 +395,10 @@
 
     ASSERT(!m_textureLayer);
 
-    if (!m_ioSurfaceLayer)
+    if (!m_ioSurfaceLayer) {
         m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create());
+        GraphicsLayerChromium::registerContentsLayer(m_ioSurfaceLayer->layer());
+    }
     m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
 
     // If anyone of the IDs is zero we need to switch between hardware
@@ -627,6 +632,13 @@
 
 WebPluginContainerImpl::~WebPluginContainerImpl()
 {
+#if USE(ACCELERATED_COMPOSITING)
+    if (m_textureLayer)
+        GraphicsLayerChromium::unregisterContentsLayer(m_textureLayer->layer());
+    if (m_ioSurfaceLayer)
+        GraphicsLayerChromium::unregisterContentsLayer(m_ioSurfaceLayer->layer());
+#endif
+
     if (m_isAcceptingTouchEvents)
         m_element->document()->didRemoveTouchEventHandler();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to