Title: [94431] trunk/Source
Revision
94431
Author
[email protected]
Date
2011-09-02 10:36:00 -0700 (Fri, 02 Sep 2011)

Log Message

[chromium] Remove LayerRendererChromium references from the LayerChromium tree
https://bugs.webkit.org/show_bug.cgi?id=66430

Reviewed by James Robinson.

Source/WebCore:

Covered by existing tests.

Replace references to LayerRendererChromium in the LayerChromium tree
with references to LayerTreeHost. The LayerRendererChromium property
is no longer synced and instead is set recursively on the CCLayerImpl
tree during commit.

WebGLLayerChromium's paintRenderedResultsToCanvas function is
temporarily turned off for threaded compositing because it needs
access to the compositor context.

Previously, changing the layer renderer on a layer called cleanup
resources on that layer.  Now, call that explicitly clean up all
resources explicitly from the proxy when the layer renderer gets
created. This cleans up all of the ManagedTexture objects which may be
hanging onto stale GraphicsContext3D pointers.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::cleanupResourcesRecursive):
(WebCore::LayerChromium::setLayerTreeHost):
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::layerTreeHost):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawLayers):
(WebCore::LayerRendererChromium::paintLayerContents):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
* platform/graphics/chromium/RenderSurfaceChromium.h:
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::TiledLayerChromium):
(WebCore::TiledLayerChromium::updateTileSizeAndTilingOption):
(WebCore::TiledLayerChromium::setLayerTreeHost):
(WebCore::TiledLayerChromium::textureManager):
* platform/graphics/chromium/TiledLayerChromium.h:
* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::VideoLayerChromium):
(WebCore::VideoLayerChromium::cleanupResources):
(WebCore::VideoLayerChromium::setLayerTreeHost):
(WebCore::VideoLayerChromium::reserveTextures):
* platform/graphics/chromium/VideoLayerChromium.h:
* platform/graphics/chromium/WebGLLayerChromium.cpp:
(WebCore::WebGLLayerChromium::paintRenderedResultsToCanvas):
(WebCore::WebGLLayerChromium::setTextureUpdated):
(WebCore::WebGLLayerChromium::layerRendererContext):
* platform/graphics/chromium/WebGLLayerChromium.h:
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::setLayerRendererRecursive):
* platform/graphics/chromium/cc/CCLayerImpl.h:
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::commitTo):
(WebCore::CCLayerTreeHost::didRecreateGraphicsContext):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):

Source/WebKit/chromium:

Change references to LayerRendererChromium to CCLayerTreeHost.

* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94430 => 94431)


--- trunk/Source/WebCore/ChangeLog	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/ChangeLog	2011-09-02 17:36:00 UTC (rev 94431)
@@ -1,3 +1,64 @@
+2011-09-02  Adrienne Walker  <[email protected]>
+
+        [chromium] Remove LayerRendererChromium references from the LayerChromium tree
+        https://bugs.webkit.org/show_bug.cgi?id=66430
+
+        Reviewed by James Robinson.
+
+        Covered by existing tests.
+
+        Replace references to LayerRendererChromium in the LayerChromium tree
+        with references to LayerTreeHost. The LayerRendererChromium property
+        is no longer synced and instead is set recursively on the CCLayerImpl
+        tree during commit.
+
+        WebGLLayerChromium's paintRenderedResultsToCanvas function is
+        temporarily turned off for threaded compositing because it needs
+        access to the compositor context.
+
+        Previously, changing the layer renderer on a layer called cleanup
+        resources on that layer.  Now, call that explicitly clean up all
+        resources explicitly from the proxy when the layer renderer gets
+        created. This cleans up all of the ManagedTexture objects which may be
+        hanging onto stale GraphicsContext3D pointers.
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::cleanupResourcesRecursive):
+        (WebCore::LayerChromium::setLayerTreeHost):
+        (WebCore::LayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::layerTreeHost):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::drawLayers):
+        (WebCore::LayerRendererChromium::paintLayerContents):
+        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
+        * platform/graphics/chromium/RenderSurfaceChromium.h:
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::TiledLayerChromium::TiledLayerChromium):
+        (WebCore::TiledLayerChromium::updateTileSizeAndTilingOption):
+        (WebCore::TiledLayerChromium::setLayerTreeHost):
+        (WebCore::TiledLayerChromium::textureManager):
+        * platform/graphics/chromium/TiledLayerChromium.h:
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::VideoLayerChromium):
+        (WebCore::VideoLayerChromium::cleanupResources):
+        (WebCore::VideoLayerChromium::setLayerTreeHost):
+        (WebCore::VideoLayerChromium::reserveTextures):
+        * platform/graphics/chromium/VideoLayerChromium.h:
+        * platform/graphics/chromium/WebGLLayerChromium.cpp:
+        (WebCore::WebGLLayerChromium::paintRenderedResultsToCanvas):
+        (WebCore::WebGLLayerChromium::setTextureUpdated):
+        (WebCore::WebGLLayerChromium::layerRendererContext):
+        * platform/graphics/chromium/WebGLLayerChromium.h:
+        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+        (WebCore::CCLayerImpl::setLayerRendererRecursive):
+        * platform/graphics/chromium/cc/CCLayerImpl.h:
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::commitTo):
+        (WebCore::CCLayerTreeHost::didRecreateGraphicsContext):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
+
 2011-09-02  Alexey Proskuryakov  <[email protected]>
 
         Build fix.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -96,38 +96,31 @@
 {
 }
 
-void LayerChromium::setLayerRendererRecursive(LayerRendererChromium* renderer)
+void LayerChromium::cleanupResourcesRecursive()
 {
     for (size_t i = 0; i < children().size(); ++i)
-        children()[i]->setLayerRendererRecursive(renderer);
+        children()[i]->cleanupResourcesRecursive();
 
     if (maskLayer())
-        maskLayer()->setLayerRendererRecursive(renderer);
+        maskLayer()->cleanupResourcesRecursive();
     if (replicaLayer())
-        replicaLayer()->setLayerRendererRecursive(renderer);
+        replicaLayer()->cleanupResourcesRecursive();
 
-    setLayerRenderer(renderer);
+    cleanupResources();
 }
 
-void LayerChromium::setLayerRenderer(LayerRendererChromium* renderer)
+void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
 {
     // If we're changing layer renderers then we need to free up any resources
     // allocated by the old renderer.
-    if (layerRenderer() && layerRenderer() != renderer) {
+    if (layerTreeHost() && layerTreeHost() != host) {
         cleanupResources();
         setNeedsDisplay();
     }
-    m_layerRenderer = renderer;
 
-    // FIXME: Once setLayerRenderer is no longer needed on the LayerChromium
-    // tree, move this call to LayerRendererChromium::paintLayerContents.
-    setLayerTreeHost(renderer->owner());
+    m_layerTreeHost = host;
 }
 
-void LayerChromium::setLayerTreeHost(CCLayerTreeHost*)
-{
-}
-
 void LayerChromium::setNeedsCommit()
 {
     // Call notifySyncRequired(), which for non-root layers plumbs through to
@@ -332,7 +325,6 @@
     layer->setDoubleSided(m_doubleSided);
     layer->setDrawsContent(drawsContent());
     layer->setIsRootLayer(m_isRootLayer);
-    layer->setLayerRenderer(m_layerRenderer.get());
     layer->setMasksToBounds(m_masksToBounds);
     layer->setName(m_name);
     layer->setOpacity(m_opacity);
@@ -349,12 +341,6 @@
         replicaLayer()->pushPropertiesTo(layer->replicaLayer());
 }
 
-GraphicsContext3D* LayerChromium::layerRendererContext() const
-{
-    ASSERT(layerRenderer());
-    return layerRenderer()->context();
-}
-
 void LayerChromium::drawTexturedQuad(GraphicsContext3D* context, const TransformationMatrix& projectionMatrix, const TransformationMatrix& drawMatrix,
                                      float width, float height, float opacity,
                                      int matrixLocation, int alphaLocation)
@@ -436,11 +422,6 @@
     setNeedsCommit();
 }
 
