Title: [108542] trunk/Source
- Revision
- 108542
- Author
- [email protected]
- Date
- 2012-02-22 13:00:26 -0800 (Wed, 22 Feb 2012)
Log Message
CCLayerTreeHostImpl calls didDraw more frequently than willDraw
https://bugs.webkit.org/show_bug.cgi?id=79139
Patch by Tim Dresser <[email protected]> on 2012-02-22
Reviewed by James Robinson.
Source/WebCore:
Ensure that didDraw is called if and only if willDraw was called previously.
CCLayerTreeHostImplTest.didDrawNotCalledOnHiddenLayer has been added to ensure that
hidden layers, for which willDraw is not called, will also not have didDraw called.
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::drawLayers):
* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
(WebCore::CCVideoLayerImpl::didDraw):
Source/WebKit/chromium:
* tests/CCLayerTreeHostImplTest.cpp:
(WebKit::DidDrawCheckLayer::willDraw):
(DidDrawCheckLayer):
(WebKit::DidDrawCheckLayer::willDrawCalled):
(WebKit::DidDrawCheckLayer::DidDrawCheckLayer):
(WebKit::TEST_F):
(WebKit):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (108541 => 108542)
--- trunk/Source/WebCore/ChangeLog 2012-02-22 20:57:43 UTC (rev 108541)
+++ trunk/Source/WebCore/ChangeLog 2012-02-22 21:00:26 UTC (rev 108542)
@@ -1,3 +1,20 @@
+2012-02-22 Tim Dresser <[email protected]>
+
+ CCLayerTreeHostImpl calls didDraw more frequently than willDraw
+ https://bugs.webkit.org/show_bug.cgi?id=79139
+
+ Reviewed by James Robinson.
+
+ Ensure that didDraw is called if and only if willDraw was called previously.
+
+ CCLayerTreeHostImplTest.didDrawNotCalledOnHiddenLayer has been added to ensure that
+ hidden layers, for which willDraw is not called, will also not have didDraw called.
+
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+ (WebCore::CCLayerTreeHostImpl::drawLayers):
+ * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+ (WebCore::CCVideoLayerImpl::didDraw):
+
2012-02-22 Levi Weintraub <[email protected]>
ScrollbarThemeComposite::thumbPosition uses the result of a divide by zero
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (108541 => 108542)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-02-22 20:57:43 UTC (rev 108541)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-02-22 21:00:26 UTC (rev 108542)
@@ -281,10 +281,9 @@
CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
- if (it.representsItself())
+ if (it.representsItself() && !it->visibleLayerRect().isEmpty())
it->didDraw();
}
-
m_layerRenderer->finishDrawingFrame();
++m_frameNumber;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (108541 => 108542)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp 2012-02-22 20:57:43 UTC (rev 108541)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp 2012-02-22 21:00:26 UTC (rev 108542)
@@ -158,6 +158,7 @@
for (unsigned plane = 0; plane < m_frame->planes(); ++plane)
m_textures[plane].m_texture->unreserve();
m_provider->putCurrentFrame(m_frame);
+ m_frame = 0;
}
IntSize CCVideoLayerImpl::computeVisibleSize(const VideoFrameChromium* frame, unsigned plane)
Modified: trunk/Source/WebKit/chromium/ChangeLog (108541 => 108542)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-22 20:57:43 UTC (rev 108541)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-22 21:00:26 UTC (rev 108542)
@@ -1,3 +1,18 @@
+2012-02-22 Tim Dresser <[email protected]>
+
+ CCLayerTreeHostImpl calls didDraw more frequently than willDraw
+ https://bugs.webkit.org/show_bug.cgi?id=79139
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::DidDrawCheckLayer::willDraw):
+ (DidDrawCheckLayer):
+ (WebKit::DidDrawCheckLayer::willDrawCalled):
+ (WebKit::DidDrawCheckLayer::DidDrawCheckLayer):
+ (WebKit::TEST_F):
+ (WebKit):
+
2012-02-22 Dana Jansens <[email protected]>
[Chromium] New CCOcclusionTracker class with tests
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (108541 => 108542)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp 2012-02-22 20:57:43 UTC (rev 108541)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp 2012-02-22 21:00:26 UTC (rev 108542)
@@ -307,12 +307,19 @@
m_didDrawCalled = true;
}
+ virtual void willDraw(LayerRendererChromium*)
+ {
+ m_willDrawCalled = true;
+ }
+
bool didDrawCalled() const { return m_didDrawCalled; }
+ bool willDrawCalled() const { return m_willDrawCalled; }
private:
explicit DidDrawCheckLayer(int id)
: CCLayerImpl(id)
, m_didDrawCalled(false)
+ , m_willDrawCalled(false)
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
@@ -320,8 +327,45 @@
}
bool m_didDrawCalled;
+ bool m_willDrawCalled;
};
+TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
+{
+GraphicsContext3D::Attributes attrs;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
+ m_hostImpl->initializeLayerRenderer(context);
+
+ // Ensure visibleLayerRect for root layer is empty
+ m_hostImpl->setViewportSize(IntSize(0, 0));
+
+ RefPtr<DidDrawCheckLayer> root = DidDrawCheckLayer::create(0);
+ m_hostImpl->setRootLayer(root);
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+
+ m_hostImpl->drawLayers();
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+
+ EXPECT_TRUE(root->visibleLayerRect().isEmpty());
+
+ // Ensure visibleLayerRect for root layer is not empty
+ m_hostImpl->setViewportSize(IntSize(10, 10));
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+
+ m_hostImpl->drawLayers();
+
+ EXPECT_TRUE(root->willDrawCalled());
+ EXPECT_TRUE(root->didDrawCalled());
+
+ EXPECT_FALSE(root->visibleLayerRect().isEmpty());
+}
+
TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
{
GraphicsContext3D::Attributes attrs;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes