Changeset 109469 in webkit


Ignore:
Timestamp:
Mar 1, 2012 5:14:16 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] LayerChromium::contentChanged is redundant with setNeedsDisplay
https://bugs.webkit.org/show_bug.cgi?id=79708

Reviewed by Adrienne Walker.

Some layer types need special handling when they receive damage. WebGL layers need to know if their texture is
updated for clear-on-swap behavior and both WebGL and canvas 2d layers have rate limiting mechanisms tied to
receiving invalidations. This mechanism was implemented by LayerChromium::contentChanged(), but this is
redundant with setNeedsDisplay().

Covered by existing tests.

  • platform/graphics/chromium/Canvas2DLayerChromium.cpp:

(WebCore::Canvas2DLayerChromium::setNeedsDisplay):

  • platform/graphics/chromium/Canvas2DLayerChromium.h:

(Canvas2DLayerChromium):

  • platform/graphics/chromium/GraphicsLayerChromium.cpp:

(WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):

  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::setNeedsDisplay):

  • platform/graphics/chromium/LayerChromium.h:

(LayerChromium):

  • platform/graphics/chromium/VideoLayerChromium.cpp:

(WebCore::VideoLayerChromium::setNeedsDisplay):

  • platform/graphics/chromium/VideoLayerChromium.h:

(VideoLayerChromium):

  • platform/graphics/chromium/WebGLLayerChromium.cpp:

(WebCore::WebGLLayerChromium::setNeedsDisplay):

  • platform/graphics/chromium/WebGLLayerChromium.h:

