| 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 9c968bde7260904a7f4396d75272bab4f705ae85..d81c3a8b4b790141b88935188548c5eff9792080 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -235,7 +235,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
| static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) {
|
| ASSERT_EQ(ScrollDelta(layer), gfx::Vector2d());
|
| for (size_t i = 0; i < layer->children().size(); ++i)
|
| - ExpectClearedScrollDeltasRecursive(layer->children()[i].get());
|
| + ExpectClearedScrollDeltasRecursive(layer->children()[i]);
|
| }
|
|
|
| static ::testing::AssertionResult ScrollInfoContains(
|
| @@ -367,7 +367,7 @@ class LayerTreeHostImplTest : public testing::Test,
|
| CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
|
|
|
| LayerImpl* content_layer =
|
| - host_impl_->OuterViewportScrollLayer()->children().back().get();
|
| + host_impl_->OuterViewportScrollLayer()->children().back();
|
| content_layer->SetBounds(content_size);
|
| host_impl_->OuterViewportScrollLayer()->SetBounds(content_size);
|
|
|
| @@ -628,8 +628,7 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) {
|
| root_layer->ScrollBy(scroll_delta);
|
| }
|
|
|
| - LayerImpl* root =
|
| - host_impl_->active_tree()->root_layer()->children()[0].get();
|
| + LayerImpl* root = host_impl_->active_tree()->root_layer()->children()[0];
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info;
|
|
|
| @@ -731,7 +730,7 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
|
| host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| InputHandler::WHEEL)
|
| .thread);
|
| - host_impl_->active_tree()->DetachLayerTree();
|
| + host_impl_->active_tree()->ClearLayers();
|
|
|
| scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
|
|
| @@ -1155,7 +1154,7 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
|
|
| gfx::Size overflow_size(400, 400);
|
| ASSERT_EQ(1u, scroll_layer->children().size());
|
| - LayerImpl* overflow = scroll_layer->children()[0].get();
|
| + LayerImpl* overflow = scroll_layer->children()[0];
|
| overflow->SetBounds(overflow_size);
|
| overflow->SetScrollClipLayer(scroll_layer->parent()->parent()->id());
|
| overflow->layer_tree_impl()
|
| @@ -1227,7 +1226,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingPendingTree) {
|
| root->SetForceRenderSurface(true);
|
|
|
| root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2));
|
| - LayerImpl* child = root->children()[0].get();
|
| + LayerImpl* child = root->children()[0];
|
| child->SetBounds(gfx::Size(10, 10));
|
| child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
|
| child->SetDrawsContent(true);
|
| @@ -1277,7 +1276,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) {
|
| root->SetForceRenderSurface(true);
|
|
|
| root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
|
| - LayerImpl* child = root->children()[0].get();
|
| + LayerImpl* child = root->children()[0];
|
| child->SetBounds(gfx::Size(10, 10));
|
| child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
|
| child->SetDrawsContent(true);
|
| @@ -1341,7 +1340,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) {
|
| root->SetHasRenderSurface(true);
|
|
|
| root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
|
| - LayerImpl* child = root->children()[0].get();
|
| + LayerImpl* child = root->children()[0];
|
| child->SetBounds(gfx::Size(10, 10));
|
| child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
|
| child->SetDrawsContent(true);
|
| @@ -1400,7 +1399,7 @@ TEST_F(LayerTreeHostImplTest, AnimationMarksLayerNotReady) {
|
| root->AddChild(scoped_ptr<MissingTilesLayer>(
|
| new MissingTilesLayer(host_impl_->active_tree(), 2)));
|
| MissingTilesLayer* child =
|
| - static_cast<MissingTilesLayer*>(root->children()[0].get());
|
| + static_cast<MissingTilesLayer*>(root->children()[0]);
|
| child->SetBounds(gfx::Size(10, 10));
|
| child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
|
| child->SetDrawsContent(true);
|
| @@ -3261,7 +3260,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) {
|
| root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
|
| root->SetForceRenderSurface(true);
|
| DidDrawCheckLayer* layer =
|
| - static_cast<DidDrawCheckLayer*>(root->children()[0].get());
|
| + static_cast<DidDrawCheckLayer*>(root->children()[0]);
|
|
|
| {
|
| LayerTreeHostImpl::FrameData frame;
|
| @@ -3303,7 +3302,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
|
| root->SetForceRenderSurface(true);
|
| root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
|
| DidDrawCheckLayer* layer =
|
| - static_cast<DidDrawCheckLayer*>(root->children()[0].get());
|
| + static_cast<DidDrawCheckLayer*>(root->children()[0]);
|
| // Ensure visible_layer_rect for layer is empty.
|
| layer->SetPosition(gfx::PointF(100.f, 100.f));
|
| layer->SetBounds(gfx::Size(10, 10));
|
| @@ -3352,12 +3351,12 @@ TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) {
|
|
|
| root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
|
| DidDrawCheckLayer* occluded_layer =
|
| - static_cast<DidDrawCheckLayer*>(root->children()[0].get());
|
| + static_cast<DidDrawCheckLayer*>(root->children()[0]);
|
|
|
| root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
|
| root->SetForceRenderSurface(true);
|
| DidDrawCheckLayer* top_layer =
|
| - static_cast<DidDrawCheckLayer*>(root->children()[1].get());
|
| + static_cast<DidDrawCheckLayer*>(root->children()[1]);
|
| // This layer covers the occluded_layer above. Make this layer large so it can
|
| // occlude.
|
| top_layer->SetBounds(big_size);
|
| @@ -3389,11 +3388,11 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) {
|
| root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
|
| root->SetForceRenderSurface(true);
|
| DidDrawCheckLayer* layer1 =
|
| - static_cast<DidDrawCheckLayer*>(root->children()[0].get());
|
| + static_cast<DidDrawCheckLayer*>(root->children()[0]);
|
|
|
| layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
|
| DidDrawCheckLayer* layer2 =
|
| - static_cast<DidDrawCheckLayer*>(layer1->children()[0].get());
|
| + static_cast<DidDrawCheckLayer*>(layer1->children()[0]);
|
|
|
| layer1->SetForceRenderSurface(true);
|
| layer1->SetShouldFlattenTransform(true);
|
| @@ -3566,7 +3565,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsAndFails) {
|
| const auto& testcase = cases[i];
|
| std::vector<LayerImpl*> to_remove;
|
| for (const auto& child : root->children())
|
| - to_remove.push_back(child.get());
|
| + to_remove.push_back(child);
|
| for (auto* child : to_remove)
|
| root->RemoveChild(child);
|
| timeline()->ClearPlayers();
|
| @@ -3581,7 +3580,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsAndFails) {
|
| testcase.layer_before.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* before =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_before.has_copy_request)
|
| before->AddCopyRequest();
|
|
|
| @@ -3591,7 +3590,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsAndFails) {
|
| testcase.layer_between.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* between =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_between.has_copy_request)
|
| between->AddCopyRequest();
|
|
|
| @@ -3601,7 +3600,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsAndFails) {
|
| testcase.layer_after.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* after =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_after.has_copy_request)
|
| after->AddCopyRequest();
|
|
|
| @@ -3661,7 +3660,7 @@ TEST_F(LayerTreeHostImplTest,
|
| const auto& testcase = cases[i];
|
| std::vector<LayerImpl*> to_remove;
|
| for (const auto& child : root->children())
|
| - to_remove.push_back(child.get());
|
| + to_remove.push_back(child);
|
| for (auto* child : to_remove)
|
| root->RemoveChild(child);
|
|
|
| @@ -3675,7 +3674,7 @@ TEST_F(LayerTreeHostImplTest,
|
| testcase.layer_before.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* before =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_before.has_copy_request)
|
| before->AddCopyRequest();
|
|
|
| @@ -3685,7 +3684,7 @@ TEST_F(LayerTreeHostImplTest,
|
| testcase.layer_between.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* between =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_between.has_copy_request)
|
| between->AddCopyRequest();
|
|
|
| @@ -3695,7 +3694,7 @@ TEST_F(LayerTreeHostImplTest,
|
| testcase.layer_after.is_animating, host_impl_->resource_provider(),
|
| timeline()));
|
| DidDrawCheckLayer* after =
|
| - static_cast<DidDrawCheckLayer*>(root->children().back().get());
|
| + static_cast<DidDrawCheckLayer*>(root->children().back());
|
| if (testcase.layer_after.has_copy_request)
|
| after->AddCopyRequest();
|
|
|
| @@ -3855,8 +3854,7 @@ TEST_F(LayerTreeHostImplTopControlsTest,
|
| int id = host_impl_->OuterViewportScrollLayer()->id();
|
| host_impl_->OuterViewportScrollLayer()->AddChild(
|
| LayerImpl::Create(host_impl_->active_tree(), id + 2));
|
| - LayerImpl* content =
|
| - active_tree->OuterViewportScrollLayer()->children()[0].get();
|
| + LayerImpl* content = active_tree->OuterViewportScrollLayer()->children()[0];
|
| content->SetBounds(gfx::Size(50, 50));
|
|
|
| SetNeedsRebuildPropertyTrees();
|
| @@ -4777,7 +4775,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
|
| LayerImpl* scroll = SetupScrollAndContentsLayers(surface_size);
|
| scroll->SetDrawsContent(true);
|
| LayerImpl* root = host_impl_->active_tree()->root_layer();
|
| - LayerImpl* child = scroll->children()[0].get();
|
| + LayerImpl* child = scroll->children()[0];
|
| child->SetDrawsContent(true);
|
|
|
| scoped_ptr<LayerImpl> scrollable_child_clip =
|
| @@ -4786,7 +4784,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
|
| CreateScrollableLayer(7, surface_size, scrollable_child_clip.get());
|
| scrollable_child_clip->AddChild(std::move(scrollable_child));
|
| child->AddChild(std::move(scrollable_child_clip));
|
| - LayerImpl* grand_child = child->children()[0].get();
|
| + LayerImpl* grand_child = child->children()[0];
|
| grand_child->SetDrawsContent(true);
|
|
|
| // Set new page scale on impl thread by pinching.
|
| @@ -4903,9 +4901,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
|
| host_impl_->ProcessScrollDeltas();
|
|
|
| // The grand child should have scrolled up to its limit.
|
| - LayerImpl* child =
|
| - host_impl_->active_tree()->root_layer()->children()[0].get();
|
| - LayerImpl* grand_child = child->children()[0].get();
|
| + LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
|
| + LayerImpl* grand_child = child->children()[0];
|
| EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), grand_child->id(),
|
| gfx::Vector2d(0, -5)));
|
|
|
| @@ -4975,9 +4972,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| ->root_layer()
|
| ->children()[0]
|
| ->children()[0]
|
| - ->children()[0]
|
| - .get();
|
| - LayerImpl* grand_child = child->children()[0].get();
|
| + ->children()[0];
|
| + LayerImpl* grand_child = child->children()[0];
|
| EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), grand_child->id(),
|
| gfx::Vector2d(0, -2)));
|
|
|
| @@ -5119,7 +5115,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
|
| // synchronization.
|
| SetNeedsRebuildPropertyTrees();
|
| DrawFrame();
|
| - host_impl_->active_tree()->DetachLayerTree();
|
| + host_impl_->active_tree()->ClearLayers();
|
| scoped_ptr<LayerImpl> root_ptr2 =
|
| LayerImpl::Create(host_impl_->active_tree(), 4);
|
| scoped_ptr<LayerImpl> root_clip2 =
|
| @@ -6051,7 +6047,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
|
| 2,
|
| host_impl_->resource_provider()));
|
| BlendStateCheckLayer* layer1 =
|
| - static_cast<BlendStateCheckLayer*>(root->children()[0].get());
|
| + static_cast<BlendStateCheckLayer*>(root->children()[0]);
|
| layer1->SetPosition(gfx::PointF(2.f, 2.f));
|
|
|
| LayerTreeHostImpl::FrameData frame;
|
| @@ -6105,7 +6101,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
|
| 3,
|
| host_impl_->resource_provider()));
|
| BlendStateCheckLayer* layer2 =
|
| - static_cast<BlendStateCheckLayer*>(layer1->children()[0].get());
|
| + static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
|
| layer2->SetPosition(gfx::PointF(4.f, 4.f));
|
|
|
| // 2 opaque layers, drawn without blending.
|
| @@ -6313,7 +6309,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
|
| 2,
|
| host_impl_->resource_provider()));
|
| child_ = static_cast<BlendStateCheckLayer*>(
|
| - host_impl_->active_tree()->root_layer()->children()[0].get());
|
| + host_impl_->active_tree()->root_layer()->children()[0]);
|
| child_->SetExpectation(false, false);
|
| child_->SetContentsOpaque(true);
|
| }
|
| @@ -7204,8 +7200,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
|
| // culled.
|
| ASSERT_EQ(2u, root_render_pass->quad_list.size());
|
|
|
| - LayerImpl* child =
|
| - host_impl_->active_tree()->root_layer()->children()[0].get();
|
| + LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
|
| gfx::Rect expected_child_visible_rect(child->bounds());
|
| EXPECT_EQ(expected_child_visible_rect,
|
| root_render_pass->quad_list.front()->visible_rect);
|
| @@ -7738,9 +7733,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
|
| {
|
| scoped_ptr<ScrollAndScaleSet> scroll_info;
|
| LayerImpl* child =
|
| - host_impl_->active_tree()->root_layer()->children()[0]->children()
|
| - [0].get();
|
| - LayerImpl* grand_child = child->children()[0].get();
|
| + host_impl_->active_tree()->root_layer()->children()[0]->children()[0];
|
| + LayerImpl* grand_child = child->children()[0];
|
|
|
| gfx::Vector2d scroll_delta(0, -2);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| @@ -9324,10 +9318,8 @@ TEST_F(LayerTreeHostImplTest, ExternalTileConstraintReflectedInPendingTree) {
|
| TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) {
|
| const gfx::Size layer_size(100, 100);
|
| SetupScrollAndContentsLayers(layer_size);
|
| - LayerImpl* content_layer = host_impl_->active_tree()
|
| - ->OuterViewportScrollLayer()
|
| - ->children()[0]
|
| - .get();
|
| + LayerImpl* content_layer =
|
| + host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
|
| SetNeedsRebuildPropertyTrees();
|
| RebuildPropertyTrees();
|
|
|
| @@ -9360,10 +9352,8 @@ TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) {
|
| TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsVisibleRects) {
|
| const gfx::Size layer_size(100, 100);
|
| SetupScrollAndContentsLayers(layer_size);
|
| - LayerImpl* content_layer = host_impl_->active_tree()
|
| - ->OuterViewportScrollLayer()
|
| - ->children()[0]
|
| - .get();
|
| + LayerImpl* content_layer =
|
| + host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
|
| SetNeedsRebuildPropertyTrees();
|
| RebuildPropertyTrees();
|
|
|
| @@ -9401,10 +9391,8 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsVisibleRects) {
|
| TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) {
|
| const gfx::Size layer_size(100, 100);
|
| SetupScrollAndContentsLayers(layer_size);
|
| - LayerImpl* content_layer = host_impl_->active_tree()
|
| - ->OuterViewportScrollLayer()
|
| - ->children()[0]
|
| - .get();
|
| + LayerImpl* content_layer =
|
| + host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
|
| content_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100));
|
| LayerImpl* test_layer = host_impl_->active_tree()->LayerById(100);
|
| test_layer->SetForceRenderSurface(true);
|
| @@ -10353,10 +10341,8 @@ TEST_F(LayerTreeHostImplTest, JitterTest) {
|
|
|
| host_impl_->CreatePendingTree();
|
| host_impl_->pending_tree()->set_source_frame_number(i + 1);
|
| - LayerImpl* content_layer = host_impl_->pending_tree()
|
| - ->OuterViewportScrollLayer()
|
| - ->children()[0]
|
| - .get();
|
| + LayerImpl* content_layer =
|
| + host_impl_->pending_tree()->OuterViewportScrollLayer()->children()[0];
|
| // The scroll done on the active tree is undone on the pending tree.
|
| gfx::Transform translate;
|
| translate.Translate(0, accumulated_scroll);
|
|
|