-LayerRendererChromium* LayerChromium::layerRenderer() const
-{
-    return m_layerRenderer.get();
-}
-
 void LayerChromium::createRenderSurface()
 {
     ASSERT(!m_renderSurface);

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -55,7 +55,6 @@
 class CCLayerImpl;
 class CCLayerTreeHost;
 class GraphicsContext3D;
-class LayerRendererChromium;
 
 // Base class for composited layers. Special layer types are derived from
 // this class.
@@ -153,13 +152,6 @@
     void setIsRootLayer(bool isRootLayer) { m_isRootLayer = isRootLayer; }
     bool isRootLayer() const { return m_isRootLayer; }
 
-    void setLayerRendererRecursive(LayerRendererChromium*);
-
-    // Derived types must override this method if they need to react to a change
-    // in the LayerRendererChromium.
-    // FIXME, replace with CCLayerTreeHost.
-    virtual void setLayerRenderer(LayerRendererChromium*);
-
     virtual void setLayerTreeHost(CCLayerTreeHost*);
 
     void setOwner(GraphicsLayerChromium* owner) { m_owner = owner; }
@@ -190,10 +182,6 @@
 
     virtual void pushPropertiesTo(CCLayerImpl*);
 
-    // Begin calls that forward to the CCLayerImpl.
-    LayerRendererChromium* layerRenderer() const;
-    // End calls that forward to the CCLayerImpl.
-
     typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> BorderProgram;
 
     int id() const { return m_layerId; }
@@ -218,6 +206,9 @@
     // Returns true if any of the layer's descendants has content to draw.
     bool descendantDrawsContent();
 
+    CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
+    virtual void cleanupResourcesRecursive();
+
 protected:
     GraphicsLayerChromium* m_owner;
     explicit LayerChromium(GraphicsLayerChromium* owner);
@@ -227,8 +218,6 @@
     // hold context-dependent resources such as textures.
     virtual void cleanupResources();
 
-    GraphicsContext3D* layerRendererContext() const;
-
     static void toGLMatrix(float*, const TransformationMatrix&);
 
     void dumpLayer(TextStream&, int indent) const;
@@ -267,7 +256,7 @@
     Vector<RefPtr<LayerChromium> > m_children;
     LayerChromium* m_parent;
 
-    RefPtr<LayerRendererChromium> m_layerRenderer;
+    RefPtr<CCLayerTreeHost> m_layerTreeHost;
 
     // Layer properties.
     IntSize m_bounds;

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -575,9 +575,12 @@
 
 void LayerRendererChromium::drawLayers()
 {
-    if (!rootLayer())
+    if (!rootLayerImpl())
         return;
 
+    // FIXME: No need to walk the tree here. This could be passed via draw.
+    rootLayerImpl()->setLayerRendererRecursive(this);
+
     m_renderSurfaceTextureManager->setMemoryLimitBytes(textureMemoryHighLimitBytes - m_contentsTextureManager->currentMemoryUseBytes());
     drawLayersInternal();
 
@@ -654,10 +657,7 @@
         RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
         ASSERT(renderSurface);
 
-        // Make sure any renderSurfaceLayer is associated with this layerRenderer.
-        // This is a defensive assignment in case the owner of this layer hasn't
-        // set the layerRenderer on this layer already.
-        renderSurfaceLayer->setLayerRenderer(this);
+        renderSurfaceLayer->setLayerTreeHost(owner());
 
         // Render surfaces whose drawable area has zero width or height
         // will have no layers associated with them and should be skipped.
@@ -677,17 +677,17 @@
             if (layer->renderSurface() && layer->renderSurface() != renderSurface)
                 continue;
 
-            layer->setLayerRenderer(this);
+            layer->setLayerTreeHost(owner());
 
             if (!layer->opacity())
                 continue;
 
             if (layer->maskLayer())
-                layer->maskLayer()->setLayerRenderer(this);
+                layer->maskLayer()->setLayerTreeHost(owner());
             if (layer->replicaLayer()) {
-                layer->replicaLayer()->setLayerRenderer(this);
+                layer->replicaLayer()->setLayerTreeHost(owner());
                 if (layer->replicaLayer()->maskLayer())
-                    layer->replicaLayer()->maskLayer()->setLayerRenderer(this);
+                    layer->replicaLayer()->maskLayer()->setLayerTreeHost(owner());
             }
 
             if (layer->bounds().isEmpty())

Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -48,12 +48,6 @@
 {
 }
 
-LayerRendererChromium* RenderSurfaceChromium::layerRenderer()
-{
-    ASSERT(m_owningLayer);
-    return m_owningLayer->layerRenderer();
-}
-
 FloatRect RenderSurfaceChromium::drawableContentRect() const
 {
     FloatRect localContentRect(-0.5 * m_contentRect.width(), -0.5 * m_contentRect.height(),

Modified: trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -87,8 +87,6 @@
     void setMaskLayer(LayerChromium* maskLayer) { m_maskLayer = maskLayer; }
 
 private:
-    LayerRendererChromium* layerRenderer();
-
     LayerChromium* m_owningLayer;
     LayerChromium* m_maskLayer;
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -65,7 +65,6 @@
 
 TiledLayerChromium::TiledLayerChromium(GraphicsLayerChromium* owner)
     : LayerChromium(owner)
-    , m_layerTreeHost(0)
     , m_tilingOption(AutoTile)
     , m_textureFormat(GraphicsContext3D::INVALID_ENUM)
     , m_skipsDraw(false)
@@ -116,7 +115,7 @@
         isTiled = autoTiled;
 
     IntSize requestedSize = isTiled ? tileSize : contentBounds();
-    const int maxSize = m_layerTreeHost->layerRendererCapabilities().maxTextureSize;
+    const int maxSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize;
     IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize));
     m_tiler->setTileSize(clampedSize);
 }
@@ -138,7 +137,7 @@
 void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
 {
     LayerChromium::setLayerTreeHost(host);
-    m_layerTreeHost = host;
+
     if (m_tiler)
         return;
 
@@ -281,9 +280,9 @@
 
 TextureManager* TiledLayerChromium::textureManager() const
 {
-    if (!layerRenderer())
+    if (!layerTreeHost())
         return 0;
-    return layerRenderer()->contentsTextureManager();
+    return layerTreeHost()->contentsTextureManager();
 }
 
 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const

Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -88,8 +88,6 @@
 
     TextureManager* textureManager() const;
 
-    CCLayerTreeHost* m_layerTreeHost;
-
     // State held between update and upload.
     IntRect m_paintRect;
     IntRect m_updateRect;

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -56,7 +56,6 @@
     , m_skipsDraw(true)
     , m_frameFormat(VideoFrameChromium::Invalid)
     , m_provider(provider)
-    , m_layerTreeHost(0)
     , m_currentFrame(0)
 {
 }
@@ -74,6 +73,8 @@
 void VideoLayerChromium::cleanupResources()
 {
     LayerChromium::cleanupResources();
+    for (size_t i = 0; i < 3; ++i)
+        m_textures[i].m_texture.clear();
     releaseCurrentFrame();
 }
 
@@ -145,18 +146,16 @@
     }
 }
 
