Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: cc/CCLayerTreeHostCommonTest.cpp

Issue 11099040: [cc] Store CCLayerImpls as scoped_ptrs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cc unit tests Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/CCLayerTreeHostCommon.h ('k') | cc/CCLayerTreeHostImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCLayerTreeHostCommonTest.cpp
diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp
index 5d469625b35608a8ac351139e70b640f15ab00d3..e91b8ff617c5cc631f196f57bf368df8c7c5041f 100644
--- a/cc/CCLayerTreeHostCommonTest.cpp
+++ b/cc/CCLayerTreeHostCommonTest.cpp
@@ -90,12 +90,12 @@ WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
return ret;
}
-PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests()
+scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests()
{
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
- OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
- OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
- OwnPtr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2);
+ scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
+ scoped_ptr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4);
WebTransformationMatrix IdentityMatrix;
FloatPoint anchor(0, 0);
@@ -106,11 +106,11 @@ PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests()
setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
setLayerPropertiesForTesting(greatGrandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
- grandChild->addChild(greatGrandChild.release());
- child->addChild(grandChild.release());
- root->addChild(child.release());
+ grandChild->addChild(greatGrandChild.Pass());
+ child->addChild(grandChild.Pass());
+ root->addChild(child.Pass());
- return root.release();
+ return root.Pass();
}
class LayerChromiumWithForcedDrawsContent : public LayerChromium {
@@ -763,7 +763,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// is the direct parent of the fixed-position layer.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
@@ -804,7 +804,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// order.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
@@ -847,7 +847,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// is NOT the direct parent of the fixed-position layer.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
CCLayerImpl* greatGrandChild = grandChild->children()[0];
@@ -891,7 +891,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// transforms that have to be processed in the correct order.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
CCLayerImpl* greatGrandChild = grandChild->children()[0];
@@ -953,7 +953,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// transforms that have to be processed in the correct order.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
CCLayerImpl* greatGrandChild = grandChild->children()[0];
@@ -1015,7 +1015,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// scrollDelta.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
CCLayerImpl* greatGrandChild = grandChild->children()[0];
@@ -1088,7 +1088,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// surfaces is accumulated properly in the final matrix transform.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
CCLayerImpl* greatGrandChild = grandChild->children()[0];
@@ -1096,9 +1096,9 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// Add one more layer to the test tree for this scenario.
{
WebTransformationMatrix identity;
- OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5);
+ scoped_ptr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5);
setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- greatGrandChild->addChild(fixedPositionChild.release());
+ greatGrandChild->addChild(fixedPositionChild.Pass());
}
CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0];
@@ -1199,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
// is completely irrelevant; it should not affect the scroll compensation.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
@@ -1246,7 +1246,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
// should not accidentally be fixed to itself.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
@@ -1283,7 +1283,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
// be fixed to the viewport -- not the rootLayer, which may have transforms of its own.
DebugScopedSetImplThread scopedImplThread;
- OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
CCLayerImpl* child = root->children()[0];
CCLayerImpl* grandChild = child->children()[0];
@@ -2671,7 +2671,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -2713,7 +2713,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
WebTransformationMatrix uninvertibleTransform;
uninvertibleTransform.setM11(0);
@@ -2774,7 +2774,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -2817,7 +2817,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
WebTransformationMatrix rotation45DegreesAboutCenter;
@@ -2868,7 +2868,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
@@ -2930,7 +2930,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents
//
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -2940,14 +2940,14 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents
{
FloatPoint position(25, 25);
IntSize bounds(50, 50);
- OwnPtr<CCLayerImpl> testLayer = CCLayerImpl::create(12345);
+ scoped_ptr<CCLayerImpl> testLayer = CCLayerImpl::create(12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// override contentBounds
testLayer->setContentBounds(IntSize(100, 100));
testLayer->setDrawsContent(true);
- root->addChild(testLayer.release());
+ root->addChild(testLayer.Pass());
}
std::vector<CCLayerImpl*> renderSurfaceLayerList;
@@ -2995,23 +2995,23 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
{
- OwnPtr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123);
+ scoped_ptr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123);
FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
IntSize bounds(50, 50);
setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
clippingLayer->setMasksToBounds(true);
- OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456);
+ scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
position = FloatPoint(-50, -50);
bounds = IntSize(300, 300);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
- clippingLayer->addChild(child.release());
- root->addChild(clippingLayer.release());
+ clippingLayer->addChild(child.Pass());
+ root->addChild(clippingLayer.Pass());
}
std::vector<CCLayerImpl*> renderSurfaceLayerList;
@@ -3060,7 +3060,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
//
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(123);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -3070,9 +3070,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
root->setMasksToBounds(true);
{
- OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456);
- OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(789);
- OwnPtr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468);
+ scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
+ scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(789);
+ scoped_ptr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468);
position = FloatPoint(10, 10);
bounds = IntSize(80, 80);
@@ -3099,9 +3099,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, identityMatrix, anchor, position, bounds, false);
rotatedLeaf->setDrawsContent(true);
- grandChild->addChild(rotatedLeaf.release());
- child->addChild(grandChild.release());
- root->addChild(child.release());
+ grandChild->addChild(rotatedLeaf.Pass());
+ child->addChild(grandChild.Pass());
+ root->addChild(child.Pass());
}
std::vector<CCLayerImpl*> renderSurfaceLayerList;
@@ -3163,11 +3163,11 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
{
- OwnPtr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123);
+ scoped_ptr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123);
FloatPoint position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
IntSize bounds(50, 50);
setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
@@ -3177,13 +3177,13 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
// The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all.
// If child is incorrectly clipped, we would not be able to hit it successfully.
- OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456);
+ scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
position = FloatPoint(60, 60); // 70, 70 in screen space
bounds = IntSize(20, 20);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
- intermediateLayer->addChild(child.release());
- root->addChild(intermediateLayer.release());
+ intermediateLayer->addChild(child.Pass());
+ root->addChild(intermediateLayer.Pass());
}
std::vector<CCLayerImpl*> renderSurfaceLayerList;
@@ -3221,7 +3221,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
{
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -3236,9 +3236,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
// The expected stacking order is:
// (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
- OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
- OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
- OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
+ scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2);
+ scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3);
+ scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
position = FloatPoint(10, 10);
bounds = IntSize(50, 50);
@@ -3257,9 +3257,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
grandChild1->setDrawsContent(true);
- child1->addChild(grandChild1.release());
- root->addChild(child1.release());
- root->addChild(child2.release());
+ child1->addChild(grandChild1.Pass());
+ root->addChild(child1.Pass());
+ root->addChild(child2.Pass());
}
CCLayerImpl* child1 = root->children()[0];
@@ -3326,7 +3326,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
//
DebugScopedSetImplThread thisScopeIsOnImplThread;
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
WebTransformationMatrix identityMatrix;
FloatPoint anchor(0, 0);
@@ -3341,9 +3341,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
// The expected stacking order is:
// (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
- OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
- OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
- OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
+ scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2);
+ scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3);
+ scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
position = FloatPoint(10, 10);
bounds = IntSize(50, 50);
@@ -3365,9 +3365,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
grandChild1->setDrawsContent(true);
grandChild1->setForceRenderSurface(true);
- child1->addChild(grandChild1.release());
- root->addChild(child1.release());
- root->addChild(child2.release());
+ child1->addChild(grandChild1.Pass());
+ root->addChild(child1.Pass());
+ root->addChild(child2.Pass());
}
CCLayerImpl* child1 = root->children()[0];
« no previous file with comments | « cc/CCLayerTreeHostCommon.h ('k') | cc/CCLayerTreeHostImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698