[chromium] Clear RenderSurfaces still when no idle paint will be done
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jul 2012 17:27:20 +0000 (17:27 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jul 2012 17:27:20 +0000 (17:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90553

Reviewed by Adrienne Walker.

Source/WebCore:

Currently if idle painting is disabled, updateLayers() will early-out.
But this prevents it from doing cleanup and clearing all RenderSurface
pointers, leaving the layer tree in an unexpected state.

Tests: CCLayerTreeHostTestCompositeAndReadbackCleanup

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::updateLayers):

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestCompositeAndReadbackCleanup):
(WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::CCLayerTreeHostTestCompositeAndReadbackCleanup):
(WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::beginTest):
(WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::afterTest):
(WTF):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

index 9421d98..3806d13 100644 (file)
@@ -1,3 +1,19 @@
+2012-07-04  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Clear RenderSurfaces still when no idle paint will be done
+        https://bugs.webkit.org/show_bug.cgi?id=90553
+
+        Reviewed by Adrienne Walker.
+
+        Currently if idle painting is disabled, updateLayers() will early-out.
+        But this prevents it from doing cleanup and clearing all RenderSurface
+        pointers, leaving the layer tree in an unexpected state.
+
+        Tests: CCLayerTreeHostTestCompositeAndReadbackCleanup
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::updateLayers):
+
 2012-07-04  John Mellor  <johnme@chromium.org>
 
         Text Autosizing: Add compile flag and runtime setting
index a2f8bbc..03024cf 100644 (file)
@@ -493,13 +493,13 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u
     prioritizeTextures(updateList);
 
     paintLayerContents(updateList, PaintVisible, updater);
-    if (!m_triggerIdlePaints)
-        return;
 
-    // The second (idle) paint will be a no-op in layers where painting already occured above.
-    // FIXME: This pass can be merged with the visible pass now that textures
-    //        are prioritized above.
-    paintLayerContents(updateList, PaintIdle, updater);
+    if (m_triggerIdlePaints) {
+        // The second (idle) paint will be a no-op in layers where painting already occured above.
+        // FIXME: This pass can be merged with the visible pass now that textures
+        //        are prioritized above.
+        paintLayerContents(updateList, PaintIdle, updater);
+    }
 
     for (size_t i = 0; i < updateList.size(); ++i)
         updateList[i]->clearRenderSurface();
index dc04a41..92644e3 100644 (file)
@@ -1,5 +1,19 @@
 2012-07-04  Dana Jansens  <danakj@chromium.org>
 
+        [chromium] Clear RenderSurfaces still when no idle paint will be done
+        https://bugs.webkit.org/show_bug.cgi?id=90553
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (CCLayerTreeHostTestCompositeAndReadbackCleanup):
+        (WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::CCLayerTreeHostTestCompositeAndReadbackCleanup):
+        (WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::beginTest):
+        (WTF::CCLayerTreeHostTestCompositeAndReadbackCleanup::afterTest):
+        (WTF):
+
+2012-07-04  Dana Jansens  <danakj@chromium.org>
+
         [chromium] Remove CCLayerTreeHostTestThreadOnly class to cleanup CCLayerTreeHostTests
         https://bugs.webkit.org/show_bug.cgi?id=90556
 
index cae47b7..4460c99 100644 (file)
@@ -2251,4 +2251,26 @@ TEST_F(CCLayerTreeHostTestScrollChildLayer, runMultiThread)
     runTest(true);
 }
 
+class CCLayerTreeHostTestCompositeAndReadbackCleanup : public CCLayerTreeHostTest {
+public:
+    CCLayerTreeHostTestCompositeAndReadbackCleanup() { }
+
+    virtual void beginTest()
+    {
+        LayerChromium* rootLayer = m_layerTreeHost->rootLayer();
+
+        OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4]));
+        m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
+        EXPECT_FALSE(rootLayer->renderSurface());
+
+        endTest();
+    }
+
+    virtual void afterTest()
+    {
+    }
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestCompositeAndReadbackCleanup)
+
 } // namespace