[chromium] Register/unregister contents layers with GraphicsLayerChromium
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Aug 2012 01:34:14 +0000 (01:34 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Aug 2012 01:34:14 +0000 (01:34 +0000)
commit57559e6881a7913d5fb32b06523ad6b7934ed908
tree01084326250a7fbaa46c1924ee084e7cd18d55a0
parentac3ef79340f13d8f7b812bd66f6241349e75f751
[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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/fast/canvas/transformed-canvas-reset-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/transformed-canvas-reset.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp