Changeset 93647 in webkit


Ignore:
Timestamp:
Aug 23, 2011 4:01:08 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by James Robinson <jamesr@chromium.org> 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:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93645 r93647  
     12011-08-23  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Remove obsolete child context list from LayerRendererChromium
     4        https://bugs.webkit.org/show_bug.cgi?id=66743
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Before we had proper semantics for flush() in the command buffer, we
     9        used a scheme of latches across contexts to ensure consistent frames
     10        were presented for WebGL and canvas. We no longer have latches and
     11        flush is a proper synchronization primative, so the child context list
     12        no longer does anything. Canvas2DLayerChromium and
     13        WebGLLayerChromium's implementations of updateCompositorResources() do
     14        flushes on the appropriate context already - canvas layers via
     15        DrawingBuffer::publishToPlatformLayer(), and WebGL layers via the call
     16        to prepareTexture().
     17
     18        No new tests since the code being removed doesn't do anything.
     19
     20        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
     21        (WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
     22        (WebCore::Canvas2DLayerChromium::setDrawingBuffer):
     23        * platform/graphics/chromium/Canvas2DLayerChromium.h:
     24        * platform/graphics/chromium/LayerRendererChromium.cpp:
     25        (WebCore::LayerRendererChromium::drawLayers):
     26        * platform/graphics/chromium/LayerRendererChromium.h:
     27        * platform/graphics/chromium/WebGLLayerChromium.cpp:
     28        (WebCore::WebGLLayerChromium::~WebGLLayerChromium):
     29        (WebCore::WebGLLayerChromium::setContext):
     30        * platform/graphics/chromium/WebGLLayerChromium.h:
     31
    1322011-08-23  Alexei Svitkine  <asvitkine@chromium.org>
    233
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp

    r93438 r93647  
    5555Canvas2DLayerChromium::~Canvas2DLayerChromium()
    5656{
    57     if (m_drawingBuffer && layerRenderer())
    58         layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
    5957}
    6058
     
    8583void Canvas2DLayerChromium::setDrawingBuffer(DrawingBuffer* drawingBuffer)
    8684{
    87     if (drawingBuffer != m_drawingBuffer) {
    88         if (m_drawingBuffer && layerRenderer())
    89             layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
    90 
    91         m_drawingBuffer = drawingBuffer;
    92 
    93         if (drawingBuffer && layerRenderer())
    94             layerRenderer()->addChildContext(m_drawingBuffer->graphicsContext3D().get());
    95     }
    96 }
    97 
    98 void Canvas2DLayerChromium::setLayerRenderer(LayerRendererChromium* newLayerRenderer)
    99 {
    100     if (layerRenderer() != newLayerRenderer && m_drawingBuffer) {
    101         if (m_drawingBuffer->graphicsContext3D()) {
    102             if (layerRenderer())
    103                 layerRenderer()->removeChildContext(m_drawingBuffer->graphicsContext3D().get());
    104             if (newLayerRenderer)
    105                 newLayerRenderer->addChildContext(m_drawingBuffer->graphicsContext3D().get());
    106         }
    107 
    108         LayerChromium::setLayerRenderer(newLayerRenderer);
    109     }
     85    m_drawingBuffer = drawingBuffer;
    11086}
    11187
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h

    r93438 r93647  
    5353    void setDrawingBuffer(DrawingBuffer*);
    5454
    55     virtual void setLayerRenderer(LayerRendererChromium*);
    56 
    5755private:
    5856    explicit Canvas2DLayerChromium(DrawingBuffer*, GraphicsLayerChromium* owner);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r93615 r93647  
    569569        return;
    570570
    571     // Before drawLayers:
    572     ChildContextMap::iterator i = m_childContexts.begin();
    573     for (; i != m_childContexts.end(); ++i) {
    574         i->first->flush();
    575     }
    576 
    577571    {
    578572        TRACE_EVENT("LayerRendererChromium::synchronizeTrees", this, 0);
     
    12981292}
    12991293
    1300 
    1301 void LayerRendererChromium::addChildContext(GraphicsContext3D* ctx)
    1302 {
    1303     // This is a ref-counting map, because some contexts are shared by multiple
    1304     // layers (specifically, Canvas2DLayerChromium).
    1305 
    1306     // Insert the ctx with a count of 1, or return the existing iterator.
    1307     std::pair<ChildContextMap::iterator, bool> insert_result = m_childContexts.add(ctx, 1);
    1308     if (!insert_result.second) {
    1309         // Already present in map, so increment.
    1310         ++insert_result.first->second;
    1311     } else {
    1312 // FIXME(jbates): when compositor is multithreaded and copyTexImage2D bug is fixed,
    1313 // uncomment this block:
    1314 //      // This is a new child context - set the parentToChild latch so that it
    1315 //      // can continue past its first wait latch.
    1316 //      Extensions3DChromium* ext = static_cast<Extensions3DChromium*>(ctx->getExtensions());
    1317 //      GC3Duint latchId;
    1318 //      ext->getParentToChildLatchCHROMIUM(&latchId);
    1319 //      ext->setLatchCHROMIUM(0, latchId);
    1320     }
    1321 }
    1322 
    1323 void LayerRendererChromium::removeChildContext(GraphicsContext3D* ctx)
    1324 {
    1325     ChildContextMap::iterator i = m_childContexts.find(ctx);
    1326     if (i != m_childContexts.end()) {
    1327         if (--i->second <= 0) {
    1328             // Count reached zero, so remove from map.
    1329             m_childContexts.remove(i);
    1330         }
    1331     } else {
    1332         // error
    1333         ASSERT(0 && "m_childContexts map has mismatched add/remove calls");
    1334     }
    1335 }
    1336 
    13371294bool LayerRendererChromium::isCompositorContextLost()
    13381295{
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r93571 r93647  
    144144    String layerTreeAsText() const;
    145145
    146     void addChildContext(GraphicsContext3D*);
    147     void removeChildContext(GraphicsContext3D*);
    148 
    149146    // Return true if the compositor context has an error.
    150147    bool isCompositorContextLost();
     
    160157
    161158private:
    162     typedef HashMap<GraphicsContext3D*, int> ChildContextMap;
    163 
    164159    // FIXME: This needs to be moved to the CCLayerTreeHostImpl when that class exists.
    165160    RefPtr<CCLayerImpl> m_rootCCLayerImpl;
     
    238233#endif
    239234
    240     ChildContextMap m_childContexts;
    241 
    242235    bool m_contextSupportsMapSub;
    243236
  • trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp

    r93438 r93647  
    6060WebGLLayerChromium::~WebGLLayerChromium()
    6161{
    62     if (m_context && layerRenderer())
    63         layerRenderer()->removeChildContext(m_context);
    6462}
    6563
     
    130128{
    131129    bool contextChanged = (m_context != context);
    132     if (contextChanged && layerRenderer()) {
    133         if (m_context)
    134             layerRenderer()->removeChildContext(m_context);
    135         if (context)
    136             layerRenderer()->addChildContext(const_cast<GraphicsContext3D*>(context));
    137     }
    138130
    139131    m_context = const_cast<GraphicsContext3D*>(context);
     
    154146}
    155147
    156 void WebGLLayerChromium::setLayerRenderer(LayerRendererChromium* newLayerRenderer)
    157 {
    158     if (layerRenderer() != newLayerRenderer) {
    159         if (m_context) {
    160             if (layerRenderer())
    161                 layerRenderer()->removeChildContext(m_context);
    162             if (newLayerRenderer)
    163                 newLayerRenderer->addChildContext(m_context);
    164         }
    165 
    166         LayerChromium::setLayerRenderer(newLayerRenderer);
    167     }
    168 }
    169 
    170148void WebGLLayerChromium::rateLimitContext(Timer<WebGLLayerChromium>*)
    171149{
  • trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h

    r93438 r93647  
    5858    GraphicsContext3D* context() { return m_context; }
    5959
    60     virtual void setLayerRenderer(LayerRendererChromium*);
    61 
    6260protected:
    6361    virtual const char* layerTypeAsString() const { return "WebGLLayer"; }
Note: See TracChangeset for help on using the changeset viewer.