Title: [120266] trunk/Source
Revision
120266
Author
[email protected]
Date
2012-06-13 19:27:21 -0700 (Wed, 13 Jun 2012)

Log Message

[chromium] Assert if iterating an invalid RenderSurfaceLayerList, where a layer in the list has no RenderSurface
https://bugs.webkit.org/show_bug.cgi?id=89004

Reviewed by Adrienne Walker.

Source/WebCore:

A RenderSurfaceLayerList expects that all layers in the list own a
RenderSurface. If an invalid RSLL is iterated over, the
CCLayerIterator class will now ASSERT in debug mode, as well as
considering the list empty in release mode.

We will be adding code to CCLayerTreeHostImpl to save a RSLL across
frames, so adding a clearRenderSurfaces() method with a FIXME comment
to make it clear that we should clear the RSLL when we remove
RenderSurfaces from the layers in the saved RSLL.

* platform/graphics/chromium/cc/CCLayerIterator.h:
(WebCore::CCLayerIterator::CCLayerIterator):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::~CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
(WebCore::clearRenderSurfacesOnCCLayerImplRecursive):
(WebCore::CCLayerTreeHostImpl::clearRenderSurfaces):
(WebCore):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImpl):

Source/WebKit/chromium:

* tests/CCLayerIteratorTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120265 => 120266)


--- trunk/Source/WebCore/ChangeLog	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebCore/ChangeLog	2012-06-14 02:27:21 UTC (rev 120266)
@@ -1,3 +1,31 @@
+2012-06-13  Dana Jansens  <[email protected]>
+
+        [chromium] Assert if iterating an invalid RenderSurfaceLayerList, where a layer in the list has no RenderSurface
+        https://bugs.webkit.org/show_bug.cgi?id=89004
+
+        Reviewed by Adrienne Walker.
+
+        A RenderSurfaceLayerList expects that all layers in the list own a
+        RenderSurface. If an invalid RSLL is iterated over, the
+        CCLayerIterator class will now ASSERT in debug mode, as well as
+        considering the list empty in release mode.
+
+        We will be adding code to CCLayerTreeHostImpl to save a RSLL across
+        frames, so adding a clearRenderSurfaces() method with a FIXME comment
+        to make it clear that we should clear the RSLL when we remove
+        RenderSurfaces from the layers in the saved RSLL.
+
+        * platform/graphics/chromium/cc/CCLayerIterator.h:
+        (WebCore::CCLayerIterator::CCLayerIterator):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::~CCLayerTreeHostImpl):
+        (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
+        (WebCore::clearRenderSurfacesOnCCLayerImplRecursive):
+        (WebCore::CCLayerTreeHostImpl::clearRenderSurfaces):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+        (CCLayerTreeHostImpl):
+
 2012-06-13  Yael Aharon  <[email protected]>
 
         Remove redundant code from RenderView and RenderBlock

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h (120265 => 120266)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h	2012-06-14 02:27:21 UTC (rev 120266)
@@ -145,7 +145,15 @@
         : m_renderSurfaceLayerList(renderSurfaceLayerList)
         , m_targetRenderSurfaceLayerIndex(0)
     {
-        if (start && !renderSurfaceLayerList->isEmpty() && targetRenderSurface())
+        for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) {
+            if (!(*renderSurfaceLayerList)[i]->renderSurface()) {
+                ASSERT_NOT_REACHED();
+                m_actions.end(*this);
+                return;
+            }
+        }
+
+        if (start && !renderSurfaceLayerList->isEmpty())
             m_actions.begin(*this);
         else
             m_actions.end(*this);

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (120265 => 120266)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-06-14 02:27:21 UTC (rev 120266)
@@ -140,7 +140,7 @@
     TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0);
 
     if (m_rootLayerImpl)
-        clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get());
+        clearRenderSurfaces();
 }
 
 void CCLayerTreeHostImpl::beginCommit()
@@ -545,7 +545,7 @@
     // Since we now have a new context/layerRenderer, we cannot continue to use the old
     // resources (i.e. renderSurfaces and texture IDs).
     if (m_rootLayerImpl) {
-        clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get());
+        clearRenderSurfaces();
         sendDidLoseContextRecursive(m_rootLayerImpl.get());
     }
 
@@ -894,7 +894,7 @@
         sendDidLoseContextRecursive(current->children()[i].get());
 }
 
-void CCLayerTreeHostImpl::clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* current)
+static void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* current)
 {
     ASSERT(current);
     for (size_t i = 0; i < current->children().size(); ++i)
@@ -902,6 +902,12 @@
     current->clearRenderSurface();
 }
 
+void CCLayerTreeHostImpl::clearRenderSurfaces()
+{
+    clearRenderSurfacesOnCCLayerImplRecursive(m_rootLayerImpl.get());
+    // FIXME: If we have any RenderSurfaceLayerList saved, then make the list empty here.
+}
+
 String CCLayerTreeHostImpl::layerTreeAsText() const
 {
     TextStream ts;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h (120265 => 120266)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2012-06-14 02:27:21 UTC (rev 120266)
@@ -209,7 +209,7 @@
     void setBackgroundTickingEnabled(bool);
     IntSize contentSize() const;
     void sendDidLoseContextRecursive(CCLayerImpl*);
-    void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl*);
+    void clearRenderSurfaces();
 
     void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (120265 => 120266)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-14 02:27:21 UTC (rev 120266)
@@ -1,3 +1,12 @@
+2012-06-13  Dana Jansens  <[email protected]>
+
+        [chromium] Assert if iterating an invalid RenderSurfaceLayerList, where a layer in the list has no RenderSurface
+        https://bugs.webkit.org/show_bug.cgi?id=89004
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCLayerIteratorTest.cpp:
+
 2012-06-13  Shawn Singh  <[email protected]>
 
         [chromium] Implement hit-testing for impl-side input handling in accelerated compositor

Modified: trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp (120265 => 120266)


--- trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp	2012-06-14 02:03:56 UTC (rev 120265)
+++ trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp	2012-06-14 02:27:21 UTC (rev 120266)
@@ -82,8 +82,6 @@
         renderSurfaceLayer->m_countRepresentingContributingSurface = -1;
         renderSurfaceLayer->m_countRepresentingItself = -1;
 
-        if (!renderSurface)
-            continue;
         for (unsigned layerIndex = 0; layerIndex < renderSurface->layerList().size(); ++layerIndex) {
             TestLayerChromium* layer = static_cast<TestLayerChromium*>(renderSurface->layerList()[layerIndex].get());
 
@@ -287,17 +285,4 @@
     EXPECT_COUNT(root3, -1, -1, 0);
 }
 
-TEST(CCLayerIteratorTest, rootLayerWithoutRenderSurface)
-{
-    RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
-    Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
-    renderSurfaceLayerList.append(rootLayer.get());
-
-    iterateBackToFront(&renderSurfaceLayerList);
-    EXPECT_COUNT(rootLayer, -1, -1, -1);
-
-    iterateFrontToBack(&renderSurfaceLayerList);
-    EXPECT_COUNT(rootLayer, -1, -1, -1);
-}
-
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to