Title: [109469] trunk/Source
Revision
109469
Author
[email protected]
Date
2012-03-01 17:14:16 -0800 (Thu, 01 Mar 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109468 => 109469)


--- trunk/Source/WebCore/ChangeLog	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/ChangeLog	2012-03-02 01:14:16 UTC (rev 109469)
@@ -1,5 +1,38 @@
 2012-03-01  James Robinson  <[email protected]>
 
+        [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):
+
+2012-03-01  James Robinson  <[email protected]>
+
         [chromium] Rename LayerChromium::name to debugName to be more consistent with other debug properties, make threadsafe
         https://bugs.webkit.org/show_bug.cgi?id=79723
 

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


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -75,13 +75,12 @@
     setNeedsCommit();
 }
 
-void Canvas2DLayerChromium::contentChanged()
+void Canvas2DLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
 {
+    LayerChromium::setNeedsDisplayRect(dirtyRect);
+
     if (layerTreeHost())
         layerTreeHost()->startRateLimiter(m_context);
-
-    m_updateRect = FloatRect(FloatPoint(), contentBounds());
-    setNeedsDisplay();
 }
 
 bool Canvas2DLayerChromium::drawsContent() const

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


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h	2012-03-02 01:14:16 UTC (rev 109469)
@@ -52,7 +52,7 @@
 
     void setTextureId(unsigned);
 
-    virtual void contentChanged();
+    virtual void setNeedsDisplayRect(const FloatRect&);
 
     virtual bool drawsContent() const;
     virtual void paintContentsIfDirty(const Region& occludedScreenSpace);

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (109468 => 109469)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -323,10 +323,8 @@
 
 void GraphicsLayerChromium::setContentsNeedsDisplay()
 {
-    if (m_contentsLayer) {
+    if (m_contentsLayer)
         m_contentsLayer->setNeedsDisplay();
-        m_contentsLayer->contentChanged();
-    }
 }
 
 void GraphicsLayerChromium::setNeedsDisplay()

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


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -487,6 +487,8 @@
 
 void LayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
 {
+    m_updateRect.unite(dirtyRect);
+
     // Simply mark the contents as dirty. For non-root layers, the call to
     // setNeedsCommit will schedule a fresh compositing pass.
     // For the root layer, setNeedsCommit has no effect.

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


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-03-02 01:14:16 UTC (rev 109469)
@@ -207,7 +207,6 @@
 
     // Returns true if any of the layer's descendants has content to draw.
     bool descendantDrawsContent();
-    virtual void contentChanged() { }
 
     CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp (109468 => 109469)


--- trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -52,17 +52,6 @@
 {
 }
 
-void PluginLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext, CCTextureUpdater&)
-{
-    if (!m_needsDisplay)
-        return;
-
-    // PluginLayers are updated externally (outside of the compositor).
-    // |m_dirtyRect| covers the region that has changed since the last composite.
-    m_updateRect = m_dirtyRect;
-    m_dirtyRect = FloatRect();
-}
-
 PassOwnPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
 {
     return CCPluginLayerImpl::create(m_layerId);
@@ -110,11 +99,5 @@
     pluginLayer->setIOSurfaceProperties(m_ioSurfaceWidth, m_ioSurfaceHeight, m_ioSurfaceId);
 }
 
-void PluginLayerChromium::invalidateRect(const FloatRect& dirtyRect)
-{
-    setNeedsDisplayRect(dirtyRect);
-    m_dirtyRect.unite(dirtyRect);
 }
-
-}
 #endif // USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h (109468 => 109469)


--- trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h	2012-03-02 01:14:16 UTC (rev 109469)
@@ -37,7 +37,6 @@
 class PluginLayerChromium : public LayerChromium {
 public:
     static PassRefPtr<PluginLayerChromium> create();
-    virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
 
     virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
 
@@ -55,8 +54,6 @@
 
     virtual void pushPropertiesTo(CCLayerImpl*);
 
-    void invalidateRect(const FloatRect& dirtyRect);
-
 protected:
     PluginLayerChromium();
 
@@ -67,7 +64,6 @@
     int m_ioSurfaceWidth;
     int m_ioSurfaceHeight;
     uint32_t m_ioSurfaceId;
-    FloatRect m_dirtyRect;
 };
 
 }

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


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -57,12 +57,6 @@
     return CCVideoLayerImpl::create(m_layerId, m_provider);
 }
 
-void VideoLayerChromium::contentChanged()
-{
-    m_updateRect = FloatRect(FloatPoint(), contentBounds());
-    setNeedsDisplay();
-}
-
 } // namespace WebCore
 
 #endif // USE(ACCELERATED_COMPOSITING)

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


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2012-03-02 01:14:16 UTC (rev 109469)
@@ -50,8 +50,6 @@
 
     virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
 
-    void contentChanged();
-
 private:
     explicit VideoLayerChromium(VideoFrameProvider*);
 

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


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -92,7 +92,6 @@
         // publishToPlatformLayer prepares the contents of the off-screen render target for use by the compositor.
         drawingBuffer()->publishToPlatformLayer();
         context()->markLayerComposited();
-        m_updateRect = FloatRect(FloatPoint(), bounds());
         m_needsDisplay = false;
         m_textureUpdated = false;
     }
@@ -127,9 +126,12 @@
     return true;
 }
 
-void WebGLLayerChromium::contentChanged()
+void WebGLLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
 {
+    LayerChromium::setNeedsDisplayRect(dirtyRect);
+
     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 (layerTreeHost())

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


--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h	2012-03-02 01:14:16 UTC (rev 109469)
@@ -55,7 +55,7 @@
     virtual bool drawsContent() const;
     virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
     virtual void pushPropertiesTo(CCLayerImpl*);
-    virtual void contentChanged();
+    virtual void setNeedsDisplayRect(const FloatRect&);
     bool paintRenderedResultsToCanvas(ImageBuffer*);
 
     GraphicsContext3D* context() const;

Modified: trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp (109468 => 109469)


--- trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -68,7 +68,7 @@
 
 void WebExternalTextureLayer::invalidateRect(const WebFloatRect& updateRect)
 {
-    unwrap<WebExternalTextureLayerImpl>()->invalidateRect(updateRect);
+    unwrap<WebExternalTextureLayerImpl>()->setNeedsDisplayRect(updateRect);
 }
 
 WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node)

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (109468 => 109469)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -152,7 +152,7 @@
     ASSERT(m_mediaPlayer);
 #if USE(ACCELERATED_COMPOSITING)
     if (m_videoLayer && supportsAcceleratedRendering())
-        m_videoLayer->contentChanged();
+        m_videoLayer->setNeedsDisplay();
 #endif
     m_mediaPlayer->repaint();
 }

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (109468 => 109469)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -370,8 +370,8 @@
 void WebPluginContainerImpl::commitBackingTexture()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_platformLayer.get())
-        m_platformLayer->invalidateRect(FloatRect(FloatPoint(), m_platformLayer->bounds()));
+    if (m_platformLayer)
+        m_platformLayer->setNeedsDisplay();
 #endif
 }
 

Modified: trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp (109468 => 109469)


--- trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-03-02 01:06:55 UTC (rev 109468)
+++ trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-03-02 01:14:16 UTC (rev 109469)
@@ -131,7 +131,7 @@
         canvas->setBounds(IntSize(600, 300));
         canvas->setTextureId(backTextureId);
 
-        canvas->contentChanged();
+        canvas->setNeedsDisplay();
         EXPECT_TRUE(canvas->needsDisplay());
         Region occludedScreenSpace;
         canvas->paintContentsIfDirty(occludedScreenSpace);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to