(WebGLLayerChromium):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109466 r109469  
     12012-03-01  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] LayerChromium::contentChanged is redundant with setNeedsDisplay
     4        https://bugs.webkit.org/show_bug.cgi?id=79708
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Some layer types need special handling when they receive damage. WebGL layers need to know if their texture is
     9        updated for clear-on-swap behavior and both WebGL and canvas 2d layers have rate limiting mechanisms tied to
     10        receiving invalidations. This mechanism was implemented by LayerChromium::contentChanged(), but this is
     11        redundant with setNeedsDisplay().
     12
     13        Covered by existing tests.
     14
     15        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
     16        (WebCore::Canvas2DLayerChromium::setNeedsDisplay):
     17        * platform/graphics/chromium/Canvas2DLayerChromium.h:
     18        (Canvas2DLayerChromium):
     19        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     20        (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
     21        * platform/graphics/chromium/LayerChromium.cpp:
     22        (WebCore::LayerChromium::setNeedsDisplay):
     23        * platform/graphics/chromium/LayerChromium.h:
     24        (LayerChromium):
     25        * platform/graphics/chromium/VideoLayerChromium.cpp:
     26        (WebCore::VideoLayerChromium::setNeedsDisplay):
     27        * platform/graphics/chromium/VideoLayerChromium.h:
     28        (VideoLayerChromium):
     29        * platform/graphics/chromium/WebGLLayerChromium.cpp:
     30        (WebCore::WebGLLayerChromium::setNeedsDisplay):
     31        * platform/graphics/chromium/WebGLLayerChromium.h:
     32        (WebGLLayerChromium):
     33
    1342012-03-01  James Robinson  <jamesr@chromium.org>
    235
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp

    r108714 r109469  
    7676}
    7777
    78 void Canvas2DLayerChromium::contentChanged()
     78void Canvas2DLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
    7979{
     80    LayerChromium::setNeedsDisplayRect(dirtyRect);
     81
    8082    if (layerTreeHost())
    8183        layerTreeHost()->startRateLimiter(m_context);
    82 
    83     m_updateRect = FloatRect(FloatPoint(), contentBounds());
    84     setNeedsDisplay();
    8584}
    8685
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h

    r106891 r109469  
    5353    void setTextureId(unsigned);
    5454
    55     virtual void contentChanged();
     55    virtual void setNeedsDisplayRect(const FloatRect&);
    5656
    5757    virtual bool drawsContent() const;
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r109466 r109469  
    324324void GraphicsLayerChromium::setContentsNeedsDisplay()
    325325{
    326     if (m_contentsLayer) {
     326    if (m_contentsLayer)
    327327        m_contentsLayer->setNeedsDisplay();
    328         m_contentsLayer->contentChanged();
    329     }
    330328}
    331329
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r109466 r109469  
    488488void LayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
    489489{
     490    m_updateRect.unite(dirtyRect);
     491
    490492    // Simply mark the contents as dirty. For non-root layers, the call to
    491493    // setNeedsCommit will schedule a fresh compositing pass.
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r109466 r109469  
    208208    // Returns true if any of the layer's descendants has content to draw.
    209209    bool descendantDrawsContent();
    210     virtual void contentChanged() { }
    211210
    212211    CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
  • trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp

    r108886 r109469  
    5353}
    5454
    55 void PluginLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext, CCTextureUpdater&)
    56 {
    57     if (!m_needsDisplay)
    58         return;
    59 
    60     // PluginLayers are updated externally (outside of the compositor).
    61     // |m_dirtyRect| covers the region that has changed since the last composite.
    62     m_updateRect = m_dirtyRect;
    63     m_dirtyRect = FloatRect();
    64 }
    65 
    6655PassOwnPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
    6756{
     
    111100}
    112101
    113 void PluginLayerChromium::invalidateRect(const FloatRect& dirtyRect)
    114 {
    115     setNeedsDisplayRect(dirtyRect);
    116     m_dirtyRect.unite(dirtyRect);
    117 }
    118 
    119102}
    120103#endif // USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h

    r108886 r109469  
    3838public:
    3939    static PassRefPtr<PluginLayerChromium> create();
    40     virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
    4140
    4241    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
     
    5655    virtual void pushPropertiesTo(CCLayerImpl*);
    5756
    58     void invalidateRect(const FloatRect& dirtyRect);
    59 
    6057protected:
    6158    PluginLayerChromium();
     
    6865    int m_ioSurfaceHeight;
    6966    uint32_t m_ioSurfaceId;
    70     FloatRect m_dirtyRect;
    7167};
    7268
  • trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp

    r108886 r109469  
    5858}
    5959
    60 void VideoLayerChromium::contentChanged()
    61 {
    62     m_updateRect = FloatRect(FloatPoint(), contentBounds());
    63     setNeedsDisplay();
    64 }
    65 
    6660} // namespace WebCore
    6761
  • trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h

    r108886 r109469  
    5151    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    5252
    53     void contentChanged();
    54 
    5553private:
    5654    explicit VideoLayerChromium(VideoFrameProvider*);
  • trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp

    r105460 r109469  
    9393        drawingBuffer()->publishToPlatformLayer();
    9494        context()->markLayerComposited();
    95         m_updateRect = FloatRect(FloatPoint(), bounds());
    9695        m_needsDisplay = false;
    9796        m_textureUpdated = false;
     
    128127}
    129128
    130 void WebGLLayerChromium::contentChanged()
     129void WebGLLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
    131130{
     131    LayerChromium::setNeedsDisplayRect(dirtyRect);
     132
    132133    m_textureUpdated = true;
     134
    133135    // If WebGL commands are issued outside of a the animation callbacks, then use
    134136    // call rateLimitOffscreenContextCHROMIUM() to keep the context from getting too far ahead.
  • trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h

    r105460 r109469  
    5656    virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
    5757    virtual void pushPropertiesTo(CCLayerImpl*);
    58     virtual void contentChanged();
     58    virtual void setNeedsDisplayRect(const FloatRect&);
    5959    bool paintRenderedResultsToCanvas(ImageBuffer*);
    6060
  • trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp

    r103970 r109469  
    6969void WebExternalTextureLayer::invalidateRect(const WebFloatRect& updateRect)
    7070{
    71     unwrap<WebExternalTextureLayerImpl>()->invalidateRect(updateRect);
     71    unwrap<WebExternalTextureLayerImpl>()->setNeedsDisplayRect(updateRect);
    7272}
    7373
  • trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp

    r108703 r109469  
    153153#if USE(ACCELERATED_COMPOSITING)
    154154    if (m_videoLayer && supportsAcceleratedRendering())
    155         m_videoLayer->contentChanged();
     155        m_videoLayer->setNeedsDisplay();
    156156#endif
    157157    m_mediaPlayer->repaint();
  • trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

    r107960 r109469  
    371371{
    372372#if USE(ACCELERATED_COMPOSITING)
    373     if (m_platformLayer.get())
    374         m_platformLayer->invalidateRect(FloatRect(FloatPoint(), m_platformLayer->bounds()));
     373    if (m_platformLayer)
     374        m_platformLayer->setNeedsDisplay();
    375375#endif
    376376}
  • trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp

    r108886 r109469  
    132132        canvas->setTextureId(backTextureId);
    133133
    134         canvas->contentChanged();
     134        canvas->setNeedsDisplay();
    135135        EXPECT_TRUE(canvas->needsDisplay());
    136136        Region occludedScreenSpace;
Note: See TracChangeset for help on using the changeset viewer.