diff options
author | falken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 03:33:40 +0000 |
---|---|---|
committer | falken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 03:33:40 +0000 |
commit | a36c6649e81d18e8669c0b879d00d69a086fedbd (patch) | |
tree | 0d4432cce37a8e66e3ce32904803ffb9010b2fe9 /cc | |
parent | b91a4b66ef82d72bdac4e5f5784ccec494586764 (diff) | |
download | chromium_src-a36c6649e81d18e8669c0b879d00d69a086fedbd.zip chromium_src-a36c6649e81d18e8669c0b879d00d69a086fedbd.tar.gz chromium_src-a36c6649e81d18e8669c0b879d00d69a086fedbd.tar.bz2 |
Revert 161482 - [cc] Store CCLayerImpls as scoped_ptrs
(Reverting as cc_unittests on three Mac bots started failing)
Relanding https://codereview.chromium.org/11076013/
BUG=154451
Review URL: https://chromiumcodereview.appspot.com/11099040
TBR=enne@chromium.org
Review URL: https://codereview.chromium.org/11117008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
51 files changed, 502 insertions, 518 deletions
diff --git a/cc/CCDamageTrackerTest.cpp b/cc/CCDamageTrackerTest.cpp index 0ace696..49d0b67 100644 --- a/cc/CCDamageTrackerTest.cpp +++ b/cc/CCDamageTrackerTest.cpp @@ -66,10 +66,10 @@ void emulateDrawingOneFrame(CCLayerImpl* root) root->resetAllChangeTrackingForSubtree(); } -scoped_ptr<CCLayerImpl> createTestTreeWithOneSurface() +PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -84,22 +84,22 @@ scoped_ptr<CCLayerImpl> createTestTreeWithOneSurface() child->setBounds(IntSize(30, 30)); child->setContentBounds(IntSize(30, 30)); child->setDrawsContent(true); - root->addChild(child.Pass()); + root->addChild(child.release()); - return root.Pass(); + return root.release(); } -scoped_ptr<CCLayerImpl> createTestTreeWithTwoSurfaces() +PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() { // This test tree has two render surfaces: one for the root, and one for // child1. Additionally, the root has a second child layer, and child1 has two // children of its own. - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); - scoped_ptr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -134,34 +134,34 @@ scoped_ptr<CCLayerImpl> createTestTreeWithTwoSurfaces() grandChild2->setContentBounds(IntSize(6, 8)); grandChild2->setDrawsContent(true); - child1->addChild(grandChild1.Pass()); - child1->addChild(grandChild2.Pass()); - root->addChild(child1.Pass()); - root->addChild(child2.Pass()); + child1->addChild(grandChild1.release()); + child1->addChild(grandChild2.release()); + root->addChild(child1.release()); + root->addChild(child2.release()); - return root.Pass(); + return root.release(); } -scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() +PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() { - scoped_ptr<CCLayerImpl> root = createTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createTestTreeWithOneSurface(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. emulateDrawingOneFrame(root.get()); - return root.Pass(); + return root.release(); } -scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() +PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() { - scoped_ptr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. emulateDrawingOneFrame(root.get()); - return root.Pass(); + return root.release(); } class CCDamageTrackerTest : public testing::Test { @@ -175,7 +175,7 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface) // Sanity check that the simple test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); EXPECT_EQ(2u, root->renderSurface()->layerList().size()); EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id()); @@ -190,7 +190,7 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) // Sanity check that the complex test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* child2 = root->children()[1]; @@ -209,7 +209,7 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; // CASE 1: Setting the update rect should cause the corresponding damage to the surface. @@ -243,7 +243,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; // CASE 1: The layer's property changed flag takes priority over update rect. @@ -287,7 +287,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) // If a layer is transformed, the damage rect should still enclose the entire // transformed layer. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; WebTransformationMatrix rotation; @@ -330,7 +330,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // and positioned so that the right-most bound rect will be approximately 501 units in root surface space. // - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; WebTransformationMatrix transform; @@ -367,7 +367,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; WebFilterOperations filters; @@ -395,7 +395,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface) TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* child2 = root->children()[1]; @@ -498,20 +498,20 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild) TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child1 = root->children()[0]; // CASE 1: Adding a new layer should cause the appropriate damage. // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); - root->addChild(child2.Pass()); + root->addChild(child2.release()); } emulateDrawingOneFrame(root.get()); @@ -541,11 +541,11 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) // If child2 is added to the layer tree, but it doesn't have any explicit damage of // its own, it should still indeed damage the target surface. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -556,7 +556,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) // means the test no longer actually covers the intended scenario. ASSERT_FALSE(child2->layerPropertyChanged()); ASSERT_TRUE(child2->updateRect().isEmpty()); - root->addChild(child2.Pass()); + root->addChild(child2.release()); } emulateDrawingOneFrame(root.get()); @@ -569,19 +569,19 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child1 = root->children()[0]; // In this test we don't want the above tree manipulation to be considered part of the same frame. clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); - root->addChild(child2.Pass()); + root->addChild(child2.release()); } CCLayerImpl* child2 = root->children()[1]; emulateDrawingOneFrame(root.get()); @@ -599,7 +599,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* child2 = root->children()[1]; CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; @@ -638,7 +638,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) // This is a tricky case, since only the first grandChild changes, but the entire // surface should be marked dirty. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; FloatRect childDamageRect; @@ -671,7 +671,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) // should be completely unchanged, since we are only transforming it, while the // root surface would be damaged appropriately. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -693,7 +693,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -737,7 +737,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -763,7 +763,7 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -781,7 +781,7 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) TEST_F(CCDamageTrackerTest, verifyDamageForReplica) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* grandChild1 = child1->children()[0]; CCLayerImpl* grandChild2 = child1->children()[1]; @@ -794,13 +794,13 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // contentBounds of the surface. grandChild2->setPosition(FloatPoint(180, 180)); { - scoped_ptr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); + OwnPtr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); grandChild3->setPosition(FloatPoint(240, 240)); grandChild3->setAnchorPoint(FloatPoint::zero()); grandChild3->setBounds(IntSize(10, 10)); grandChild3->setContentBounds(IntSize(10, 10)); grandChild3->setDrawsContent(true); - child1->addChild(grandChild3.Pass()); + child1->addChild(grandChild3.release()); } child1->setOpacity(0.5); emulateDrawingOneFrame(root.get()); @@ -809,13 +809,13 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); + OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); - grandChild1->setReplicaLayer(grandChild1Replica.Pass()); + grandChild1->setReplicaLayer(grandChild1Replica.release()); } emulateDrawingOneFrame(root.get()); @@ -852,7 +852,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // CASE 3: removing the reflection should cause the entire region including reflection // to damage the target surface. clearDamageForAllSurfaces(root.get()); - grandChild1->setReplicaLayer(scoped_ptr<CCLayerImpl>()); + grandChild1->setReplicaLayer(nullptr); emulateDrawingOneFrame(root.get()); ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width()); ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height()); @@ -867,7 +867,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) TEST_F(CCDamageTrackerTest, verifyDamageForMask) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; // In the current implementation of the damage tracker, changes to mask layers should @@ -877,25 +877,25 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) // Set up the mask layer. { - scoped_ptr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(FloatPoint::zero()); maskLayer->setBounds(child->bounds()); maskLayer->setContentBounds(child->bounds()); - child->setMaskLayer(maskLayer.Pass()); + child->setMaskLayer(maskLayer.release()); } CCLayerImpl* maskLayer = child->maskLayer(); // Add opacity and a grandChild so that the render surface persists even after we remove the mask. child->setOpacity(0.5); { - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4); grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); grandChild->setContentBounds(IntSize(2, 2)); grandChild->setDrawsContent(true); - child->addChild(grandChild.Pass()); + child->addChild(grandChild.release()); } emulateDrawingOneFrame(root.get()); @@ -938,7 +938,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) // Then test mask removal. clearDamageForAllSurfaces(root.get()); - child->setMaskLayer(scoped_ptr<CCLayerImpl>()); + child->setMaskLayer(nullptr); ASSERT_TRUE(child->layerPropertyChanged()); emulateDrawingOneFrame(root.get()); @@ -951,7 +951,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* grandChild1 = child1->children()[0]; @@ -962,24 +962,24 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) // Create a reflection about the left edge of grandChild1. { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); + OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); - grandChild1->setReplicaLayer(grandChild1Replica.Pass()); + grandChild1->setReplicaLayer(grandChild1Replica.release()); } CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); + OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); - grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); + grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); @@ -1002,7 +1002,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) // CASE 2: removing the replica mask damages only the reflected region on the target surface. // clearDamageForAllSurfaces(root.get()); - grandChild1Replica->setMaskLayer(scoped_ptr<CCLayerImpl>()); + grandChild1Replica->setMaskLayer(nullptr); emulateDrawingOneFrame(root.get()); grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect(); @@ -1014,7 +1014,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); CCLayerImpl* child1 = root->children()[0]; CCLayerImpl* grandChild1 = child1->children()[0]; @@ -1024,24 +1024,24 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point. { - scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); + OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested. WebTransformationMatrix reflection; reflection.scale3d(-1, 1, 1); grandChild1Replica->setTransform(reflection); - grandChild1->setReplicaLayer(grandChild1Replica.Pass()); + grandChild1->setReplicaLayer(grandChild1Replica.release()); } CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); + OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); - grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); + grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); @@ -1062,7 +1062,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage) { - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; // Case 1: This test ensures that when the tracker is forced to have full damage, that @@ -1090,7 +1090,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList) // Though it should never happen, its a good idea to verify that the damage tracker // does not crash when it receives an empty layerList. - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->createRenderSurface(); ASSERT_TRUE(root == root->renderTarget()); @@ -1106,7 +1106,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageAccumulatesUntilReset) { // If damage is not cleared, it should accumulate. - scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0]; clearDamageForAllSurfaces(root.get()); diff --git a/cc/CCDelegatedRendererLayerImpl.h b/cc/CCDelegatedRendererLayerImpl.h index 4ed842e..7203faf 100644 --- a/cc/CCDelegatedRendererLayerImpl.h +++ b/cc/CCDelegatedRendererLayerImpl.h @@ -12,7 +12,7 @@ namespace cc { class CCDelegatedRendererLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCDelegatedRendererLayerImpl> create(int id) { return make_scoped_ptr(new CCDelegatedRendererLayerImpl(id)); } + static PassOwnPtr<CCDelegatedRendererLayerImpl> create(int id) { return adoptPtr(new CCDelegatedRendererLayerImpl(id)); } virtual ~CCDelegatedRendererLayerImpl(); virtual bool descendantDrawsContent() OVERRIDE; diff --git a/cc/CCDelegatedRendererLayerImplTest.cpp b/cc/CCDelegatedRendererLayerImplTest.cpp index 1744c6d..312a3d3 100644 --- a/cc/CCDelegatedRendererLayerImplTest.cpp +++ b/cc/CCDelegatedRendererLayerImplTest.cpp @@ -99,10 +99,10 @@ public: CCDelegatedRendererLayerImplTestSimple() : CCDelegatedRendererLayerImplTest() { - scoped_ptr<CCLayerImpl> rootLayer = CCSolidColorLayerImpl::create(1).PassAs<CCLayerImpl>(); - scoped_ptr<CCLayerImpl> layerBefore = CCSolidColorLayerImpl::create(2).PassAs<CCLayerImpl>(); - scoped_ptr<CCLayerImpl> layerAfter = CCSolidColorLayerImpl::create(3).PassAs<CCLayerImpl>(); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(4); + OwnPtr<CCSolidColorLayerImpl> rootLayer = CCSolidColorLayerImpl::create(1); + OwnPtr<CCSolidColorLayerImpl> layerBefore = CCSolidColorLayerImpl::create(2); + OwnPtr<CCSolidColorLayerImpl> layerAfter = CCSolidColorLayerImpl::create(3); + OwnPtr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(4); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); rootLayer->setBounds(IntSize(100, 100)); @@ -146,19 +146,19 @@ public: m_delegatedRendererLayerPtr = delegatedRendererLayer.get(); // Force the delegated RenderPasses to come before the RenderPass from layerAfter. - layerAfter->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); - rootLayer->addChild(layerAfter.Pass()); + layerAfter->addChild(delegatedRendererLayer.release()); + rootLayer->addChild(layerAfter.release()); // Get the RenderPass generated by layerBefore to come before the delegated RenderPasses. - rootLayer->addChild(layerBefore.Pass()); + rootLayer->addChild(layerBefore.release()); - m_hostImpl->setRootLayer(rootLayer.Pass()); + m_hostImpl->setRootLayer(rootLayer.release()); } protected: - CCLayerImpl* m_rootLayerPtr; - CCLayerImpl* m_layerBeforePtr; - CCLayerImpl* m_layerAfterPtr; + CCSolidColorLayerImpl* m_rootLayerPtr; + CCSolidColorLayerImpl* m_layerBeforePtr; + CCSolidColorLayerImpl* m_layerAfterPtr; CCDelegatedRendererLayerImpl* m_delegatedRendererLayerPtr; }; @@ -382,8 +382,8 @@ public: CCDelegatedRendererLayerImplTestSharedData() : CCDelegatedRendererLayerImplTest() { - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(2); + OwnPtr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + OwnPtr<CCDelegatedRendererLayerImpl> delegatedRendererLayer = CCDelegatedRendererLayerImpl::create(2); m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); rootLayer->setBounds(IntSize(100, 100)); @@ -414,9 +414,9 @@ public: m_rootLayerPtr = rootLayer.get(); m_delegatedRendererLayerPtr = delegatedRendererLayer.get(); - rootLayer->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(delegatedRendererLayer.release()); - m_hostImpl->setRootLayer(rootLayer.Pass()); + m_hostImpl->setRootLayer(rootLayer.release()); } protected: diff --git a/cc/CCHeadsUpDisplayLayerImpl.h b/cc/CCHeadsUpDisplayLayerImpl.h index 47e7cfe..234149d 100644 --- a/cc/CCHeadsUpDisplayLayerImpl.h +++ b/cc/CCHeadsUpDisplayLayerImpl.h @@ -20,9 +20,9 @@ class CCFrameRateCounter; class CCHeadsUpDisplayLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id) + static PassOwnPtr<CCHeadsUpDisplayLayerImpl> create(int id) { - return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id)); + return adoptPtr(new CCHeadsUpDisplayLayerImpl(id)); } virtual ~CCHeadsUpDisplayLayerImpl(); diff --git a/cc/CCIOSurfaceLayerImpl.h b/cc/CCIOSurfaceLayerImpl.h index 238e27e..4f94a5c 100644 --- a/cc/CCIOSurfaceLayerImpl.h +++ b/cc/CCIOSurfaceLayerImpl.h @@ -12,9 +12,9 @@ namespace cc { class CCIOSurfaceLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCIOSurfaceLayerImpl> create(int id) + static PassOwnPtr<CCIOSurfaceLayerImpl> create(int id) { - return make_scoped_ptr(new CCIOSurfaceLayerImpl(id)); + return adoptPtr(new CCIOSurfaceLayerImpl(id)); } virtual ~CCIOSurfaceLayerImpl(); diff --git a/cc/CCLayerImpl.cpp b/cc/CCLayerImpl.cpp index 16c9356..e0dc509 100644 --- a/cc/CCLayerImpl.cpp +++ b/cc/CCLayerImpl.cpp @@ -73,10 +73,10 @@ CCLayerImpl::~CCLayerImpl() #endif } -void CCLayerImpl::addChild(scoped_ptr<CCLayerImpl> child) +void CCLayerImpl::addChild(PassOwnPtr<CCLayerImpl> child) { child->setParent(this); - m_children.append(child.Pass()); + m_children.append(child); } void CCLayerImpl::removeFromParent() @@ -413,9 +413,9 @@ void CCLayerImpl::setBounds(const IntSize& bounds) m_layerPropertyChanged = true; } -void CCLayerImpl::setMaskLayer(scoped_ptr<CCLayerImpl> maskLayer) +void CCLayerImpl::setMaskLayer(PassOwnPtr<CCLayerImpl> maskLayer) { - m_maskLayer = maskLayer.Pass(); + m_maskLayer = maskLayer; int newLayerId = m_maskLayer ? m_maskLayer->id() : -1; if (newLayerId == m_maskLayerId) @@ -425,9 +425,9 @@ void CCLayerImpl::setMaskLayer(scoped_ptr<CCLayerImpl> maskLayer) noteLayerPropertyChangedForSubtree(); } -void CCLayerImpl::setReplicaLayer(scoped_ptr<CCLayerImpl> replicaLayer) +void CCLayerImpl::setReplicaLayer(PassOwnPtr<CCLayerImpl> replicaLayer) { - m_replicaLayer = replicaLayer.Pass(); + m_replicaLayer = replicaLayer; int newLayerId = m_replicaLayer ? m_replicaLayer->id() : -1; if (newLayerId == m_replicaLayerId) diff --git a/cc/CCLayerImpl.h b/cc/CCLayerImpl.h index f8a1a7d..665b000 100644 --- a/cc/CCLayerImpl.h +++ b/cc/CCLayerImpl.h @@ -5,8 +5,6 @@ #ifndef CCLayerImpl_h #define CCLayerImpl_h -#include "base/memory/scoped_ptr.h" -#include "cc/scoped_ptr_vector.h" #include "CCInputHandler.h" #include "CCLayerAnimationController.h" #include "CCRenderPass.h" @@ -17,10 +15,13 @@ #include "IntRect.h" #include "Region.h" #include "SkColor.h" +#include "cc/own_ptr_vector.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> #include <string> #include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace cc { @@ -36,9 +37,9 @@ struct CCAppendQuadsData; class CCLayerImpl : public CCLayerAnimationControllerClient { public: - static scoped_ptr<CCLayerImpl> create(int id) + static PassOwnPtr<CCLayerImpl> create(int id) { - return make_scoped_ptr(new CCLayerImpl(id)); + return adoptPtr(new CCLayerImpl(id)); } virtual ~CCLayerImpl(); @@ -52,15 +53,15 @@ public: // Tree structure. CCLayerImpl* parent() const { return m_parent; } - const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; } - void addChild(scoped_ptr<CCLayerImpl>); + const OwnPtrVector<CCLayerImpl>& children() const { return m_children; } + void addChild(PassOwnPtr<CCLayerImpl>); void removeFromParent(); void removeAllChildren(); - void setMaskLayer(scoped_ptr<CCLayerImpl>); + void setMaskLayer(PassOwnPtr<CCLayerImpl>); CCLayerImpl* maskLayer() const { return m_maskLayer.get(); } - void setReplicaLayer(scoped_ptr<CCLayerImpl>); + void setReplicaLayer(PassOwnPtr<CCLayerImpl>); CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); } bool hasMask() const { return m_maskLayer; } @@ -283,12 +284,12 @@ private: // Properties internal to CCLayerImpl CCLayerImpl* m_parent; - ScopedPtrVector<CCLayerImpl> m_children; + OwnPtrVector<CCLayerImpl> m_children; // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one int m_maskLayerId; - scoped_ptr<CCLayerImpl> m_maskLayer; + OwnPtr<CCLayerImpl> m_maskLayer; int m_replicaLayerId; // ditto - scoped_ptr<CCLayerImpl> m_replicaLayer; + OwnPtr<CCLayerImpl> m_replicaLayer; int m_layerId; CCLayerTreeHostImpl* m_layerTreeHostImpl; diff --git a/cc/CCLayerImplTest.cpp b/cc/CCLayerImplTest.cpp index acaac9b..fc9686d 100644 --- a/cc/CCLayerImplTest.cpp +++ b/cc/CCLayerImplTest.cpp @@ -60,7 +60,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) DebugScopedSetImplThread setImplThread; // Create a simple CCLayerImpl tree: - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->addChild(CCLayerImpl::create(2)); CCLayerImpl* child = root->children()[0]; child->addChild(CCLayerImpl::create(3)); diff --git a/cc/CCLayerSorterTest.cpp b/cc/CCLayerSorterTest.cpp index e2bb912..d8a3675 100644 --- a/cc/CCLayerSorterTest.cpp +++ b/cc/CCLayerSorterTest.cpp @@ -203,11 +203,11 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) // - 3 and 4 do not have a 3d z difference, and therefore their relative ordering should be retained. // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. - scoped_ptr<CCLayerImpl> layer1 = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> layer2 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> layer3 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> layer4 = CCLayerImpl::create(4); - scoped_ptr<CCLayerImpl> layer5 = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); WebTransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); diff --git a/cc/CCLayerTreeHostCommon.h b/cc/CCLayerTreeHostCommon.h index d22c8f0..cf80a0cc 100644 --- a/cc/CCLayerTreeHostCommon.h +++ b/cc/CCLayerTreeHostCommon.h @@ -6,7 +6,7 @@ #define CCLayerTreeHostCommon_h #include "base/memory/ref_counted.h" -#include "cc/scoped_ptr_vector.h" +#include "cc/own_ptr_vector.h" #include "IntRect.h" #include "IntSize.h" #include <public/WebTransformationMatrix.h> @@ -39,7 +39,7 @@ public: return children[index].get(); } - static CCLayerImpl* getChildAsRawPtr(const ScopedPtrVector<CCLayerImpl>& children, size_t index) + static CCLayerImpl* getChildAsRawPtr(const OwnPtrVector<CCLayerImpl>& children, size_t index) { return children[index]; } diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp index e91b8ff..5d46962 100644 --- a/cc/CCLayerTreeHostCommonTest.cpp +++ b/cc/CCLayerTreeHostCommonTest.cpp @@ -90,12 +90,12 @@ WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& return ret; } -scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests() +PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests() { - 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); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4); WebTransformationMatrix IdentityMatrix; FloatPoint anchor(0, 0); @@ -106,11 +106,11 @@ scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests() setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false); setLayerPropertiesForTesting(greatGrandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false); - grandChild->addChild(greatGrandChild.Pass()); - child->addChild(grandChild.Pass()); - root->addChild(child.Pass()); + grandChild->addChild(greatGrandChild.release()); + child->addChild(grandChild.release()); + root->addChild(child.release()); - return root.Pass(); + return root.release(); } class LayerChromiumWithForcedDrawsContent : public LayerChromium { @@ -763,7 +763,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // is the direct parent of the fixed-position layer. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); CCLayerImpl* child = root->children()[0]; CCLayerImpl* grandChild = child->children()[0]; @@ -804,7 +804,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // order. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - greatGrandChild->addChild(fixedPositionChild.Pass()); + greatGrandChild->addChild(fixedPositionChild.release()); } CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0]; @@ -1199,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // is completely irrelevant; it should not affect the scroll compensation. DebugScopedSetImplThread scopedImplThread; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<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; - scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests(); + OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); CCLayerImpl* child = root->children()[0]; CCLayerImpl* grandChild = child->children()[0]; @@ -2671,7 +2671,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2713,7 +2713,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); WebTransformationMatrix uninvertibleTransform; uninvertibleTransform.setM11(0); @@ -2774,7 +2774,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2817,7 +2817,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); WebTransformationMatrix identityMatrix; WebTransformationMatrix rotation45DegreesAboutCenter; @@ -2868,7 +2868,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); WebTransformationMatrix identityMatrix; @@ -2930,7 +2930,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<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); - scoped_ptr<CCLayerImpl> testLayer = CCLayerImpl::create(12345); + OwnPtr<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.Pass()); + root->addChild(testLayer.release()); } std::vector<CCLayerImpl*> renderSurfaceLayerList; @@ -2995,23 +2995,23 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { - scoped_ptr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123); + OwnPtr<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); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); + OwnPtr<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.Pass()); - root->addChild(clippingLayer.Pass()); + clippingLayer->addChild(child.release()); + root->addChild(clippingLayer.release()); } std::vector<CCLayerImpl*> renderSurfaceLayerList; @@ -3060,7 +3060,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(123); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3070,9 +3070,9 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) root->setMasksToBounds(true); { - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(789); - scoped_ptr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); + OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(789); + OwnPtr<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.Pass()); - child->addChild(grandChild.Pass()); - root->addChild(child.Pass()); + grandChild->addChild(rotatedLeaf.release()); + child->addChild(grandChild.release()); + root->addChild(child.release()); } std::vector<CCLayerImpl*> renderSurfaceLayerList; @@ -3163,11 +3163,11 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { - scoped_ptr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123); + OwnPtr<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. - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456); + OwnPtr<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.Pass()); - root->addChild(intermediateLayer.Pass()); + intermediateLayer->addChild(child.release()); + root->addChild(intermediateLayer.release()); } std::vector<CCLayerImpl*> renderSurfaceLayerList; @@ -3221,7 +3221,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) { DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<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. - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<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.Pass()); - root->addChild(child1.Pass()); - root->addChild(child2.Pass()); + child1->addChild(grandChild1.release()); + root->addChild(child1.release()); + root->addChild(child2.release()); } CCLayerImpl* child1 = root->children()[0]; @@ -3326,7 +3326,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) // DebugScopedSetImplThread thisScopeIsOnImplThread; - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<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. - scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); - scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<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.Pass()); - root->addChild(child1.Pass()); - root->addChild(child2.Pass()); + child1->addChild(grandChild1.release()); + root->addChild(child1.release()); + root->addChild(child2.release()); } CCLayerImpl* child1 = root->children()[0]; diff --git a/cc/CCLayerTreeHostImpl.cpp b/cc/CCLayerTreeHostImpl.cpp index d75c240..1f7638f 100644 --- a/cc/CCLayerTreeHostImpl.cpp +++ b/cc/CCLayerTreeHostImpl.cpp @@ -786,9 +786,9 @@ static CCLayerImpl* findScrollLayerForContentLayer(CCLayerImpl* layerImpl) return 0; } -void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer) +void CCLayerTreeHostImpl::setRootLayer(PassOwnPtr<CCLayerImpl> layer) { - m_rootLayerImpl = layer.Pass(); + m_rootLayerImpl = layer; m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get()); m_currentlyScrollingLayerImpl = 0; @@ -800,14 +800,14 @@ void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer) m_client->onCanDrawStateChanged(canDraw()); } -scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() +PassOwnPtr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() { // Clear all data structures that have direct references to the layer tree. m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_currentlyScrollingLayerImpl->id() : -1; m_currentlyScrollingLayerImpl = 0; m_renderSurfaceLayerList.clear(); - return m_rootLayerImpl.Pass(); + return m_rootLayerImpl.release(); } void CCLayerTreeHostImpl::setVisible(bool visible) diff --git a/cc/CCLayerTreeHostImpl.h b/cc/CCLayerTreeHostImpl.h index 297f619..4b8a85f 100644 --- a/cc/CCLayerTreeHostImpl.h +++ b/cc/CCLayerTreeHostImpl.h @@ -174,7 +174,7 @@ public: void readback(void* pixels, const IntRect&); - void setRootLayer(scoped_ptr<CCLayerImpl>); + void setRootLayer(PassOwnPtr<CCLayerImpl>); CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); } void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; } @@ -182,7 +182,7 @@ public: // Release ownership of the current layer tree and replace it with an empty // tree. Returns the root layer of the detached tree. - scoped_ptr<CCLayerImpl> detachLayerTree(); + PassOwnPtr<CCLayerImpl> detachLayerTree(); CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } @@ -307,7 +307,7 @@ private: scoped_ptr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; OwnPtr<CCRenderer> m_renderer; - scoped_ptr<CCLayerImpl> m_rootLayerImpl; + OwnPtr<CCLayerImpl> m_rootLayerImpl; CCLayerImpl* m_rootScrollLayerImpl; CCLayerImpl* m_currentlyScrollingLayerImpl; CCHeadsUpDisplayLayerImpl* m_hudLayerImpl; diff --git a/cc/CCLayerTreeHostImplTest.cpp b/cc/CCLayerTreeHostImplTest.cpp index ef0ca1858..790ec0e 100644 --- a/cc/CCLayerTreeHostImplTest.cpp +++ b/cc/CCLayerTreeHostImplTest.cpp @@ -88,7 +88,7 @@ public: virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } - scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<CCGraphicsContext> graphicsContext, scoped_ptr<CCLayerImpl> root) + scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) { CCSettings::setPartialSwapEnabled(partialSwap); @@ -100,13 +100,15 @@ public: myHostImpl->initializeRenderer(graphicsContext.Pass()); myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + OwnPtr<CCLayerImpl> root = rootPtr; + root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(IntSize(10, 10)); root->setVisibleContentRect(IntRect(0, 0, 10, 10)); root->setDrawsContent(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); return myHostImpl.Pass(); } @@ -134,7 +136,7 @@ public: void setupScrollAndContentsLayers(const IntSize& contentSize) { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); root->setMaxScrollPosition(contentSize); @@ -143,25 +145,25 @@ public: root->setPosition(FloatPoint(0, 0)); root->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCLayerImpl> contents = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> contents = CCLayerImpl::create(2); contents->setDrawsContent(true); contents->setBounds(contentSize); contents->setContentBounds(contentSize); contents->setPosition(FloatPoint(0, 0)); contents->setAnchorPoint(FloatPoint(0, 0)); - root->addChild(contents.Pass()); - m_hostImpl->setRootLayer(root.Pass()); + root->addChild(contents.release()); + m_hostImpl->setRootLayer(root.release()); } - static scoped_ptr<CCLayerImpl> createScrollableLayer(int id, const IntSize& size) + static PassOwnPtr<CCLayerImpl> createScrollableLayer(int id, const IntSize& size) { - scoped_ptr<CCLayerImpl> layer = CCLayerImpl::create(id); + OwnPtr<CCLayerImpl> layer = CCLayerImpl::create(id); layer->setScrollable(true); layer->setDrawsContent(true); layer->setBounds(size); layer->setContentBounds(size); layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)); - return layer.Pass(); + return layer.release(); } void initializeRendererAndDrawFrame() @@ -208,7 +210,7 @@ TEST_P(CCLayerTreeHostImplTest, notifyIfCanDrawChanged) m_onCanDrawStateChangedCalled = false; // Toggle the root layer to make sure it toggles canDraw - m_hostImpl->setRootLayer(scoped_ptr<CCLayerImpl>()); + m_hostImpl->setRootLayer(adoptPtr<CCLayerImpl>(0)); EXPECT_FALSE(m_hostImpl->canDraw()); EXPECT_TRUE(m_onCanDrawStateChangedCalled); m_onCanDrawStateChangedCalled = false; @@ -252,13 +254,13 @@ TEST_P(CCLayerTreeHostImplTest, scrollDeltaNoLayers) TEST_P(CCLayerTreeHostImplTest, scrollDeltaTreeButNoChanges) { { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->addChild(CCLayerImpl::create(2)); root->addChild(CCLayerImpl::create(3)); root->children()[1]->addChild(CCLayerImpl::create(4)); root->children()[1]->addChild(CCLayerImpl::create(5)); root->children()[1]->children()[0]->addChild(CCLayerImpl::create(6)); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); } CCLayerImpl* root = m_hostImpl->rootLayer(); @@ -280,12 +282,12 @@ TEST_P(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls) IntPoint scrollPosition(20, 30); IntSize scrollDelta(11, -15); { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setScrollPosition(scrollPosition); root->setScrollable(true); root->setMaxScrollPosition(IntSize(100, 100)); root->scrollBy(scrollDelta); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); } CCLayerImpl* root = m_hostImpl->rootLayer(); @@ -779,7 +781,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa class DidDrawCheckLayer : public CCTiledLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new DidDrawCheckLayer(id)); } + static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); } virtual void didDraw(CCResourceProvider*) OVERRIDE { @@ -936,10 +938,7 @@ TEST_P(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) class MissingTextureAnimatingLayer : public DidDrawCheckLayer { public: - static scoped_ptr<CCLayerImpl> create(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) - { - return scoped_ptr<CCLayerImpl>(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); - } + static PassOwnPtr<MissingTextureAnimatingLayer> create(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) { return adoptPtr(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating, resourceProvider)); } private: explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) @@ -1001,9 +1000,9 @@ TEST_P(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) TEST_P(CCLayerTreeHostImplTest, scrollRootIgnored) { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setScrollable(false); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); initializeRendererAndDrawFrame(); // Scroll event is ignored because layer is not scrollable. @@ -1018,7 +1017,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) // scrollable outer layer. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> contentLayer = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> contentLayer = CCLayerImpl::create(1); contentLayer->setUseLCDText(true); contentLayer->setDrawsContent(true); contentLayer->setPosition(FloatPoint(0, 0)); @@ -1026,16 +1025,16 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) contentLayer->setBounds(surfaceSize); contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2)); - scoped_ptr<CCLayerImpl> scrollLayer = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> scrollLayer = CCLayerImpl::create(2); scrollLayer->setScrollable(true); scrollLayer->setMaxScrollPosition(surfaceSize); scrollLayer->setBounds(surfaceSize); scrollLayer->setContentBounds(surfaceSize); scrollLayer->setPosition(FloatPoint(0, 0)); scrollLayer->setAnchorPoint(FloatPoint(0, 0)); - scrollLayer->addChild(contentLayer.Pass()); + scrollLayer->addChild(contentLayer.release()); - m_hostImpl->setRootLayer(scrollLayer.Pass()); + m_hostImpl->setRootLayer(scrollLayer.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1049,11 +1048,11 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonCompositedRoot) TEST_P(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); root->addChild(createScrollableLayer(2, surfaceSize)); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1067,9 +1066,9 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) TEST_P(CCLayerTreeHostImplTest, scrollMissesChild) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->addChild(createScrollableLayer(2, surfaceSize)); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1082,8 +1081,8 @@ TEST_P(CCLayerTreeHostImplTest, scrollMissesChild) TEST_P(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); WebTransformationMatrix matrix; @@ -1091,8 +1090,8 @@ TEST_P(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) child->setTransform(matrix); child->setDoubleSided(false); - root->addChild(child.Pass()); - m_hostImpl->setRootLayer(root.Pass()); + root->addChild(child.release()); + m_hostImpl->setRootLayer(root.release()); initializeRendererAndDrawFrame(); // Scroll event is ignored because the scrollable layer is not facing the viewer and there is @@ -1105,14 +1104,14 @@ TEST_P(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) TEST_P(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); + OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); contentLayer->setShouldScrollOnMainThread(true); contentLayer->setScrollable(false); - scoped_ptr<CCLayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); - scrollLayer->addChild(contentLayer.Pass()); + OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); + scrollLayer->addChild(contentLayer.release()); - m_hostImpl->setRootLayer(scrollLayer.Pass()); + m_hostImpl->setRootLayer(scrollLayer.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1124,8 +1123,8 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - m_hostImpl->setRootLayer(root.Pass()); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1157,8 +1156,8 @@ TEST_P(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - m_hostImpl->setRootLayer(root.Pass()); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); initializeRendererAndDrawFrame(); @@ -1204,8 +1203,8 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) CCLayerImpl* root = m_hostImpl->rootLayer(); CCLayerImpl* child = root->children()[0]; - scoped_ptr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); - child->addChild(scrollableChild.Pass()); + OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); + child->addChild(scrollableChild.release()); CCLayerImpl* grandChild = child->children()[0]; // Set new page scale on impl thread by pinching. @@ -1237,14 +1236,14 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) TEST_P(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); // Also mark the root scrollable so it becomes the root scroll layer. root->setScrollable(true); int scrollLayerId = 2; root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); @@ -1283,17 +1282,17 @@ TEST_P(CCLayerTreeHostImplTest, scrollChildBeyondLimit) // parent layer is scrolled on the axis on which the child was unable to // scroll. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - scoped_ptr<CCLayerImpl> grandChild = createScrollableLayer(3, surfaceSize); + OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(3, surfaceSize); grandChild->setScrollPosition(IntPoint(0, 5)); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollPosition(IntPoint(3, 0)); - child->addChild(grandChild.Pass()); + child->addChild(grandChild.release()); - root->addChild(child.Pass()); - m_hostImpl->setRootLayer(root.Pass()); + root->addChild(child.release()); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); { @@ -1319,13 +1318,13 @@ TEST_P(CCLayerTreeHostImplTest, scrollEventBubbling) // When we try to scroll a non-scrollable child layer, the scroll delta // should be applied to one of its ancestors if possible. IntSize surfaceSize(10, 10); - scoped_ptr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - scoped_ptr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollable(false); - root->addChild(child.Pass()); + root->addChild(child.release()); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeRendererAndDrawFrame(); { @@ -1399,7 +1398,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) float childLayerAngle = -20; // Create a child layer that is rotated to a non-axis-aligned angle. - scoped_ptr<CCLayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->contentBounds()); + OwnPtr<CCLayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->contentBounds()); WebTransformationMatrix rotateTransform; rotateTransform.translate(-50, -50); rotateTransform.rotate(childLayerAngle); @@ -1408,7 +1407,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) // Only allow vertical scrolling. child->setMaxScrollPosition(IntSize(0, child->contentBounds().height())); - m_hostImpl->rootLayer()->addChild(child.Pass()); + m_hostImpl->rootLayer()->addChild(child.release()); IntSize surfaceSize(50, 50); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); @@ -1513,7 +1512,7 @@ private: class BlendStateCheckLayer : public CCLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id, CCResourceProvider* resourceProvider) { return scoped_ptr<CCLayerImpl>(new BlendStateCheckLayer(id, resourceProvider)); } + static PassOwnPtr<BlendStateCheckLayer> create(int id, CCResourceProvider* resourceProvider) { return adoptPtr(new BlendStateCheckLayer(id, resourceProvider)); } virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE { @@ -1574,12 +1573,12 @@ private: TEST_P(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { { - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(root->bounds()); root->setDrawsContent(false); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(root.release()); } CCLayerImpl* root = m_hostImpl->rootLayer(); @@ -1866,8 +1865,6 @@ private: class FakeDrawableCCLayerImpl: public CCLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new FakeDrawableCCLayerImpl(id)); } -protected: explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } }; @@ -1880,11 +1877,11 @@ TEST_P(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); m_hostImpl->initializeRenderer(ccContext.Pass()); - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setDrawsContent(true); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(adoptPtr(root)); EXPECT_FALSE(reshapeTracker->reshapeCalled()); CCLayerTreeHostImpl::FrameData frame; @@ -1930,8 +1927,8 @@ TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) layerTreeHostImpl->initializeRenderer(ccContext.Pass()); layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); child->setPosition(FloatPoint(12, 13)); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(14, 15)); @@ -1941,8 +1938,8 @@ TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) root->setBounds(IntSize(500, 500)); root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); - root->addChild(child.Pass()); - layerTreeHostImpl->setRootLayer(root.Pass()); + root->addChild(adoptPtr(child)); + layerTreeHostImpl->setRootLayer(adoptPtr(root)); CCLayerTreeHostImpl::FrameData frame; @@ -1993,8 +1990,8 @@ TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) { - scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(10, 10)); child->setContentBounds(IntSize(10, 10)); @@ -2004,9 +2001,9 @@ TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) root->setContentBounds(IntSize(10, 10)); root->setDrawsContent(true); root->setOpacity(0.7f); - root->addChild(child.Pass()); + root->addChild(adoptPtr(child)); - m_hostImpl->setRootLayer(root.Pass()); + m_hostImpl->setRootLayer(adoptPtr(root)); CCLayerTreeHostImpl::FrameData frame; @@ -2020,7 +2017,7 @@ TEST_P(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) class FakeLayerWithQuads : public CCLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new FakeLayerWithQuads(id)); } + static PassOwnPtr<FakeLayerWithQuads> create(int id) { return adoptPtr(new FakeLayerWithQuads(id)); } virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE { @@ -2235,9 +2232,9 @@ static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C Layers 1, 2 have render surfaces */ - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); - scoped_ptr<CCLayerImpl> grandChild = FakeLayerWithQuads::create(3); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> grandChild = FakeLayerWithQuads::create(3); IntRect rootRect(0, 0, 100, 100); IntRect childRect(10, 10, 50, 50); @@ -2267,10 +2264,10 @@ static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C grandChild->setVisibleContentRect(grandChildRect); grandChild->setDrawsContent(true); - child->addChild(grandChild.Pass()); - root->addChild(child.Pass()); + child->addChild(grandChild.release()); + root->addChild(child.release()); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); return myHostImpl.Pass(); } @@ -2319,7 +2316,7 @@ TEST_P(CCLayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) // Make sure that context lost notifications are propagated through the tree. class ContextLostNotificationCheckLayer : public CCLayerImpl { public: - static scoped_ptr<CCLayerImpl> create(int id) { return scoped_ptr<CCLayerImpl>(new ContextLostNotificationCheckLayer(id)); } + static PassOwnPtr<ContextLostNotificationCheckLayer> create(int id) { return adoptPtr(new ContextLostNotificationCheckLayer(id)); } virtual void didLoseContext() OVERRIDE { @@ -2594,9 +2591,9 @@ class FakeWebScrollbarThemeGeometryNonEmpty : public FakeWebScrollbarThemeGeomet class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { public: - static scoped_ptr<FakeScrollbarLayerImpl> create(int id) + static PassOwnPtr<FakeScrollbarLayerImpl> create(int id) { - return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); + return adoptPtr(new FakeScrollbarLayerImpl(id)); } void createResources(CCResourceProvider* provider) @@ -2638,11 +2635,11 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) { int layerId = 1; - scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(layerId++)); + OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(layerId++)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(layerId++); + OwnPtr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(layerId++); tileLayer->setBounds(IntSize(10, 10)); tileLayer->setAnchorPoint(FloatPoint(0, 0)); tileLayer->setContentBounds(IntSize(10, 10)); @@ -2652,17 +2649,17 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(tileLayer.release()); - scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(layerId++); + OwnPtr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(layerId++); textureLayer->setBounds(IntSize(10, 10)); textureLayer->setAnchorPoint(FloatPoint(0, 0)); textureLayer->setContentBounds(IntSize(10, 10)); textureLayer->setDrawsContent(true); textureLayer->setTextureId(1); - rootLayer->addChild(textureLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(textureLayer.release()); - scoped_ptr<CCTiledLayerImpl> maskLayer = CCTiledLayerImpl::create(layerId++); + OwnPtr<CCTiledLayerImpl> maskLayer = CCTiledLayerImpl::create(layerId++); maskLayer->setBounds(IntSize(10, 10)); maskLayer->setAnchorPoint(FloatPoint(0, 0)); maskLayer->setContentBounds(IntSize(10, 10)); @@ -2671,63 +2668,63 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) maskLayer->setTilingData(*tilingData); maskLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - scoped_ptr<CCTextureLayerImpl> textureLayerWithMask = CCTextureLayerImpl::create(layerId++); + OwnPtr<CCTextureLayerImpl> textureLayerWithMask = CCTextureLayerImpl::create(layerId++); textureLayerWithMask->setBounds(IntSize(10, 10)); textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0)); textureLayerWithMask->setContentBounds(IntSize(10, 10)); textureLayerWithMask->setDrawsContent(true); textureLayerWithMask->setTextureId(1); - textureLayerWithMask->setMaskLayer(maskLayer.PassAs<CCLayerImpl>()); - rootLayer->addChild(textureLayerWithMask.PassAs<CCLayerImpl>()); + textureLayerWithMask->setMaskLayer(maskLayer.release()); + rootLayer->addChild(textureLayerWithMask.release()); FakeVideoFrame videoFrame; FakeVideoFrameProvider provider; provider.setFrame(&videoFrame); - scoped_ptr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(layerId++, &provider); + OwnPtr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(layerId++, &provider); videoLayer->setBounds(IntSize(10, 10)); videoLayer->setAnchorPoint(FloatPoint(0, 0)); videoLayer->setContentBounds(IntSize(10, 10)); videoLayer->setDrawsContent(true); videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(videoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(videoLayer.release()); FakeVideoFrame hwVideoFrame; FakeVideoFrameProvider hwProvider; hwProvider.setFrame(&hwVideoFrame); - scoped_ptr<CCVideoLayerImpl> hwVideoLayer = CCVideoLayerImpl::create(layerId++, &hwProvider); + OwnPtr<CCVideoLayerImpl> hwVideoLayer = CCVideoLayerImpl::create(layerId++, &hwProvider); hwVideoLayer->setBounds(IntSize(10, 10)); hwVideoLayer->setAnchorPoint(FloatPoint(0, 0)); hwVideoLayer->setContentBounds(IntSize(10, 10)); hwVideoLayer->setDrawsContent(true); hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(hwVideoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(hwVideoLayer.release()); - scoped_ptr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(layerId++); + OwnPtr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(layerId++); ioSurfaceLayer->setBounds(IntSize(10, 10)); ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); ioSurfaceLayer->setContentBounds(IntSize(10, 10)); ioSurfaceLayer->setDrawsContent(true); ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(ioSurfaceLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(ioSurfaceLayer.release()); - scoped_ptr<CCHeadsUpDisplayLayerImpl> hudLayer = CCHeadsUpDisplayLayerImpl::create(layerId++); + OwnPtr<CCHeadsUpDisplayLayerImpl> hudLayer = CCHeadsUpDisplayLayerImpl::create(layerId++); hudLayer->setBounds(IntSize(10, 10)); hudLayer->setAnchorPoint(FloatPoint(0, 0)); hudLayer->setContentBounds(IntSize(10, 10)); hudLayer->setDrawsContent(true); hudLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(hudLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(hudLayer.release()); - scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++)); + OwnPtr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++)); scrollbarLayer->setBounds(IntSize(10, 10)); scrollbarLayer->setContentBounds(IntSize(10, 10)); scrollbarLayer->setDrawsContent(true); scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); scrollbarLayer->createResources(m_hostImpl->resourceProvider()); - rootLayer->addChild(scrollbarLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(scrollbarLayer.release()); - scoped_ptr<CCDelegatedRendererLayerImpl> delegatedRendererLayer(CCDelegatedRendererLayerImpl::create(layerId++)); + OwnPtr<CCDelegatedRendererLayerImpl> delegatedRendererLayer(CCDelegatedRendererLayerImpl::create(layerId++)); delegatedRendererLayer->setBounds(IntSize(10, 10)); delegatedRendererLayer->setContentBounds(IntSize(10, 10)); delegatedRendererLayer->setDrawsContent(true); @@ -2736,14 +2733,14 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider())); delegatedRendererLayer->setRenderPasses(passList); EXPECT_TRUE(passList.isEmpty()); - rootLayer->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(delegatedRendererLayer.release()); // Use a context that supports IOSurfaces m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture()); - m_hostImpl->setRootLayer(rootLayer.Pass()); + m_hostImpl->setRootLayer(rootLayer.release()); CCLayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); @@ -2823,11 +2820,11 @@ private: TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) { - scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(1)); + OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(1)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); - scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2); + OwnPtr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2); tileLayer->setBounds(IntSize(10, 10)); tileLayer->setAnchorPoint(FloatPoint(0, 0)); tileLayer->setContentBounds(IntSize(10, 10)); @@ -2837,40 +2834,40 @@ TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); - rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(tileLayer.release()); - scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3); + OwnPtr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3); textureLayer->setBounds(IntSize(10, 10)); textureLayer->setAnchorPoint(FloatPoint(0, 0)); textureLayer->setContentBounds(IntSize(10, 10)); textureLayer->setDrawsContent(true); textureLayer->setTextureId(1); - rootLayer->addChild(textureLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(textureLayer.release()); FakeVideoFrameProvider provider; - scoped_ptr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(4, &provider); + OwnPtr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(4, &provider); videoLayer->setBounds(IntSize(10, 10)); videoLayer->setAnchorPoint(FloatPoint(0, 0)); videoLayer->setContentBounds(IntSize(10, 10)); videoLayer->setDrawsContent(true); videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(videoLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(videoLayer.release()); - scoped_ptr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(5); + OwnPtr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(5); ioSurfaceLayer->setBounds(IntSize(10, 10)); ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); ioSurfaceLayer->setContentBounds(IntSize(10, 10)); ioSurfaceLayer->setDrawsContent(true); ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); - rootLayer->addChild(ioSurfaceLayer.PassAs<CCLayerImpl>()); + rootLayer->addChild(ioSurfaceLayer.release()); // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of). scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new TrackingWebGraphicsContext3D))); TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); m_hostImpl->initializeRenderer(ccContext.Pass()); - m_hostImpl->setRootLayer(rootLayer.Pass()); + m_hostImpl->setRootLayer(rootLayer.release()); CCLayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); @@ -2923,7 +2920,7 @@ TEST_P(CCLayerTreeHostImplTest, hasTransparentBackground) static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerRect, CCLayerImpl** result) { - scoped_ptr<CCLayerImpl> layer = FakeLayerWithQuads::create(id); + OwnPtr<CCLayerImpl> layer = FakeLayerWithQuads::create(id); CCLayerImpl* layerPtr = layer.get(); layerPtr->setAnchorPoint(FloatPoint(0, 0)); layerPtr->setPosition(FloatPoint(layerRect.location())); @@ -2931,7 +2928,7 @@ static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerR layerPtr->setContentBounds(layerRect.size()); layerPtr->setDrawsContent(true); // only children draw content layerPtr->setContentsOpaque(true); - parent->addChild(layer.Pass()); + parent->addChild(layer.release()); if (result) *result = layerPtr; } @@ -2943,7 +2940,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, layerTreeHostImpl->initializeRenderer(context.Pass()); layerTreeHostImpl->setViewportSize(rootSize, rootSize); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -2951,7 +2948,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, root->setBounds(rootSize); root->setContentBounds(rootSize); root->setDrawsContent(true); - layerTreeHostImpl->setRootLayer(root.Pass()); + layerTreeHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr); intermediateLayerPtr->setDrawsContent(false); // only children draw content @@ -2989,7 +2986,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -2998,7 +2995,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 3, IntRect(0, 0, rootSize.width(), rootSize.height()), &surfaceLayerPtr); surfaceLayerPtr->setDrawsContent(false); @@ -3101,7 +3098,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3110,7 +3107,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); layerS1Ptr->setForceRenderSurface(true); @@ -3214,7 +3211,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3223,7 +3220,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 800, 800), &layerS1Ptr); layerS1Ptr->setForceRenderSurface(true); @@ -3328,7 +3325,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3337,7 +3334,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); layerS1Ptr->setForceRenderSurface(true); @@ -3411,7 +3408,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3420,7 +3417,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); layerS1Ptr->setForceRenderSurface(true); @@ -3496,7 +3493,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) myHostImpl->initializeRenderer(context.Pass()); myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height())); - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); @@ -3505,7 +3502,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) root->setContentBounds(rootSize); root->setDrawsContent(true); root->setMasksToBounds(true); - myHostImpl->setRootLayer(root.Pass()); + myHostImpl->setRootLayer(root.release()); addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); layerS1Ptr->setForceRenderSurface(true); @@ -3602,9 +3599,9 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) Layers 1, 2 have render surfaces */ - scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); - scoped_ptr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); - scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); + OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); IntRect rootRect(0, 0, 100, 100); IntRect childRect(10, 10, 50, 50); @@ -3642,9 +3639,9 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) CCTiledLayerImpl* childPtr = child.get(); CCRenderPass::Id childPassId(childPtr->id(), 0); - child->addChild(grandChild.Pass()); - root->addChild(child.PassAs<CCLayerImpl>()); - myHostImpl->setRootLayer(root.Pass()); + child->addChild(grandChild.release()); + root->addChild(child.release()); + myHostImpl->setRootLayer(root.release()); myHostImpl->setViewportSize(rootRect.size(), rootRect.size()); EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp index 52c1765..129fa61 100644 --- a/cc/CCLayerTreeHostTest.cpp +++ b/cc/CCLayerTreeHostTest.cpp @@ -2428,7 +2428,7 @@ public: virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; virtual bool drawsContent() const OVERRIDE { return true; } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; @@ -2456,9 +2456,9 @@ private: class EvictionTestLayerImpl : public CCLayerImpl { public: - static scoped_ptr<EvictionTestLayerImpl> create(int id) + static PassOwnPtr<EvictionTestLayerImpl> create(int id) { - return make_scoped_ptr(new EvictionTestLayerImpl(id)); + return adoptPtr(new EvictionTestLayerImpl(id)); } virtual ~EvictionTestLayerImpl() { } @@ -2496,9 +2496,9 @@ void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTra queue.appendFullUpload(parameters); } -scoped_ptr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() { - return EvictionTestLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return EvictionTestLayerImpl::create(m_layerId); } void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl) diff --git a/cc/CCOcclusionTrackerTest.cpp b/cc/CCOcclusionTrackerTest.cpp index ecf6be3..18bb243 100644 --- a/cc/CCOcclusionTrackerTest.cpp +++ b/cc/CCOcclusionTrackerTest.cpp @@ -113,25 +113,17 @@ struct CCOcclusionTrackerTestMainThreadTypes { typedef RenderSurfaceChromium RenderSurfaceType; typedef TestContentLayerChromium ContentLayerType; typedef scoped_refptr<LayerChromium> LayerPtrType; + typedef scoped_refptr<LayerChromium> PassLayerPtrType; typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; + typedef scoped_refptr<ContentLayerType> PassContentLayerPtrType; typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator; typedef CCOcclusionTracker OcclusionTrackerType; - static LayerPtrType createLayer() + static PassLayerPtrType createLayer() { return LayerChromium::create(); } - static ContentLayerPtrType createContentLayer() { return make_scoped_refptr(new ContentLayerType()); } - - static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) - { - return layer.release(); - } - - static LayerPtrType passLayerPtr(LayerPtrType& layer) - { - return layer.release(); - } + static PassContentLayerPtrType createContentLayer() { return make_scoped_refptr(new ContentLayerType()); } static void destroyLayer(LayerPtrType& layer) { @@ -143,28 +135,20 @@ struct CCOcclusionTrackerTestImplThreadTypes { typedef CCLayerImpl LayerType; typedef CCRenderSurface RenderSurfaceType; typedef TestContentLayerImpl ContentLayerType; - typedef scoped_ptr<CCLayerImpl> LayerPtrType; - typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; + typedef OwnPtr<CCLayerImpl> LayerPtrType; + typedef PassOwnPtr<CCLayerImpl> PassLayerPtrType; + typedef OwnPtr<ContentLayerType> ContentLayerPtrType; + typedef PassOwnPtr<ContentLayerType> PassContentLayerPtrType; typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> LayerIterator; typedef CCOcclusionTrackerImpl OcclusionTrackerType; - static LayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerImplId++); } - static ContentLayerPtrType createContentLayer() { return make_scoped_ptr(new ContentLayerType(nextCCLayerImplId++)); } + static PassLayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerImplId++); } + static PassContentLayerPtrType createContentLayer() { return adoptPtr(new ContentLayerType(nextCCLayerImplId++)); } static int nextCCLayerImplId; - static LayerPtrType passLayerPtr(LayerPtrType& layer) - { - return layer.Pass(); - } - - static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) - { - return layer.PassAs<LayerType>(); - } - static void destroyLayer(LayerPtrType& layer) { - layer.reset(); + layer.clear(); } }; @@ -196,7 +180,7 @@ protected: setProperties(layerPtr, transform, position, bounds); ASSERT(!m_root); - m_root = Types::passLayerPtr(layer); + m_root = layer.release(); return layerPtr; } @@ -205,7 +189,7 @@ protected: typename Types::LayerPtrType layer(Types::createLayer()); typename Types::LayerType* layerPtr = layer.get(); setProperties(layerPtr, transform, position, bounds); - parent->addChild(Types::passLayerPtr(layer)); + parent->addChild(layer.release()); return layerPtr; } @@ -234,7 +218,7 @@ protected: layerPtr->setOpaqueContentsRect(IntRect()); } - parent->addChild(Types::passLayerPtr(layer)); + parent->addChild(layer.release()); return layerPtr; } @@ -243,7 +227,7 @@ protected: typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); setProperties(layerPtr, transform, position, bounds); - setReplica(owningLayer, Types::passLayerPtr(layer)); + setReplica(owningLayer, layer.release()); return layerPtr; } @@ -252,7 +236,7 @@ protected: typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); - setMask(owningLayer, Types::passLayerPtr(layer)); + setMask(owningLayer, layer.release()); return layerPtr; } @@ -371,9 +355,9 @@ private: m_replicaLayers.push_back(layer); } - void setReplica(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) + void setReplica(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer) { - owningLayer->setReplicaLayer(layer.Pass()); + owningLayer->setReplicaLayer(layer); } void setMask(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer) @@ -382,9 +366,9 @@ private: m_maskLayers.push_back(layer); } - void setMask(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) + void setMask(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer) { - owningLayer->setMaskLayer(layer.Pass()); + owningLayer->setMaskLayer(layer); } // These hold ownership of the layers for the duration of the test. diff --git a/cc/CCQuadCullerTest.cpp b/cc/CCQuadCullerTest.cpp index 3c43355..a47c4e7 100644 --- a/cc/CCQuadCullerTest.cpp +++ b/cc/CCQuadCullerTest.cpp @@ -40,9 +40,9 @@ private: typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<CCLayerImpl*>& surfaceLayerList) { - scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); + OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); @@ -74,7 +74,7 @@ static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We } layer->setDrawableContentRect(rectInTarget); - return layer.Pass(); + return layer.release(); } static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) @@ -102,8 +102,8 @@ TEST(CCQuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -119,8 +119,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -136,8 +136,8 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -153,8 +153,8 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -172,8 +172,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) childTransform.translate(50, 50); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -215,8 +215,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) rootRect = childRect = IntRect(0, 0, 100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -243,8 +243,8 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) rootRect = childRect = IntRect(0, 0, 100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -263,8 +263,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) childTransform.translate(100, 100); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -282,9 +282,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) childTransform.translate(50, 50); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -302,9 +302,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) childTransform.translate(50, 10); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -322,9 +322,9 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) childTransform.translate(50, 49); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -343,8 +343,8 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -369,8 +369,8 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) WebTransformationMatrix parentTransform; parentTransform.rotate(1); - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -386,8 +386,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -403,8 +403,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -420,8 +420,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -437,8 +437,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -454,8 +454,8 @@ TEST(CCQuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - scoped_ptr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); - scoped_ptr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); diff --git a/cc/CCRenderSurfaceTest.cpp b/cc/CCRenderSurfaceTest.cpp index c0cb19d..35f6cc0 100644 --- a/cc/CCRenderSurfaceTest.cpp +++ b/cc/CCRenderSurfaceTest.cpp @@ -42,7 +42,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(1); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); CCRenderSurface* renderSurface = owningLayer->renderSurface(); @@ -62,7 +62,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setClipRect(testRect)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); - scoped_ptr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); WebTransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); @@ -79,15 +79,15 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->setRenderTarget(owningLayer.get()); CCRenderSurface* renderSurface = owningLayer->renderSurface(); - rootLayer->addChild(owningLayer.Pass()); + rootLayer->addChild(owningLayer.release()); IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); @@ -133,15 +133,15 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - scoped_ptr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); - scoped_ptr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); owningLayer->setRenderTarget(owningLayer.get()); CCRenderSurface* renderSurface = owningLayer->renderSurface(); - rootLayer->addChild(owningLayer.Pass()); + rootLayer->addChild(owningLayer.release()); IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); WebTransformationMatrix origin; diff --git a/cc/CCRendererGLTest.cpp b/cc/CCRendererGLTest.cpp index 5a11cb3..7c84853 100644 --- a/cc/CCRendererGLTest.cpp +++ b/cc/CCRendererGLTest.cpp @@ -89,7 +89,7 @@ public: private: int m_setFullRootLayerDamageCount; DebugScopedSetImplThread m_implThread; - scoped_ptr<CCLayerImpl> m_rootLayer; + OwnPtr<CCLayerImpl> m_rootLayer; CCRenderPassList m_renderPassesInDrawOrder; CCRenderPassIdHashMap m_renderPasses; size_t m_memoryAllocationLimitBytes; diff --git a/cc/CCScrollbarAnimationControllerLinearFadeTest.cpp b/cc/CCScrollbarAnimationControllerLinearFadeTest.cpp index e586214..d4b7860 100644 --- a/cc/CCScrollbarAnimationControllerLinearFadeTest.cpp +++ b/cc/CCScrollbarAnimationControllerLinearFadeTest.cpp @@ -34,9 +34,9 @@ protected: DebugScopedSetImplThread implThread; OwnPtr<CCScrollbarAnimationControllerLinearFade> m_scrollbarController; - scoped_ptr<CCLayerImpl> m_scrollLayer; + OwnPtr<CCLayerImpl> m_scrollLayer; CCLayerImpl* m_contentLayer; - scoped_ptr<CCScrollbarLayerImpl> m_scrollbarLayer; + OwnPtr<CCScrollbarLayerImpl> m_scrollbarLayer; }; diff --git a/cc/CCScrollbarLayerImpl.cpp b/cc/CCScrollbarLayerImpl.cpp index 8a832e7..42aac84 100644 --- a/cc/CCScrollbarLayerImpl.cpp +++ b/cc/CCScrollbarLayerImpl.cpp @@ -17,9 +17,9 @@ using WebKit::WebScrollbar; namespace cc { -scoped_ptr<CCScrollbarLayerImpl> CCScrollbarLayerImpl::create(int id) +PassOwnPtr<CCScrollbarLayerImpl> CCScrollbarLayerImpl::create(int id) { - return make_scoped_ptr(new CCScrollbarLayerImpl(id)); + return adoptPtr(new CCScrollbarLayerImpl(id)); } CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) diff --git a/cc/CCScrollbarLayerImpl.h b/cc/CCScrollbarLayerImpl.h index e7cf584..a720718 100644 --- a/cc/CCScrollbarLayerImpl.h +++ b/cc/CCScrollbarLayerImpl.h @@ -19,7 +19,7 @@ class ScrollView; class CCScrollbarLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCScrollbarLayerImpl> create(int id); + static PassOwnPtr<CCScrollbarLayerImpl> create(int id); virtual ~CCScrollbarLayerImpl(); CCScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); } diff --git a/cc/CCSolidColorLayerImpl.h b/cc/CCSolidColorLayerImpl.h index 72beb25..f170714 100644 --- a/cc/CCSolidColorLayerImpl.h +++ b/cc/CCSolidColorLayerImpl.h @@ -12,9 +12,9 @@ namespace cc { class CCSolidColorLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCSolidColorLayerImpl> create(int id) + static PassOwnPtr<CCSolidColorLayerImpl> create(int id) { - return make_scoped_ptr(new CCSolidColorLayerImpl(id)); + return adoptPtr(new CCSolidColorLayerImpl(id)); } virtual ~CCSolidColorLayerImpl(); diff --git a/cc/CCSolidColorLayerImplTest.cpp b/cc/CCSolidColorLayerImplTest.cpp index f1e091f..87bf7cb 100644 --- a/cc/CCSolidColorLayerImplTest.cpp +++ b/cc/CCSolidColorLayerImplTest.cpp @@ -27,7 +27,7 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) IntSize layerSize = IntSize(800, 600); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -50,7 +50,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) IntSize layerSize = IntSize(100, 100); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); @@ -75,7 +75,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) IntSize layerSize = IntSize(100, 100); IntRect visibleContentRect = IntRect(IntPoint(), layerSize); - scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); + OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setContentBounds(layerSize); diff --git a/cc/CCTextureLayerImpl.h b/cc/CCTextureLayerImpl.h index ff88ff3..fcb1470 100644 --- a/cc/CCTextureLayerImpl.h +++ b/cc/CCTextureLayerImpl.h @@ -11,9 +11,9 @@ namespace cc { class CCTextureLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCTextureLayerImpl> create(int id) + static PassOwnPtr<CCTextureLayerImpl> create(int id) { - return make_scoped_ptr(new CCTextureLayerImpl(id)); + return adoptPtr(new CCTextureLayerImpl(id)); } virtual ~CCTextureLayerImpl(); diff --git a/cc/CCTiledLayerImpl.h b/cc/CCTiledLayerImpl.h index 2d6803d..6602e4f 100644 --- a/cc/CCTiledLayerImpl.h +++ b/cc/CCTiledLayerImpl.h @@ -15,9 +15,9 @@ class DrawableTile; class CCTiledLayerImpl : public CCLayerImpl { public: - static scoped_ptr<CCTiledLayerImpl> create(int id) + static PassOwnPtr<CCTiledLayerImpl> create(int id) { - return make_scoped_ptr(new CCTiledLayerImpl(id)); + return adoptPtr(new CCTiledLayerImpl(id)); } virtual ~CCTiledLayerImpl(); diff --git a/cc/CCTiledLayerImplTest.cpp b/cc/CCTiledLayerImplTest.cpp index cb58ed2..3e58080 100644 --- a/cc/CCTiledLayerImplTest.cpp +++ b/cc/CCTiledLayerImplTest.cpp @@ -22,9 +22,9 @@ namespace { // Create a default tiled layer with textures for all tiles and a default // visibility of the entire layer size. -static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) +static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) { - scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); + OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels); tiler->setBounds(layerSize); layer->setTilingData(*tiler); @@ -41,7 +41,7 @@ static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I for (int j = 0; j < tiler->numTilesY(); ++j) layer->pushTileProperties(i, j, resourceId++, IntRect(0, 0, 1, 1)); - return layer.Pass(); + return layer.release(); } TEST(CCTiledLayerImplTest, emptyQuadList) @@ -55,7 +55,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Verify default layer does creates quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); MockCCQuadCuller quadCuller; CCAppendQuadsData data; layer->appendQuads(quadCuller, data); @@ -65,7 +65,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; @@ -76,7 +76,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with non-intersecting visible layer rect produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); layer->setVisibleContentRect(outsideBounds); @@ -89,7 +89,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with skips draw produces no quads { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); layer->setSkipsDraw(true); MockCCQuadCuller quadCuller; @@ -108,7 +108,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) const int numTilesY = 2; const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); // No checkerboarding { @@ -140,7 +140,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) static void getQuads(CCQuadList& quads, CCSharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { - scoped_ptr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); diff --git a/cc/CCVideoLayerImpl.h b/cc/CCVideoLayerImpl.h index b254e8c..814513e 100644 --- a/cc/CCVideoLayerImpl.h +++ b/cc/CCVideoLayerImpl.h @@ -23,9 +23,9 @@ class CCVideoLayerImpl; class CCVideoLayerImpl : public CCLayerImpl , public WebKit::WebVideoFrameProvider::Client { public: - static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider) + static PassOwnPtr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider) { - return make_scoped_ptr(new CCVideoLayerImpl(id, provider)); + return adoptPtr(new CCVideoLayerImpl(id, provider)); } virtual ~CCVideoLayerImpl(); diff --git a/cc/DelegatedRendererLayerChromium.cpp b/cc/DelegatedRendererLayerChromium.cpp index 721630d..de34a00 100644 --- a/cc/DelegatedRendererLayerChromium.cpp +++ b/cc/DelegatedRendererLayerChromium.cpp @@ -25,9 +25,9 @@ DelegatedRendererLayerChromium::~DelegatedRendererLayerChromium() { } -scoped_ptr<CCLayerImpl> DelegatedRendererLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> DelegatedRendererLayerChromium::createCCLayerImpl() { - return CCDelegatedRendererLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return CCDelegatedRendererLayerImpl::create(m_layerId); } } diff --git a/cc/DelegatedRendererLayerChromium.h b/cc/DelegatedRendererLayerChromium.h index c7f8d2c..32dbdcf 100644 --- a/cc/DelegatedRendererLayerChromium.h +++ b/cc/DelegatedRendererLayerChromium.h @@ -13,7 +13,7 @@ class DelegatedRendererLayerChromium : public LayerChromium { public: static scoped_refptr<DelegatedRendererLayerChromium> create(); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; protected: DelegatedRendererLayerChromium(); diff --git a/cc/HeadsUpDisplayLayerChromium.cpp b/cc/HeadsUpDisplayLayerChromium.cpp index 743593c..7ec7a56 100644 --- a/cc/HeadsUpDisplayLayerChromium.cpp +++ b/cc/HeadsUpDisplayLayerChromium.cpp @@ -56,9 +56,9 @@ void HeadsUpDisplayLayerChromium::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas setNeedsCommit(); } -scoped_ptr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl() { - return CCHeadsUpDisplayLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return CCHeadsUpDisplayLayerImpl::create(m_layerId); } void HeadsUpDisplayLayerChromium::pushPropertiesTo(CCLayerImpl* layerImpl) diff --git a/cc/HeadsUpDisplayLayerChromium.h b/cc/HeadsUpDisplayLayerChromium.h index cd2627e..36701f4 100644 --- a/cc/HeadsUpDisplayLayerChromium.h +++ b/cc/HeadsUpDisplayLayerChromium.h @@ -21,7 +21,7 @@ public: void setFontAtlas(scoped_ptr<CCFontAtlas>); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; protected: diff --git a/cc/IOSurfaceLayerChromium.cpp b/cc/IOSurfaceLayerChromium.cpp index fe6d39a..7b242fd 100644 --- a/cc/IOSurfaceLayerChromium.cpp +++ b/cc/IOSurfaceLayerChromium.cpp @@ -34,9 +34,9 @@ void IOSurfaceLayerChromium::setIOSurfaceProperties(uint32_t ioSurfaceId, const setNeedsCommit(); } -scoped_ptr<CCLayerImpl> IOSurfaceLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> IOSurfaceLayerChromium::createCCLayerImpl() { - return CCIOSurfaceLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return CCIOSurfaceLayerImpl::create(m_layerId); } bool IOSurfaceLayerChromium::drawsContent() const diff --git a/cc/IOSurfaceLayerChromium.h b/cc/IOSurfaceLayerChromium.h index f9c4b5f..9c353f5 100644 --- a/cc/IOSurfaceLayerChromium.h +++ b/cc/IOSurfaceLayerChromium.h @@ -18,7 +18,7 @@ public: void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; virtual bool drawsContent() const OVERRIDE; virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; diff --git a/cc/LayerChromium.cpp b/cc/LayerChromium.cpp index 2f499f0..43145b6 100644 --- a/cc/LayerChromium.cpp +++ b/cc/LayerChromium.cpp @@ -595,7 +595,7 @@ void LayerChromium::pushPropertiesTo(CCLayerImpl* layer) m_updateRect = FloatRect(); } -scoped_ptr<CCLayerImpl> LayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> LayerChromium::createCCLayerImpl() { return CCLayerImpl::create(m_layerId); } diff --git a/cc/LayerChromium.h b/cc/LayerChromium.h index e11df6ca..aecb520 100644 --- a/cc/LayerChromium.h +++ b/cc/LayerChromium.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "CCLayerAnimationController.h" #include "CCOcclusionTracker.h" +#include "CCPrioritizedTexture.h" #include "FloatPoint.h" #include "Region.h" #include "RenderSurfaceChromium.h" @@ -19,6 +20,8 @@ #include <public/WebTransformationMatrix.h> #include <string> #include <vector> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { class WebAnimationDelegate; @@ -32,7 +35,6 @@ struct CCAnimationEvent; class CCLayerAnimationDelegate; class CCLayerImpl; class CCLayerTreeHost; -class CCPriorityCalculator; class CCTextureUpdateQueue; class ScrollbarLayerChromium; struct CCAnimationEvent; @@ -295,7 +297,7 @@ protected: scoped_refptr<LayerChromium> m_maskLayer; // Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type. - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl(); + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl(); int m_layerId; private: diff --git a/cc/LayerChromiumTest.cpp b/cc/LayerChromiumTest.cpp index e5e71c2..867e4db 100644 --- a/cc/LayerChromiumTest.cpp +++ b/cc/LayerChromiumTest.cpp @@ -521,7 +521,7 @@ TEST_F(LayerChromiumTest, verifyPushPropertiesAccumulatesUpdateRect) DebugScopedSetImplThread setImplThread; scoped_refptr<LayerChromium> testLayer = LayerChromium::create(); - scoped_ptr<CCLayerImpl> implLayer = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> implLayer = CCLayerImpl::create(1); testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); diff --git a/cc/ScrollbarLayerChromium.cpp b/cc/ScrollbarLayerChromium.cpp index 4259b7b..745fd34 100644 --- a/cc/ScrollbarLayerChromium.cpp +++ b/cc/ScrollbarLayerChromium.cpp @@ -20,9 +20,9 @@ using WebKit::WebRect; namespace cc { -scoped_ptr<CCLayerImpl> ScrollbarLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> ScrollbarLayerChromium::createCCLayerImpl() { - return CCScrollbarLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return CCScrollbarLayerImpl::create(id()); } scoped_refptr<ScrollbarLayerChromium> ScrollbarLayerChromium::create(PassOwnPtr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId) diff --git a/cc/ScrollbarLayerChromium.h b/cc/ScrollbarLayerChromium.h index 5c7cc5c..38433ac 100644 --- a/cc/ScrollbarLayerChromium.h +++ b/cc/ScrollbarLayerChromium.h @@ -22,7 +22,7 @@ class CCTextureUpdateQueue; class ScrollbarLayerChromium : public LayerChromium { public: - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; static scoped_refptr<ScrollbarLayerChromium> create(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId); diff --git a/cc/ScrollbarLayerChromiumTest.cpp b/cc/ScrollbarLayerChromiumTest.cpp index 3aa6aa0..0231e78 100644 --- a/cc/ScrollbarLayerChromiumTest.cpp +++ b/cc/ScrollbarLayerChromiumTest.cpp @@ -57,7 +57,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, 0); CCLayerImpl* ccChild1 = ccLayerTreeRoot->children()[0]; CCScrollbarLayerImpl* ccChild2 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1]); @@ -74,7 +74,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) layerTreeRoot->addChild(child1); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, 0); CCScrollbarLayerImpl* ccChild1 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[0]); CCLayerImpl* ccChild2 = ccLayerTreeRoot->children()[1]; @@ -101,7 +101,7 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) layerTreeRoot->setMaxScrollPosition(IntSize(30, 50)); contentLayer->setBounds(IntSize(100, 200)); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, 0); CCScrollbarLayerImpl* ccScrollbarLayer = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1]); @@ -114,7 +114,7 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) contentLayer->setBounds(IntSize(1000, 2000)); CCScrollbarAnimationController* scrollbarController = ccLayerTreeRoot->scrollbarAnimationController(); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), 0); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), 0); EXPECT_EQ(scrollbarController, ccLayerTreeRoot->scrollbarAnimationController()); EXPECT_EQ(100, ccScrollbarLayer->currentPos()); diff --git a/cc/SolidColorLayerChromium.cpp b/cc/SolidColorLayerChromium.cpp index d5c0b42..a69e122 100644 --- a/cc/SolidColorLayerChromium.cpp +++ b/cc/SolidColorLayerChromium.cpp @@ -12,9 +12,9 @@ namespace cc { -scoped_ptr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl() { - return CCSolidColorLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return CCSolidColorLayerImpl::create(id()); } scoped_refptr<SolidColorLayerChromium> SolidColorLayerChromium::create() diff --git a/cc/SolidColorLayerChromium.h b/cc/SolidColorLayerChromium.h index 9123484..592c925 100644 --- a/cc/SolidColorLayerChromium.h +++ b/cc/SolidColorLayerChromium.h @@ -18,7 +18,7 @@ class SolidColorLayerChromium : public LayerChromium { public: static scoped_refptr<SolidColorLayerChromium> create(); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; protected: SolidColorLayerChromium(); diff --git a/cc/TextureLayerChromium.cpp b/cc/TextureLayerChromium.cpp index e1b4851..cb03343 100644 --- a/cc/TextureLayerChromium.cpp +++ b/cc/TextureLayerChromium.cpp @@ -43,9 +43,9 @@ TextureLayerChromium::~TextureLayerChromium() } } -scoped_ptr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl() { - return CCTextureLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return CCTextureLayerImpl::create(m_layerId); } void TextureLayerChromium::setFlipped(bool flipped) diff --git a/cc/TextureLayerChromium.h b/cc/TextureLayerChromium.h index 124f845..2be64d4 100644 --- a/cc/TextureLayerChromium.h +++ b/cc/TextureLayerChromium.h @@ -27,7 +27,7 @@ public: void clearClient() { m_client = 0; } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; // Sets whether this texture should be Y-flipped at draw time. Defaults to true. void setFlipped(bool); diff --git a/cc/TiledLayerChromium.cpp b/cc/TiledLayerChromium.cpp index f2219e6..3b72f19 100644 --- a/cc/TiledLayerChromium.cpp +++ b/cc/TiledLayerChromium.cpp @@ -94,9 +94,9 @@ TiledLayerChromium::~TiledLayerChromium() { } -scoped_ptr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() { - return CCTiledLayerImpl::create(id()).PassAs<CCLayerImpl>(); + return CCTiledLayerImpl::create(id()); } void TiledLayerChromium::updateTileSizeAndTilingOption() diff --git a/cc/TiledLayerChromium.h b/cc/TiledLayerChromium.h index 3c27382..016ea1b 100644 --- a/cc/TiledLayerChromium.h +++ b/cc/TiledLayerChromium.h @@ -72,7 +72,7 @@ protected: virtual CCPrioritizedTextureManager* textureManager() const; private: - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; void createTilerIfNeeded(); void setTilingOption(TilingOption); diff --git a/cc/TreeSynchronizer.cpp b/cc/TreeSynchronizer.cpp index b7e76bb..e12d32d 100644 --- a/cc/TreeSynchronizer.cpp +++ b/cc/TreeSynchronizer.cpp @@ -14,53 +14,55 @@ namespace cc { -scoped_ptr<CCLayerImpl> TreeSynchronizer::synchronizeTrees(LayerChromium* layerChromiumRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl* hostImpl) +PassOwnPtr<CCLayerImpl> TreeSynchronizer::synchronizeTrees(LayerChromium* layerChromiumRoot, PassOwnPtr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl* hostImpl) { - ScopedPtrCCLayerImplMap oldLayers; + OwnPtrCCLayerImplMap oldLayers; RawPtrCCLayerImplMap newLayers; - collectExistingCCLayerImplRecursive(oldLayers, oldCCLayerImplRoot.Pass()); + collectExistingCCLayerImplRecursive(oldLayers, oldCCLayerImplRoot); - scoped_ptr<CCLayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerChromiumRoot, hostImpl); + OwnPtr<CCLayerImpl> newTree = synchronizeTreeRecursive(newLayers, oldLayers, layerChromiumRoot, hostImpl); updateScrollbarLayerPointersRecursive(newLayers, layerChromiumRoot); - return newTree.Pass(); + return newTree.release(); } -void TreeSynchronizer::collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl> ccLayerImpl) +void TreeSynchronizer::collectExistingCCLayerImplRecursive(OwnPtrCCLayerImplMap& oldLayers, PassOwnPtr<CCLayerImpl> popCCLayerImpl) { + OwnPtr<CCLayerImpl> ccLayerImpl = popCCLayerImpl; + if (!ccLayerImpl) return; - ScopedPtrVector<CCLayerImpl>& children = ccLayerImpl->m_children; + OwnPtrVector<CCLayerImpl>& children = ccLayerImpl->m_children; for (size_t i = 0; i < children.size(); ++i) collectExistingCCLayerImplRecursive(oldLayers, children.take(i)); - collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_maskLayer.Pass()); - collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_replicaLayer.Pass()); + collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_maskLayer.release()); + collectExistingCCLayerImplRecursive(oldLayers, ccLayerImpl->m_replicaLayer.release()); int id = ccLayerImpl->id(); - oldLayers.set(id, ccLayerImpl.Pass()); + oldLayers.set(id, ccLayerImpl.release()); } -scoped_ptr<CCLayerImpl> TreeSynchronizer::reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium* layer) +PassOwnPtr<CCLayerImpl> TreeSynchronizer::reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium* layer) { - scoped_ptr<CCLayerImpl> ccLayerImpl = oldLayers.take(layer->id()); + OwnPtr<CCLayerImpl> ccLayerImpl = oldLayers.take(layer->id()); if (!ccLayerImpl) ccLayerImpl = layer->createCCLayerImpl(); - newLayers[layer->id()] = ccLayerImpl.get(); - return ccLayerImpl.Pass(); + newLayers.set(layer->id(), ccLayerImpl.get()); + return ccLayerImpl.release(); } -scoped_ptr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium* layer, CCLayerTreeHostImpl* hostImpl) +PassOwnPtr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium* layer, CCLayerTreeHostImpl* hostImpl) { if (!layer) - return scoped_ptr<CCLayerImpl>(); + return nullptr; - scoped_ptr<CCLayerImpl> ccLayerImpl = reuseOrCreateCCLayerImpl(newLayers, oldLayers, layer); + OwnPtr<CCLayerImpl> ccLayerImpl = reuseOrCreateCCLayerImpl(newLayers, oldLayers, layer); ccLayerImpl->clearChildList(); const std::vector<scoped_refptr<LayerChromium> >& children = layer->children(); @@ -79,7 +81,7 @@ scoped_ptr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrCCLayer scrollbarController->setVerticalScrollbarLayer(0); } - return ccLayerImpl.Pass(); + return ccLayerImpl.release(); } void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium* layer) @@ -95,12 +97,9 @@ void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrCCLayer if (!scrollbarLayer) return; - RawPtrCCLayerImplMap::const_iterator iter = newLayers.find(scrollbarLayer->id()); - CCScrollbarLayerImpl* ccScrollbarLayerImpl = iter != newLayers.end() ? static_cast<CCScrollbarLayerImpl*>(iter->second) : NULL; - iter = newLayers.find(scrollbarLayer->scrollLayerId()); - CCLayerImpl* ccScrollLayerImpl = iter != newLayers.end() ? iter->second : NULL; - + CCScrollbarLayerImpl* ccScrollbarLayerImpl = static_cast<CCScrollbarLayerImpl*>(newLayers.get(scrollbarLayer->id())); ASSERT(ccScrollbarLayerImpl); + CCLayerImpl* ccScrollLayerImpl = newLayers.get(scrollbarLayer->scrollLayerId()); ASSERT(ccScrollLayerImpl); if (ccScrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal) diff --git a/cc/TreeSynchronizer.h b/cc/TreeSynchronizer.h index 2609841..b180dd0 100644 --- a/cc/TreeSynchronizer.h +++ b/cc/TreeSynchronizer.h @@ -6,8 +6,9 @@ #define TreeSynchronizer_h #include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "cc/scoped_ptr_hash_map.h" +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace cc { @@ -19,18 +20,18 @@ class TreeSynchronizer { public: // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tree that duplicates the structure // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided by oldCCLayerImplRoot if possible. - static scoped_ptr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*); + static PassOwnPtr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, PassOwnPtr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*); private: TreeSynchronizer(); // Not instantiable. - typedef ScopedPtrHashMap<int, CCLayerImpl> ScopedPtrCCLayerImplMap; - typedef base::hash_map<int, CCLayerImpl*> RawPtrCCLayerImplMap; + typedef HashMap<int, OwnPtr<CCLayerImpl> > OwnPtrCCLayerImplMap; + typedef HashMap<int, CCLayerImpl*> RawPtrCCLayerImplMap; // Declared as static member functions so they can access functions on LayerChromium as a friend class. - static scoped_ptr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*); - static void collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl>); - static scoped_ptr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImpl*); + static PassOwnPtr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium*); + static void collectExistingCCLayerImplRecursive(OwnPtrCCLayerImplMap& oldLayers, PassOwnPtr<CCLayerImpl>); + static PassOwnPtr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImpl*); static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium*); DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); diff --git a/cc/TreeSynchronizerTest.cpp b/cc/TreeSynchronizerTest.cpp index e2bc0b8..e1c811b8 100644 --- a/cc/TreeSynchronizerTest.cpp +++ b/cc/TreeSynchronizerTest.cpp @@ -22,9 +22,9 @@ namespace { class MockCCLayerImpl : public CCLayerImpl { public: - static scoped_ptr<MockCCLayerImpl> create(int layerId) + static PassOwnPtr<MockCCLayerImpl> create(int layerId) { - return make_scoped_ptr(new MockCCLayerImpl(layerId)); + return adoptPtr(new MockCCLayerImpl(layerId)); } virtual ~MockCCLayerImpl() { @@ -51,9 +51,9 @@ public: return make_scoped_refptr(new MockLayerChromium(ccLayerDestructionList)); } - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE { - return MockCCLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); + return MockCCLayerImpl::create(m_layerId); } virtual void pushPropertiesTo(CCLayerImpl* ccLayer) OVERRIDE @@ -119,7 +119,7 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer, CCLayer expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer(), hostImpl); const std::vector<scoped_refptr<LayerChromium> >& layerChildren = layer->children(); - const ScopedPtrVector<CCLayerImpl>& ccLayerChildren = ccLayer->children(); + const OwnPtrVector<CCLayerImpl>& ccLayerChildren = ccLayer->children(); ASSERT_EQ(layerChildren.size(), ccLayerChildren.size()); @@ -133,7 +133,7 @@ TEST(TreeSynchronizerTest, syncNullTree) { DebugScopedSetImplThread impl; - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<CCLayerImpl>(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, nullptr, 0); EXPECT_TRUE(!ccLayerTreeRoot.get()); } @@ -150,7 +150,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) layerTreeRoot->addChild(LayerChromium::create()); layerTreeRoot->addChild(LayerChromium::create()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); } @@ -168,7 +168,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Add a new layer to the LayerChromium side @@ -178,7 +178,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) int secondCCLayerId = ccLayerTreeRoot->children()[1]->id(); // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one CCLayerImpl. - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); ASSERT_EQ(1u, ccLayerDestructionList.size()); @@ -200,14 +200,14 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange) scoped_refptr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList); layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); layerTreeRoot->addChild(child2); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); ccLayerTreeRoot->resetAllChangeTrackingForSubtree(); // re-insert the layer and sync again. child2->removeFromParent(); layerTreeRoot->addChild(child2); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Check that the impl thread properly tracked the change. @@ -237,7 +237,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) IntSize secondChildBounds = IntSize(25, 53); layerTreeRoot->children()[1]->setBounds(secondChildBounds); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Check that the property values we set on the LayerChromium tree are reflected in the CCLayerImpl tree. @@ -277,7 +277,7 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); scoped_refptr<LayerChromium> layerD = layerB->children()[1].get(); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Now restructure the tree to look like this: @@ -295,7 +295,7 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) layerC->addChild(layerB); // After another synchronize our trees should match and we should not have destroyed any CCLayerImpls - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); EXPECT_EQ(0u, ccLayerDestructionList.size()); @@ -318,7 +318,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Remove all children on the LayerChromium side. @@ -326,7 +326,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) // Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted. scoped_refptr<LayerChromium> newLayerTreeRoot = LayerChromium::create(); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); ASSERT_EQ(3u, ccLayerDestructionList.size()); @@ -362,23 +362,23 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Remove the mask layer. layerTreeRoot->children()[0]->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Remove the replica layer. layerTreeRoot->children()[1]->setReplicaLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); // Remove the replica mask. replicaLayerWithMask->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); } @@ -396,8 +396,8 @@ TEST(TreeSynchronizerTest, synchronizeAnimations) EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); - scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get()); EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); } diff --git a/cc/VideoLayerChromium.cpp b/cc/VideoLayerChromium.cpp index e210473..03ecbca 100644 --- a/cc/VideoLayerChromium.cpp +++ b/cc/VideoLayerChromium.cpp @@ -27,9 +27,9 @@ VideoLayerChromium::~VideoLayerChromium() { } -scoped_ptr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl() +PassOwnPtr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl() { - return CCVideoLayerImpl::create(m_layerId, m_provider).PassAs<CCLayerImpl>(); + return CCVideoLayerImpl::create(m_layerId, m_provider); } } // namespace cc diff --git a/cc/VideoLayerChromium.h b/cc/VideoLayerChromium.h index 92b5e13..0ecdd0f 100644 --- a/cc/VideoLayerChromium.h +++ b/cc/VideoLayerChromium.h @@ -23,7 +23,7 @@ class VideoLayerChromium : public LayerChromium { public: static scoped_refptr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*); - virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; private: explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*); |