Title: [93647] trunk/Source/WebCore
Revision
93647
Author
[email protected]
Date
2011-08-23 16:01:08 -0700 (Tue, 23 Aug 2011)

Log Message

[chromium] Remove obsolete child context list from LayerRendererChromium
https://bugs.webkit.org/show_bug.cgi?id=66743

Patch by James Robinson <[email protected]> on 2011-08-23
Reviewed by Kenneth Russell.

Before we had proper semantics for flush() in the command buffer, we
used a scheme of latches across contexts to ensure consistent frames
were presented for WebGL and canvas. We no longer have latches and
flush is a proper synchronization primative, so the child context list
no longer does anything. Canvas2DLayerChromium and
WebGLLayerChromium's implementations of updateCompositorResources() do
flushes on the appropriate context already - canvas layers via
DrawingBuffer::publishToPlatformLayer(), and WebGL layers via the call
to prepareTexture().

No new tests since the code being removed doesn't do anything.

* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
(WebCore::Canvas2DLayerChromium::setDrawingBuffer):
* platform/graphics/chromium/Canvas2DLayerChromium.h:
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawLayers):
* platform/graphics/chromium/LayerRendererChromium.h:
* platform/graphics/chromium/WebGLLayerChromium.cpp:
(WebCore::WebGLLayerChromium::~WebGLLayerChromium):
(WebCore::WebGLLayerChromium::setContext):
* platform/graphics/chromium/WebGLLayerChromium.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93646 => 93647)


--- trunk/Source/WebCore/ChangeLog	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/ChangeLog	2011-08-23 23:01:08 UTC (rev 93647)
@@ -1,3 +1,34 @@
+2011-08-23  James Robinson  <[email protected]>
+
+        [chromium] Remove obsolete child context list from LayerRendererChromium
+        https://bugs.webkit.org/show_bug.cgi?id=66743
+
+        Reviewed by Kenneth Russell.
+
+        Before we had proper semantics for flush() in the command buffer, we
+        used a scheme of latches across contexts to ensure consistent frames
+        were presented for WebGL and canvas. We no longer have latches and
+        flush is a proper synchronization primative, so the child context list
+        no longer does anything. Canvas2DLayerChromium and
+        WebGLLayerChromium's implementations of updateCompositorResources() do
+        flushes on the appropriate context already - canvas layers via
+        DrawingBuffer::publishToPlatformLayer(), and WebGL layers via the call
+        to prepareTexture().
+
+        No new tests since the code being removed doesn't do anything.
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
+        (WebCore::Canvas2DLayerChromium::setDrawingBuffer):
+        * platform/graphics/chromium/Canvas2DLayerChromium.h:
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::drawLayers):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        * platform/graphics/chromium/WebGLLayerChromium.cpp:
+        (WebCore::WebGLLayerChromium::~WebGLLayerChromium):
+        (WebCore::WebGLLayerChromium::setContext):
+        * platform/graphics/chromium/WebGLLayerChromium.h:
+
 2011-08-23  Alexei Svitkine  <[email protected]>
 
         Chromium Mac: Use a custom pattern image for rubber banding overhang area

Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp (93646 => 93647)


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2011-08-23 23:01:08 UTC (rev 93647)
@@ -54,8 +54,6 @@
 
 Canvas2DLayerChromium::~Canvas2DLayerChromium()
 {
-    if (m_drawingBuffer && layerRenderer())
-        layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
 }
 
 bool Canvas2DLayerChromium::drawsContent() const
@@ -84,30 +82,8 @@
 
 void Canvas2DLayerChromium::setDrawingBuffer(DrawingBuffer* drawingBuffer)
 {
-    if (drawingBuffer != m_drawingBuffer) {
-        if (m_drawingBuffer && layerRenderer())
-            layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
-
-        m_drawingBuffer = drawingBuffer;
-
-        if (drawingBuffer && layerRenderer())
-            layerRenderer()->addChildContext(m_drawingBuffer->graphicsContext3D().get());
-    }
+    m_drawingBuffer = drawingBuffer;
 }
 
-void Canvas2DLayerChromium::setLayerRenderer(LayerRendererChromium* newLayerRenderer)
-{
-    if (layerRenderer() != newLayerRenderer && m_drawingBuffer) {
-        if (m_drawingBuffer->graphicsContext3D()) {
-            if (layerRenderer())
-                layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
-            if (newLayerRenderer)
-                newLayerRenderer->addChildContext(m_drawingBuffer->graphicsContext3D().get());
-        }
-
-        LayerChromium::setLayerRenderer(newLayerRenderer);
-    }
 }
-
-}
 #endif // USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h (93646 => 93647)


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h	2011-08-23 23:01:08 UTC (rev 93647)
@@ -52,8 +52,6 @@
     virtual unsigned textureId() const;
     void setDrawingBuffer(DrawingBuffer*);
 
-    virtual void setLayerRenderer(LayerRendererChromium*);
-
 private:
     explicit Canvas2DLayerChromium(DrawingBuffer*, GraphicsLayerChromium* owner);
     DrawingBuffer* m_drawingBuffer;

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


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-08-23 23:01:08 UTC (rev 93647)
@@ -568,12 +568,6 @@
     if (!rootLayer())
         return;
 