-void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* layerTreeHost)
+void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
 {
-    LayerChromium::setLayerTreeHost(layerTreeHost);
-    if (m_layerTreeHost == layerTreeHost)
-        return;
-
-    m_layerTreeHost = layerTreeHost;
-
-    for (size_t i = 0; i < 3; ++i) {
-        m_textures[i].m_visibleSize = IntSize();
-        m_textures[i].m_texture = ManagedTexture::create(layerTreeHost->contentsTextureManager());
+    if (layerTreeHost() != host) {
+        for (size_t i = 0; i < 3; ++i) {
+            m_textures[i].m_visibleSize = IntSize();
+            m_textures[i].m_texture = ManagedTexture::create(host->contentsTextureManager());
+        }
     }
+
+    LayerChromium::setLayerTreeHost(host);
 }
 
 GC3Denum VideoLayerChromium::determineTextureFormat(const VideoFrameChromium* frame)
@@ -175,11 +174,11 @@
 
 bool VideoLayerChromium::reserveTextures(const VideoFrameChromium* frame, GC3Denum textureFormat)
 {
-    ASSERT(m_layerTreeHost);
+    ASSERT(layerTreeHost());
     ASSERT(frame);
     ASSERT(textureFormat != GraphicsContext3D::INVALID_VALUE);
 
-    int maxTextureSize = m_layerTreeHost->layerRendererCapabilities().maxTextureSize;
+    int maxTextureSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize;
 
     for (unsigned plane = 0; plane < frame->planes(); plane++) {
         IntSize requiredTextureSize = frame->requiredTextureSize(plane);

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -83,7 +83,6 @@
     bool m_skipsDraw;
     VideoFrameChromium::Format m_frameFormat;
     VideoFrameProvider* m_provider;
-    CCLayerTreeHost* m_layerTreeHost;
 
     Texture m_textures[3];
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -97,7 +97,7 @@
 
 bool WebGLLayerChromium::paintRenderedResultsToCanvas(ImageBuffer* imageBuffer)
 {
-    if (m_textureUpdated || !layerRenderer() || !drawsContent())
+    if (m_textureUpdated || !layerRendererContext() || !drawsContent())
         return false;
 
     IntSize framebufferSize = m_context->getInternalFramebufferSize();
@@ -119,7 +119,7 @@
     m_textureUpdated = true;
     // If WebGL commands are issued outside of a the animation callbacks, then use
     // call rateLimitOffscreenContextCHROMIUM() to keep the context from getting too far ahead.
-    if (layerRenderer() && !layerRenderer()->owner()->animating() && m_contextSupportsRateLimitingExtension && !m_rateLimitingTimer.isActive())
+    if (layerTreeHost() && !layerTreeHost()->animating() && m_contextSupportsRateLimitingExtension && !m_rateLimitingTimer.isActive())
         m_rateLimitingTimer.startOneShot(0);
 }
 
@@ -144,6 +144,15 @@
     m_contextSupportsRateLimitingExtension = m_context->getExtensions()->supports("GL_CHROMIUM_rate_limit_offscreen_context");
 }
 
+GraphicsContext3D* WebGLLayerChromium::layerRendererContext()
+{
+    // FIXME: In the threaded case, paintRenderedResultsToCanvas must be
+    // refactored to be asynchronous. Currently this is unimplemented.
+    if (!layerTreeHost() || layerTreeHost()->settings().enableCompositorThread)
+        return 0;
+    return layerTreeHost()->context();
+}
+
 void WebGLLayerChromium::rateLimitContext(Timer<WebGLLayerChromium>*)
 {
     TRACE_EVENT("WebGLLayerChromium::rateLimitContext", this, 0);

Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -64,6 +64,8 @@
     explicit WebGLLayerChromium(GraphicsLayerChromium* owner);
     friend class WebGLLayerChromiumRateLimitTask;
 
+    GraphicsContext3D* layerRendererContext();
+
     void rateLimitContext(Timer<WebGLLayerChromium>*);
 
     // GraphicsContext3D::platformLayer has a side-effect of assigning itself

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -119,6 +119,19 @@
     m_layerRenderer = renderer;
 }
 
+void CCLayerImpl::setLayerRendererRecursive(LayerRendererChromium* renderer)
+{
+    for (size_t i = 0; i < children().size(); ++i)
+        children()[i]->setLayerRendererRecursive(renderer);
+
+    if (maskLayer())
+        maskLayer()->setLayerRendererRecursive(renderer);
+    if (replicaLayer())
+        replicaLayer()->setLayerRendererRecursive(renderer);
+
+    setLayerRenderer(renderer);
+}
+
 void CCLayerImpl::createRenderSurface()
 {
     ASSERT(!m_renderSurface);

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2011-09-02 17:36:00 UTC (rev 94431)
@@ -124,6 +124,7 @@
     void drawDebugBorder();
 
     void setLayerRenderer(LayerRendererChromium*);
+    void setLayerRendererRecursive(LayerRendererChromium*);
     LayerRendererChromium* layerRenderer() const { return m_layerRenderer.get(); }
 
     CCRenderSurface* renderSurface() const { return m_renderSurface.get(); }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -114,14 +114,9 @@
     hostImpl->setSourceFrameNumber(frameNumber());
 
     // Synchronize trees, if one exists at all...
-    if (rootLayer()) {
-        // The layerRenderer needs to be set so that child layers pick up the layerRenderer
-        // as well during the synchronize step.
-        if (rootLayer()->platformLayer()->layerRenderer() != hostImpl->layerRenderer())
-            rootLayer()->platformLayer()->setLayerRendererRecursive(hostImpl->layerRenderer());
-
+    if (rootLayer())
         hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer()->platformLayer(), hostImpl->rootLayer()));
-    } else
+    else
         hostImpl->setRootLayer(0);
 
     m_frameNumber++;
@@ -144,6 +139,8 @@
 
 void CCLayerTreeHost::didRecreateGraphicsContext(bool success)
 {
+    if (rootLayer())
+        rootLayer()->platformLayer()->cleanupResourcesRecursive();
     m_client->didRecreateGraphicsContext(success);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (94430 => 94431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -143,10 +143,6 @@
             layerRenderer = LayerRendererChromium::create(m_layerRenderer->owner(), this, context);
     }
 
-    // If recreating renderer, update the layers to point at the new renderer
-    if (m_layerRenderer)
-        m_layerRenderer->rootLayer()->platformLayer()->setLayerRendererRecursive(layerRenderer.get());
-
     m_layerRenderer = layerRenderer;
     return m_layerRenderer;
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (94430 => 94431)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-02 17:36:00 UTC (rev 94431)
@@ -1,3 +1,15 @@
+2011-09-02  Adrienne Walker  <[email protected]>
+
+        [chromium] Remove LayerRendererChromium references from the LayerChromium tree
+        https://bugs.webkit.org/show_bug.cgi?id=66430
+
+        Reviewed by James Robinson.
+
+        Change references to LayerRendererChromium to CCLayerTreeHost.
+
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+
 2011-09-01  Robert Kroeger  <[email protected]>
 
  

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (94430 => 94431)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2011-09-02 17:33:10 UTC (rev 94430)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2011-09-02 17:36:00 UTC (rev 94431)
@@ -572,7 +572,7 @@
 
 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
 {
-    return m_videoLayer.get() && m_videoLayer->layerRenderer();
+    return m_videoLayer.get() && m_videoLayer->layerTreeHost();
 }
 
 VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to