summaryrefslogtreecommitdiffstats
path: root/cc/CCLayerIteratorTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cc/CCLayerIteratorTest.cpp')
-rw-r--r--cc/CCLayerIteratorTest.cpp69
1 files changed, 36 insertions, 33 deletions
diff --git a/cc/CCLayerIteratorTest.cpp b/cc/CCLayerIteratorTest.cpp
index 36d22da..569f319 100644
--- a/cc/CCLayerIteratorTest.cpp
+++ b/cc/CCLayerIteratorTest.cpp
@@ -23,7 +23,7 @@ namespace {
class TestLayerChromium : public LayerChromium {
public:
- static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
+ static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); }
int m_countRepresentingTargetSurface;
int m_countRepresentingContributingSurface;
@@ -41,6 +41,9 @@ private:
setPosition(IntPoint());
setAnchorPoint(IntPoint());
}
+ virtual ~TestLayerChromium()
+ {
+ }
bool m_drawsContent;
};
@@ -50,10 +53,10 @@ private:
EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \
EXPECT_EQ(itself, layer->m_countRepresentingItself);
-typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
-typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
+typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
+typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
-void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
+void resetCounts(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
{
for (unsigned surfaceIndex = 0; surfaceIndex < renderSurfaceLayerList.size(); ++surfaceIndex) {
TestLayerChromium* renderSurfaceLayer = static_cast<TestLayerChromium*>(renderSurfaceLayerList[surfaceIndex].get());
@@ -73,7 +76,7 @@ void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
}
}
-void iterateFrontToBack(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
+void iterateFrontToBack(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList)
{
resetCounts(*renderSurfaceLayerList);
int count = 0;
@@ -88,7 +91,7 @@ void iterateFrontToBack(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
}
}
-void iterateBackToFront(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
+void iterateBackToFront(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList)
{
resetCounts(*renderSurfaceLayerList);
int count = 0;
@@ -105,7 +108,7 @@ void iterateBackToFront(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
TEST(CCLayerIteratorTest, emptyTree)
{
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
iterateBackToFront(&renderSurfaceLayerList);
iterateFrontToBack(&renderSurfaceLayerList);
@@ -113,11 +116,11 @@ TEST(CCLayerIteratorTest, emptyTree)
TEST(CCLayerIteratorTest, simpleTree)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> first = TestLayerChromium::create();
- RefPtr<TestLayerChromium> second = TestLayerChromium::create();
- RefPtr<TestLayerChromium> third = TestLayerChromium::create();
- RefPtr<TestLayerChromium> fourth = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> first = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> second = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> third = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> fourth = TestLayerChromium::create();
rootLayer->createRenderSurface();
@@ -126,7 +129,7 @@ TEST(CCLayerIteratorTest, simpleTree)
rootLayer->addChild(third);
rootLayer->addChild(fourth);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -148,15 +151,15 @@ TEST(CCLayerIteratorTest, simpleTree)
TEST(CCLayerIteratorTest, complexTree)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root1 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root3 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root21 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root22 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root23 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root221 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root231 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create();
rootLayer->createRenderSurface();
@@ -169,7 +172,7 @@ TEST(CCLayerIteratorTest, complexTree)
root22->addChild(root221);
root23->addChild(root231);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -199,15 +202,15 @@ TEST(CCLayerIteratorTest, complexTree)
TEST(CCLayerIteratorTest, complexTreeMultiSurface)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root1 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root3 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root21 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root22 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root23 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root221 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root231 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create();
rootLayer->createRenderSurface();
rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds()));
@@ -225,7 +228,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface)
root23->setOpacity(0.5);
root23->addChild(root231);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);