| Index: cc/trees/layer_tree_host_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
|
| index 85e6a915c6dd88d8a70c73e44c5494e3f0fc0606..2607431f9b41cc9b92cff6950b338a2e2c7319ef 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -379,7 +379,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
|
|
| protected:
|
| virtual scoped_ptr<OutputSurface> CreateOutputSurface() {
|
| - return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
|
| + return FakeOutputSurface::Create3d();
|
| }
|
|
|
| void DrawOneFrame() {
|
| @@ -415,9 +415,8 @@ TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) {
|
| - scoped_ptr<FakeOutputSurface> output_surface(
|
| - FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
|
| - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
|
| + CreateHostImpl(DefaultSettings(),
|
| + FakeOutputSurface::CreateAlwaysDrawAndSwap3d());
|
|
|
| bool always_draw = true;
|
| CheckNotifyCalledIfCanDrawChanged(always_draw);
|
| @@ -527,12 +526,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
|
| TestWebGraphicsContext3D::Create();
|
| context_owned->set_context_lost(true);
|
|
|
| - scoped_ptr<FakeOutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| - context_owned.Pass()));
|
| -
|
| // Initialization will fail.
|
| - EXPECT_FALSE(CreateHostImpl(DefaultSettings(),
|
| - output_surface.PassAs<OutputSurface>()));
|
| + EXPECT_FALSE(CreateHostImpl(
|
| + DefaultSettings(), FakeOutputSurface::Create3d(context_owned.Pass())));
|
|
|
| SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
|
|
| @@ -1329,7 +1325,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
|
| scroll->AddChild(contents.Pass()); \
|
| root->AddChild(scroll.Pass()); \
|
| scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); \
|
| - root->AddChild(scrollbar.PassAs<LayerImpl>()); \
|
| + root->AddChild(scrollbar.Pass()); \
|
| \
|
| host_impl_->active_tree()->SetRootLayer(root.Pass()); \
|
| host_impl_->active_tree()->SetViewportLayersFromIds( \
|
| @@ -1497,7 +1493,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
|
| scroll->AddChild(contents.Pass());
|
| root->AddChild(scroll.Pass());
|
| scrollbar->SetScrollLayerAndClipLayerByIds(2, 1);
|
| - root->AddChild(scrollbar.PassAs<LayerImpl>());
|
| + root->AddChild(scrollbar.Pass());
|
|
|
| host_impl_->active_tree()->SetRootLayer(root.Pass());
|
| host_impl_->active_tree()->SetViewportLayersFromIds(1, 2, Layer::INVALID_ID);
|
| @@ -1611,7 +1607,7 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
|
| class DidDrawCheckLayer : public LayerImpl {
|
| public:
|
| static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
|
| - return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(tree_impl, id));
|
| + return make_scoped_ptr(new DidDrawCheckLayer(tree_impl, id));
|
| }
|
|
|
| virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* provider)
|
| @@ -1837,13 +1833,12 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer {
|
| bool had_incomplete_tile,
|
| bool animating,
|
| ResourceProvider* resource_provider) {
|
| - return scoped_ptr<LayerImpl>(
|
| - new MissingTextureAnimatingLayer(tree_impl,
|
| - id,
|
| - tile_missing,
|
| - had_incomplete_tile,
|
| - animating,
|
| - resource_provider));
|
| + return make_scoped_ptr(new MissingTextureAnimatingLayer(tree_impl,
|
| + id,
|
| + tile_missing,
|
| + had_incomplete_tile,
|
| + animating,
|
| + resource_provider));
|
| }
|
|
|
| virtual void AppendQuads(RenderPass* render_pass,
|
| @@ -3640,9 +3635,8 @@ class BlendStateCheckLayer : public LayerImpl {
|
| static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl,
|
| int id,
|
| ResourceProvider* resource_provider) {
|
| - return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl,
|
| - id,
|
| - resource_provider));
|
| + return make_scoped_ptr(
|
| + new BlendStateCheckLayer(tree_impl, id, resource_provider));
|
| }
|
|
|
| virtual void AppendQuads(RenderPass* render_pass,
|
| @@ -3954,10 +3948,9 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
|
|
|
| scoped_ptr<OutputSurface> CreateFakeOutputSurface(bool always_draw) {
|
| if (always_draw) {
|
| - return FakeOutputSurface::CreateAlwaysDrawAndSwap3d()
|
| - .PassAs<OutputSurface>();
|
| + return FakeOutputSurface::CreateAlwaysDrawAndSwap3d();
|
| }
|
| - return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
|
| + return FakeOutputSurface::Create3d();
|
| }
|
|
|
| void SetupActiveTreeLayers() {
|
| @@ -4237,7 +4230,7 @@ TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) {
|
| class FakeDrawableLayerImpl: public LayerImpl {
|
| public:
|
| static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
|
| - return scoped_ptr<LayerImpl>(new FakeDrawableLayerImpl(tree_impl, id));
|
| + return make_scoped_ptr(new FakeDrawableLayerImpl(tree_impl, id));
|
| }
|
| protected:
|
| FakeDrawableLayerImpl(LayerTreeImpl* tree_impl, int id)
|
| @@ -4407,7 +4400,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
|
| class FakeLayerWithQuads : public LayerImpl {
|
| public:
|
| static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
|
| - return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(tree_impl, id));
|
| + return make_scoped_ptr(new FakeLayerWithQuads(tree_impl, id));
|
| }
|
|
|
| virtual void AppendQuads(RenderPass* render_pass,
|
| @@ -4521,15 +4514,13 @@ class MockContextHarness {
|
| TEST_F(LayerTreeHostImplTest, NoPartialSwap) {
|
| scoped_ptr<MockContext> mock_context_owned(new MockContext);
|
| MockContext* mock_context = mock_context_owned.get();
|
| -
|
| - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| - mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
|
| MockContextHarness harness(mock_context);
|
|
|
| // Run test case
|
| LayerTreeSettings settings = DefaultSettings();
|
| settings.partial_swap_enabled = false;
|
| - CreateHostImpl(settings, output_surface.Pass());
|
| + CreateHostImpl(settings,
|
| + FakeOutputSurface::Create3d(mock_context_owned.Pass()));
|
| SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
|
|
|
| // Without partial swap, and no clipping, no scissor is set.
|
| @@ -4560,13 +4551,11 @@ TEST_F(LayerTreeHostImplTest, NoPartialSwap) {
|
| TEST_F(LayerTreeHostImplTest, PartialSwap) {
|
| scoped_ptr<MockContext> context_owned(new MockContext);
|
| MockContext* mock_context = context_owned.get();
|
| - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| - context_owned.PassAs<TestWebGraphicsContext3D>()));
|
| MockContextHarness harness(mock_context);
|
|
|
| LayerTreeSettings settings = DefaultSettings();
|
| settings.partial_swap_enabled = true;
|
| - CreateHostImpl(settings, output_surface.Pass());
|
| + CreateHostImpl(settings, FakeOutputSurface::Create3d(context_owned.Pass()));
|
| SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
|
|
|
| // The first frame is not a partially-swapped one.
|
| @@ -4749,7 +4738,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
|
| video_layer->SetBounds(gfx::Size(10, 10));
|
| video_layer->SetContentBounds(gfx::Size(10, 10));
|
| video_layer->SetDrawsContent(true);
|
| - root_layer->AddChild(video_layer.PassAs<LayerImpl>());
|
| + root_layer->AddChild(video_layer.Pass());
|
|
|
| scoped_ptr<IOSurfaceLayerImpl> io_surface_layer =
|
| IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5);
|
| @@ -4757,7 +4746,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
|
| io_surface_layer->SetContentBounds(gfx::Size(10, 10));
|
| io_surface_layer->SetDrawsContent(true);
|
| io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10));
|
| - root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>());
|
| + root_layer->AddChild(io_surface_layer.Pass());
|
|
|
| host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
|
|
|
| @@ -4792,13 +4781,11 @@ TEST_F(LayerTreeHostImplTest, HasTransparentBackground) {
|
| new MockDrawQuadsToFillScreenContext);
|
| MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get();
|
|
|
| - scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
|
| - mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
|
| -
|
| // Run test case
|
| LayerTreeSettings settings = DefaultSettings();
|
| settings.partial_swap_enabled = false;
|
| - CreateHostImpl(settings, output_surface.Pass());
|
| + CreateHostImpl(settings,
|
| + FakeOutputSurface::Create3d(mock_context_owned.Pass()));
|
| SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
|
| host_impl_->active_tree()->set_background_color(SK_ColorWHITE);
|
|
|
| @@ -4867,7 +4854,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
|
| : public LayerTreeHostImplTest {
|
| protected:
|
| virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
|
| - return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>();
|
| + return FakeOutputSurface::CreateDelegating3d();
|
| }
|
|
|
| void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) {
|
| @@ -4922,9 +4909,9 @@ TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
|
| child->SetBounds(gfx::Size(1, 1));
|
| child->SetContentBounds(gfx::Size(1, 1));
|
| child->SetDrawsContent(true);
|
| - root->AddChild(child.PassAs<LayerImpl>());
|
| + root->AddChild(child.Pass());
|
|
|
| - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
|
| + host_impl_->active_tree()->SetRootLayer(root.Pass());
|
|
|
| // Draw a frame. In the first frame, the entire viewport should be damaged.
|
| gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
|
| @@ -4994,7 +4981,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
|
| scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
|
| FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
|
| FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
|
| - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
|
| + content_layer->SetMaskLayer(scoped_mask_layer.Pass());
|
|
|
| gfx::Size root_size(100, 100);
|
| root->SetBounds(root_size);
|
| @@ -5123,7 +5110,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
|
| scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
|
| FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
|
| FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
|
| - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
|
| + content_layer->SetMaskLayer(scoped_mask_layer.Pass());
|
|
|
| gfx::Size root_size(100, 100);
|
| root->SetBounds(root_size);
|
| @@ -5274,7 +5261,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
|
| scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
|
| FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
|
| FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
|
| - replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
|
| + replica_layer->SetMaskLayer(scoped_mask_layer.Pass());
|
|
|
| gfx::Size root_size(100, 100);
|
| root->SetBounds(root_size);
|
| @@ -5426,7 +5413,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
|
| scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
|
| FakeMaskLayerImpl::Create(host_impl_->active_tree(), 5);
|
| FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
|
| - replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
|
| + replica_layer->SetMaskLayer(scoped_mask_layer.Pass());
|
|
|
| gfx::Size root_size(100, 100);
|
| root->SetBounds(root_size);
|
| @@ -5546,7 +5533,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) {
|
| scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
|
| FakeMaskLayerImpl::Create(host_impl_->active_tree(), 6);
|
| FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
|
| - content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>());
|
| + content_layer->SetMaskLayer(scoped_mask_layer.Pass());
|
|
|
| gfx::Size root_size(100, 100);
|
| root->SetBounds(root_size);
|
| @@ -5647,7 +5634,7 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) {
|
| scoped_ptr<FakePictureLayerImpl> scoped_content_layer =
|
| FakePictureLayerImpl::CreateWithPile(host_impl_->pending_tree(), 3, pile);
|
| LayerImpl* content_layer = scoped_content_layer.get();
|
| - scrolling_layer->AddChild(scoped_content_layer.PassAs<LayerImpl>());
|
| + scrolling_layer->AddChild(scoped_content_layer.Pass());
|
| content_layer->SetBounds(content_layer_bounds);
|
| content_layer->SetDrawsContent(true);
|
|
|
| @@ -5795,8 +5782,8 @@ TEST_F(LayerTreeHostImplTest,
|
| video_layer->SetBounds(gfx::Size(10, 10));
|
| video_layer->SetContentBounds(gfx::Size(10, 10));
|
| video_layer->SetDrawsContent(true);
|
| - root_layer->AddChild(video_layer.PassAs<LayerImpl>());
|
| - SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
|
| + root_layer->AddChild(video_layer.Pass());
|
| + SetupRootLayerImpl(root_layer.Pass());
|
|
|
| LayerTreeHostImpl::FrameData frame;
|
| EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
|
| @@ -5821,12 +5808,11 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest {
|
| delegated_rendering));
|
| output_surface_ = output_surface.get();
|
|
|
| - EXPECT_TRUE(CreateHostImpl(DefaultSettings(),
|
| - output_surface.PassAs<OutputSurface>()));
|
| + EXPECT_TRUE(CreateHostImpl(DefaultSettings(), output_surface.Pass()));
|
|
|
| scoped_ptr<SolidColorLayerImpl> root_layer =
|
| SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
|
| - SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
|
| + SetupRootLayerImpl(root_layer.Pass());
|
|
|
| onscreen_context_provider_ = TestContextProvider::Create();
|
| }
|
| @@ -6024,7 +6010,7 @@ TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
|
| TestWebGraphicsContext3D::Create();
|
| TestWebGraphicsContext3D* context3d = context.get();
|
| scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
|
| - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
|
| + CreateHostImpl(DefaultSettings(), output_surface.Pass());
|
|
|
| EXPECT_EQ(0u, context3d->NumTextures());
|
|
|
| @@ -6068,8 +6054,7 @@ TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) {
|
| scoped_ptr<TestWebGraphicsContext3D> context =
|
| TestWebGraphicsContext3D::Create();
|
| TestWebGraphicsContext3D* context3d = context.get();
|
| - scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
|
| - CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
|
| + CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d());
|
|
|
| EXPECT_EQ(0u, context3d->NumTextures());
|
|
|
| @@ -6098,9 +6083,8 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
|
| scoped_refptr<TestContextProvider> context_provider =
|
| TestContextProvider::Create();
|
|
|
| - CreateHostImpl(
|
| - DefaultSettings(),
|
| - FakeOutputSurface::Create3d(context_provider).PassAs<OutputSurface>());
|
| + CreateHostImpl(DefaultSettings(),
|
| + FakeOutputSurface::Create3d(context_provider));
|
|
|
| SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
|
|
|
| @@ -6120,7 +6104,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
|
| EXPECT_FALSE(context_provider->HasOneRef());
|
| EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures());
|
|
|
| - host_impl_.reset();
|
| + host_impl_ = nullptr;
|
|
|
| // The CopyOutputResult's callback was cancelled, the CopyOutputResult
|
| // released, and the texture deleted.
|
| @@ -6452,7 +6436,7 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
|
| root->SetContentBounds(gfx::Size(10, 10));
|
| root->SetDrawsContent(true);
|
|
|
| - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
|
| + host_impl_->active_tree()->SetRootLayer(root.Pass());
|
|
|
| FakeOutputSurface* fake_output_surface =
|
| static_cast<FakeOutputSurface*>(host_impl_->output_surface());
|
| @@ -6492,7 +6476,7 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
|
| root->SetContentBounds(gfx::Size(10, 10));
|
| root->SetDrawsContent(true);
|
|
|
| - host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
|
| + host_impl_->active_tree()->SetRootLayer(root.Pass());
|
|
|
| // Ensure the default frame selection bounds are empty.
|
| FakeOutputSurface* fake_output_surface =
|
| @@ -7126,7 +7110,7 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) {
|
| FakePictureLayerImpl::Create(pending_tree, 10);
|
| pending_layer->DoPostCommitInitializationIfNeeded();
|
| FakePictureLayerImpl* raw_pending_layer = pending_layer.get();
|
| - pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>());
|
| + pending_tree->SetRootLayer(pending_layer.Pass());
|
| ASSERT_EQ(raw_pending_layer, pending_tree->root_layer());
|
|
|
| EXPECT_EQ(0u, raw_pending_layer->did_become_active_call_count());
|
| @@ -7137,7 +7121,7 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) {
|
| FakePictureLayerImpl::Create(pending_tree, 11);
|
| mask_layer->DoPostCommitInitializationIfNeeded();
|
| FakePictureLayerImpl* raw_mask_layer = mask_layer.get();
|
| - raw_pending_layer->SetMaskLayer(mask_layer.PassAs<LayerImpl>());
|
| + raw_pending_layer->SetMaskLayer(mask_layer.Pass());
|
| ASSERT_EQ(raw_mask_layer, raw_pending_layer->mask_layer());
|
|
|
| EXPECT_EQ(1u, raw_pending_layer->did_become_active_call_count());
|
| @@ -7152,8 +7136,8 @@ TEST_F(LayerTreeHostImplTest, DidBecomeActive) {
|
| FakePictureLayerImpl::Create(pending_tree, 13);
|
| replica_mask_layer->DoPostCommitInitializationIfNeeded();
|
| FakePictureLayerImpl* raw_replica_mask_layer = replica_mask_layer.get();
|
| - replica_layer->SetMaskLayer(replica_mask_layer.PassAs<LayerImpl>());
|
| - raw_pending_layer->SetReplicaLayer(replica_layer.PassAs<LayerImpl>());
|
| + replica_layer->SetMaskLayer(replica_mask_layer.Pass());
|
| + raw_pending_layer->SetReplicaLayer(replica_layer.Pass());
|
| ASSERT_EQ(raw_replica_mask_layer,
|
| raw_pending_layer->replica_layer()->mask_layer());
|
|
|
|
|