[chromium] Unit test fix, save the sharedQuadState while the quads hold a pointer...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2012 16:53:25 +0000 (16:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2012 16:53:25 +0000 (16:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81476

Patch by Dana Jansens <danakj@chromium.org> on 2012-03-19
Reviewed by Adrienne Walker.

* tests/CCQuadCullerTest.cpp:
(WebCore::appendQuads):
(WebCore):
(WebCore::TEST):

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

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCQuadCullerTest.cpp

index ab3a7e2a464afbcd234c6f0ee6aa85768ddecd41..38528a487c9b9ee4c73a798543c78f85e3468fa3 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-19  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Unit test fix, save the sharedQuadState while the quads hold a pointer to it
+        https://bugs.webkit.org/show_bug.cgi?id=81476
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCQuadCullerTest.cpp:
+        (WebCore::appendQuads):
+        (WebCore):
+        (WebCore::TEST):
+
 2012-03-19  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled DEPS.
index 158b0c08b70f1c1f8697d71290bb9ce6e6d3b7a4..11a089a52cdec9bed4efb3dc2124a3f3e43b759f 100644 (file)
@@ -78,16 +78,18 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(const TransformationMatrix& drawTr
     return layer.release();
 }
 
-static void appendQuads(CCQuadList& quadList, CCTiledLayerImpl* layer, CCOcclusionTrackerImpl& occlusionTracker)
+static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCOcclusionTrackerImpl& occlusionTracker)
 {
     CCQuadCuller quadCuller(quadList, layer, &occlusionTracker);
     OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
     layer->appendQuads(quadCuller, sharedQuadState.get());
+    sharedStateList.append(sharedQuadState.release());
 }
 
 #define DECLARE_AND_INITIALIZE_TEST_QUADS               \
     DebugScopedSetImplThread impl;                      \
     CCQuadList quadList;                                \
+    Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \
     TransformationMatrix childTransform;                \
     IntSize rootSize = IntSize(300, 300);               \
     IntRect rootRect = IntRect(IntPoint(), rootSize);   \
@@ -102,8 +104,8 @@ TEST(CCQuadCullerTest, verifyNoCulling)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 13u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 130000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -118,9 +120,9 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 9u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -135,9 +137,9 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 0.9, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 13u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 40000, 1);
@@ -152,9 +154,9 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 13u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 40000, 1);
@@ -171,9 +173,9 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 12u);
 
     IntRect quadVisibleRect1 = quadList[5].get()->quadVisibleRect();
@@ -214,9 +216,9 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 2u);
 
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 20363, 1);
@@ -242,9 +244,9 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 2u);
 
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 19643, 1);
@@ -262,9 +264,9 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 9u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -282,9 +284,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 12u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 30000, 1);
@@ -302,9 +304,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 12u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 25000, 1);
@@ -322,9 +324,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 13u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 30000, 1);
@@ -342,9 +344,9 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 13u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 130000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -368,9 +370,9 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 12u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 100600, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -385,9 +387,9 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 1u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 10000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -402,9 +404,9 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 1u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 10000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -419,9 +421,9 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 9u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 40000, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
@@ -436,9 +438,9 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles)
     OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100));
 
-    appendQuads(quadList, childLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
-    appendQuads(quadList, rootLayer.get(), occlusionTracker);
+    appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
     EXPECT_EQ(quadList.size(), 0u);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1);
     EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);