summaryrefslogtreecommitdiffstats
path: root/cc/CCLayerTreeHostTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cc/CCLayerTreeHostTest.cpp')
-rw-r--r--cc/CCLayerTreeHostTest.cpp114
1 files changed, 60 insertions, 54 deletions
diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp
index bae4e86..1bc669e 100644
--- a/cc/CCLayerTreeHostTest.cpp
+++ b/cc/CCLayerTreeHostTest.cpp
@@ -1183,7 +1183,7 @@ private:
class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium {
public:
- static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(client)); }
+ static scoped_refptr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new ContentLayerChromiumWithUpdateTracking(client)); }
int paintContentsCount() { return m_paintContentsCount; }
void resetPaintContentsCount() { m_paintContentsCount = 0; }
@@ -1203,6 +1203,9 @@ private:
setBounds(IntSize(10, 10));
setIsDrawable(true);
}
+ virtual ~ContentLayerChromiumWithUpdateTracking()
+ {
+ }
int m_paintContentsCount;
};
@@ -1235,12 +1238,12 @@ public:
EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount());
// clear m_updateCheckLayer so CCLayerTreeHost dies.
- m_updateCheckLayer.clear();
+ m_updateCheckLayer = NULL;
}
private:
TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer;
};
TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread)
@@ -1258,13 +1261,14 @@ public:
class NoScaleContentLayerChromium : public ContentLayerChromium {
public:
- static PassRefPtr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return adoptRef(new NoScaleContentLayerChromium(client)); }
+ static scoped_refptr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new NoScaleContentLayerChromium(client)); }
virtual bool needsContentsScale() const OVERRIDE { return false; }
private:
explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client)
: ContentLayerChromium(client) { }
+ virtual ~NoScaleContentLayerChromium() { }
};
class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLayerTreeHostTest {
@@ -1361,14 +1365,14 @@ public:
virtual void afterTest() OVERRIDE
{
- m_rootLayer.clear();
- m_childLayer.clear();
+ m_rootLayer = NULL;
+ m_childLayer = NULL;
}
private:
MockContentLayerChromiumClient m_client;
- RefPtr<NoScaleContentLayerChromium> m_rootLayer;
- RefPtr<ContentLayerChromium> m_childLayer;
+ scoped_refptr<NoScaleContentLayerChromium> m_rootLayer;
+ scoped_refptr<ContentLayerChromium> m_childLayer;
};
// Test is flaky - http://crbug.com/148490
@@ -1456,7 +1460,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_layer;
};
TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread)
@@ -1603,8 +1607,8 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_child;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_child;
int m_numCommits;
};
@@ -1615,7 +1619,7 @@ TEST_F(CCLayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread)
class TestLayerChromium : public LayerChromium {
public:
- static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
+ static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); }
virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker* occlusion, CCRenderingStats&) OVERRIDE
{
@@ -1631,6 +1635,7 @@ public:
private:
TestLayerChromium() : LayerChromium() { }
+ virtual ~TestLayerChromium() { }
Region m_occludedScreenSpace;
};
@@ -1647,11 +1652,11 @@ public:
virtual void beginTest() OVERRIDE
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create();
- RefPtr<TestLayerChromium> mask = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create();
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childTransform;
@@ -1850,11 +1855,11 @@ public:
virtual void beginTest() OVERRIDE
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create();
- RefPtr<TestLayerChromium> mask = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create();
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childTransform;
@@ -1944,26 +1949,26 @@ public:
// We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion.
Region occluded;
const WebTransformationMatrix identityMatrix;
- Vector<RefPtr<TestLayerChromium> > layers;
- Vector<RefPtr<TestLayerChromium> > children;
+ std::vector<scoped_refptr<TestLayerChromium> > layers;
+ std::vector<scoped_refptr<TestLayerChromium> > children;
int numSurfaces = 20;
- RefPtr<TestLayerChromium> replica = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> replica = TestLayerChromium::create();
for (int i = 0; i < numSurfaces; ++i) {
- layers.append(TestLayerChromium::create());
+ layers.push_back(TestLayerChromium::create());
if (!i) {
- setTestLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- layers.last()->createRenderSurface();
+ setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ layers.back()->createRenderSurface();
} else {
- setTestLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
- layers.last()->setMasksToBounds(true);
- layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
+ setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
+ layers.back()->setMasksToBounds(true);
+ layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
}
}
for (int i = 1; i < numSurfaces; ++i) {
- children.append(TestLayerChromium::create());
- setTestLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ children.push_back(TestLayerChromium::create());
+ setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
}
m_layerTreeHost->setRootLayer(layers[0].get());
@@ -2179,7 +2184,7 @@ public:
{
EXPECT_FALSE(m_addedAnimation);
- RefPtr<LayerChromium> layer = LayerChromium::create();
+ scoped_refptr<LayerChromium> layer = LayerChromium::create();
layer->setLayerAnimationDelegate(this);
// Any valid CCAnimationCurve will do here.
@@ -2282,8 +2287,8 @@ private:
const IntSize m_scrollAmount;
IntPoint m_finalScrollPosition;
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<LayerChromium> m_childLayer;
- RefPtr<LayerChromium> m_rootScrollLayer;
+ scoped_refptr<LayerChromium> m_childLayer;
+ scoped_refptr<LayerChromium> m_rootScrollLayer;
};
TEST_F(CCLayerTreeHostTestScrollChildLayer, runMultiThread)
@@ -2375,20 +2380,20 @@ public:
EXPECT_EQ(2, m_surfaceLayer2->paintContentsCount());
// Clear layer references so CCLayerTreeHost dies.
- m_rootLayer.clear();
- m_surfaceLayer1.clear();
- m_replicaLayer1.clear();
- m_surfaceLayer2.clear();
- m_replicaLayer2.clear();
+ m_rootLayer = NULL;
+ m_surfaceLayer1 = NULL;
+ m_replicaLayer1 = NULL;
+ m_surfaceLayer2 = NULL;
+ m_replicaLayer2 = NULL;
}
private:
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer2;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer2;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer2;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer2;
};
SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit)
@@ -2418,7 +2423,7 @@ private:
class EvictionTestLayer : public LayerChromium {
public:
- static PassRefPtr<EvictionTestLayer> create() { return adoptRef(new EvictionTestLayer()); }
+ static scoped_refptr<EvictionTestLayer> create() { return make_scoped_refptr(new EvictionTestLayer()); }
virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
virtual bool drawsContent() const OVERRIDE { return true; }
@@ -2436,6 +2441,7 @@ public:
private:
EvictionTestLayer() : LayerChromium() { }
+ virtual ~EvictionTestLayer() { }
void createTextureIfNeeded()
{
@@ -2632,7 +2638,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<EvictionTestLayer> m_layer;
+ scoped_refptr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
};
@@ -2728,7 +2734,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<EvictionTestLayer> m_layer;
+ scoped_refptr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
};
@@ -2778,7 +2784,7 @@ public:
, m_numChildren(50)
{
for (int i = 0; i < m_numChildren; i++)
- m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_client));
+ m_children.push_back(ContentLayerChromiumWithUpdateTracking::create(&m_client));
}
virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface()
@@ -2817,9 +2823,9 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent;
int m_numChildren;
- Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
+ std::vector<scoped_refptr<ContentLayerChromiumWithUpdateTracking> > m_children;
};
TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread)
@@ -2924,12 +2930,12 @@ public:
EXPECT_EQ(1, m_numCommitComplete);
// Clear layer references so CCLayerTreeHost dies.
- m_contentLayer.clear();
+ m_contentLayer = NULL;
}
private:
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<LayerChromium> m_contentLayer;
+ scoped_refptr<LayerChromium> m_contentLayer;
int m_numCommitComplete;
int m_numDrawLayers;
};