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

Unified Diff: cc/CCLayerTreeHostImplTest.cpp

Issue 11083003: Revert 160631 - [cc] Store CCLayerImpls as scoped_ptrs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/CCLayerTreeHostImpl.cpp ('k') | cc/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCLayerTreeHostImplTest.cpp
===================================================================
--- cc/CCLayerTreeHostImplTest.cpp (revision 160631)
+++ cc/CCLayerTreeHostImplTest.cpp (working copy)
@@ -74,7 +74,7 @@
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);
@@ -86,13 +86,15 @@
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();
}
@@ -120,7 +122,7 @@
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);
@@ -129,25 +131,25 @@
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()
@@ -194,7 +196,7 @@
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;
@@ -238,13 +240,13 @@
TEST_F(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();
@@ -266,12 +268,12 @@
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();
@@ -678,7 +680,7 @@
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
{
@@ -835,10 +837,7 @@
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)
@@ -900,9 +899,9 @@
TEST_F(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.
@@ -917,7 +916,7 @@
// 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));
@@ -925,16 +924,16 @@
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();
@@ -948,11 +947,11 @@
TEST_F(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();
@@ -966,9 +965,9 @@
TEST_F(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();
@@ -981,8 +980,8 @@
TEST_F(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;
@@ -990,8 +989,8 @@
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
@@ -1004,14 +1003,14 @@
TEST_F(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();
@@ -1023,8 +1022,8 @@
{
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();
@@ -1054,8 +1053,8 @@
{
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();
@@ -1094,8 +1093,8 @@
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.
@@ -1126,14 +1125,14 @@
TEST_F(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();
@@ -1167,17 +1166,17 @@
// 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();
{
@@ -1203,13 +1202,13 @@
// 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();
{
@@ -1283,7 +1282,7 @@
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);
@@ -1292,7 +1291,7 @@
// 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);
@@ -1397,7 +1396,7 @@
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
{
@@ -1458,12 +1457,12 @@
TEST_F(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();
@@ -1750,8 +1749,6 @@
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) { }
};
@@ -1764,11 +1761,11 @@
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;
@@ -1814,8 +1811,8 @@
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));
@@ -1825,8 +1822,8 @@
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;
@@ -1877,8 +1874,8 @@
TEST_F(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));
@@ -1888,9 +1885,9 @@
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;
@@ -1904,7 +1901,7 @@
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
{
@@ -2119,9 +2116,9 @@
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);
@@ -2151,10 +2148,10 @@
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();
}
@@ -2203,7 +2200,7 @@
// 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
{
@@ -2478,9 +2475,9 @@
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)
@@ -2522,11 +2519,11 @@
{
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));
@@ -2536,17 +2533,17 @@
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));
@@ -2555,63 +2552,63 @@
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);
@@ -2620,14 +2617,14 @@
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));
@@ -2707,11 +2704,11 @@
TEST_F(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));
@@ -2721,40 +2718,40 @@
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));
@@ -2807,7 +2804,7 @@
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()));
@@ -2815,7 +2812,7 @@
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;
}
@@ -2827,7 +2824,7 @@
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));
@@ -2835,7 +2832,7 @@
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
@@ -2873,7 +2870,7 @@
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));
@@ -2882,7 +2879,7 @@
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);
@@ -2985,7 +2982,7 @@
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));
@@ -2994,7 +2991,7 @@
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);
@@ -3098,7 +3095,7 @@
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));
@@ -3107,7 +3104,7 @@
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);
@@ -3212,7 +3209,7 @@
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));
@@ -3221,7 +3218,7 @@
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);
@@ -3295,7 +3292,7 @@
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));
@@ -3304,7 +3301,7 @@
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);
@@ -3380,7 +3377,7 @@
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));
@@ -3389,7 +3386,7 @@
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);
@@ -3486,9 +3483,9 @@
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);
@@ -3526,9 +3523,9 @@
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));
« no previous file with comments | « cc/CCLayerTreeHostImpl.cpp ('k') | cc/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698