-    // Before drawLayers:
-    ChildContextMap::iterator i = m_childContexts.begin();
-    for (; i != m_childContexts.end(); ++i) {
-        i->first->flush();
-    }
-
     {
         TRACE_EVENT("LayerRendererChromium::synchronizeTrees", this, 0);
         m_rootCCLayerImpl = TreeSynchronizer::synchronizeTrees(rootLayer()->platformLayer(), m_rootCCLayerImpl.get());
@@ -1297,43 +1291,6 @@
         dumpRenderSurfaces(ts, indent, layer->children()[i].get());
 }
 
-
-void LayerRendererChromium::addChildContext(GraphicsContext3D* ctx)
-{
-    // This is a ref-counting map, because some contexts are shared by multiple
-    // layers (specifically, Canvas2DLayerChromium).
-
-    // Insert the ctx with a count of 1, or return the existing iterator.
-    std::pair<ChildContextMap::iterator, bool> insert_result = m_childContexts.add(ctx, 1);
-    if (!insert_result.second) {
-        // Already present in map, so increment.
-        ++insert_result.first->second;
-    } else {
-// FIXME(jbates): when compositor is multithreaded and copyTexImage2D bug is fixed,
-// uncomment this block:
-//      // This is a new child context - set the parentToChild latch so that it
-//      // can continue past its first wait latch.
-//      Extensions3DChromium* ext = static_cast<Extensions3DChromium*>(ctx->getExtensions());
-//      GC3Duint latchId;
-//      ext->getParentToChildLatchCHROMIUM(&latchId);
-//      ext->setLatchCHROMIUM(0, latchId);
-    }
-}
-
-void LayerRendererChromium::removeChildContext(GraphicsContext3D* ctx)
-{
-    ChildContextMap::iterator i = m_childContexts.find(ctx);
-    if (i != m_childContexts.end()) {
-        if (--i->second <= 0) {
-            // Count reached zero, so remove from map.
-            m_childContexts.remove(i);
-        }
-    } else {
-        // error
-        ASSERT(0 && "m_childContexts map has mismatched add/remove calls");
-    }
-}
-
 bool LayerRendererChromium::isCompositorContextLost()
 {
     return (m_context.get()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR);

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (93646 => 93647)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-08-23 23:01:08 UTC (rev 93647)
@@ -143,9 +143,6 @@
 
     String layerTreeAsText() const;
 
-    void addChildContext(GraphicsContext3D*);
-    void removeChildContext(GraphicsContext3D*);
-
     // Return true if the compositor context has an error.
     bool isCompositorContextLost();
 
@@ -159,8 +156,6 @@
     typedef Vector<RefPtr<CCLayerImpl> > CCLayerList;
 
 private:
-    typedef HashMap<GraphicsContext3D*, int> ChildContextMap;
-
     // FIXME: This needs to be moved to the CCLayerTreeHostImpl when that class exists.
     RefPtr<CCLayerImpl> m_rootCCLayerImpl;
 
@@ -237,8 +232,6 @@
     OwnPtr<GrContext> m_skiaContext;
 #endif
 
-    ChildContextMap m_childContexts;
-
     bool m_contextSupportsMapSub;
 
     CCRenderSurface* m_defaultRenderSurface;

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


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2011-08-23 23:01:08 UTC (rev 93647)
@@ -59,8 +59,6 @@
 
 WebGLLayerChromium::~WebGLLayerChromium()
 {
-    if (m_context && layerRenderer())
-        layerRenderer()->removeChildContext(m_context);
 }
 
 bool WebGLLayerChromium::drawsContent() const
@@ -129,12 +127,6 @@
 void WebGLLayerChromium::setContext(const GraphicsContext3D* context)
 {
     bool contextChanged = (m_context != context);
-    if (contextChanged && layerRenderer()) {
-        if (m_context)
-            layerRenderer()->removeChildContext(m_context);
-        if (context)
-            layerRenderer()->addChildContext(const_cast<GraphicsContext3D*>(context));
-    }
 
     m_context = const_cast<GraphicsContext3D*>(context);
 
@@ -153,20 +145,6 @@
     m_contextSupportsRateLimitingExtension = m_context->getExtensions()->supports("GL_CHROMIUM_rate_limit_offscreen_context");
 }
 
-void WebGLLayerChromium::setLayerRenderer(LayerRendererChromium* newLayerRenderer)
-{
-    if (layerRenderer() != newLayerRenderer) {
-        if (m_context) {
-            if (layerRenderer())
-                layerRenderer()->removeChildContext(m_context);
-            if (newLayerRenderer)
-                newLayerRenderer->addChildContext(m_context);
-        }
-
-        LayerChromium::setLayerRenderer(newLayerRenderer);
-    }
-}
-
 void WebGLLayerChromium::rateLimitContext(Timer<WebGLLayerChromium>*)
 {
     TRACE_EVENT("WebGLLayerChromium::rateLimitContext", this, 0);

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


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2011-08-23 23:01:06 UTC (rev 93646)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2011-08-23 23:01:08 UTC (rev 93647)
@@ -57,8 +57,6 @@
     void setContext(const GraphicsContext3D* context);
     GraphicsContext3D* context() { return m_context; }
 
-    virtual void setLayerRenderer(LayerRendererChromium*);
-
 protected:
     virtual const char* layerTypeAsString() const { return "WebGLLayer"; }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to