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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
danakj 2015/11/17 01:12:19 include vector
vmpstr 2015/11/17 23:26:25 Done.
9 9
10 #include "cc/animation/keyframed_animation_curve.h" 10 #include "cc/animation/keyframed_animation_curve.h"
11 #include "cc/animation/layer_animation_controller.h" 11 #include "cc/animation/layer_animation_controller.h"
12 #include "cc/animation/transform_operations.h" 12 #include "cc/animation/transform_operations.h"
13 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
14 #include "cc/layers/content_layer_client.h" 14 #include "cc/layers/content_layer_client.h"
15 #include "cc/layers/layer.h" 15 #include "cc/layers/layer.h"
16 #include "cc/layers/layer_client.h" 16 #include "cc/layers/layer_client.h"
17 #include "cc/layers/layer_impl.h" 17 #include "cc/layers/layer_impl.h"
18 #include "cc/layers/layer_iterator.h" 18 #include "cc/layers/layer_iterator.h"
(...skipping 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 root->AddChild(child.Pass()); 3280 root->AddChild(child.Pass());
3281 root->AddChild(occluding_child.Pass()); 3281 root->AddChild(occluding_child.Pass());
3282 host_impl.active_tree()->SetRootLayer(root.Pass()); 3282 host_impl.active_tree()->SetRootLayer(root.Pass());
3283 host_impl.SetVisible(true); 3283 host_impl.SetVisible(true);
3284 host_impl.InitializeRenderer(output_surface.get()); 3284 host_impl.InitializeRenderer(output_surface.get());
3285 host_impl.active_tree()->BuildPropertyTreesForTesting(); 3285 host_impl.active_tree()->BuildPropertyTreesForTesting();
3286 bool update_lcd_text = false; 3286 bool update_lcd_text = false;
3287 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); 3287 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text);
3288 3288
3289 LayerImpl* grand_child_ptr = 3289 LayerImpl* grand_child_ptr =
3290 host_impl.active_tree()->root_layer()->children()[0]->children()[0]; 3290 host_impl.active_tree()->root_layer()->children()[0]->children()[0].get();
3291 3291
3292 // Though all layers have invertible transforms, matrix multiplication using 3292 // Though all layers have invertible transforms, matrix multiplication using
3293 // floating-point math makes the draw transform uninvertible. 3293 // floating-point math makes the draw transform uninvertible.
3294 EXPECT_FALSE(grand_child_ptr->draw_transform().IsInvertible()); 3294 EXPECT_FALSE(grand_child_ptr->draw_transform().IsInvertible());
3295 3295
3296 // Since |grand_child| has an uninvertible draw transform, it is treated as 3296 // Since |grand_child| has an uninvertible draw transform, it is treated as
3297 // unoccluded (even though |occluding_child| comes later in draw order, and 3297 // unoccluded (even though |occluding_child| comes later in draw order, and
3298 // hence potentially occludes it). 3298 // hence potentially occludes it).
3299 gfx::Rect layer_bounds = gfx::Rect(grand_child_ptr->bounds()); 3299 gfx::Rect layer_bounds = gfx::Rect(grand_child_ptr->bounds());
3300 EXPECT_EQ( 3300 EXPECT_EQ(
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
5362 root->AddChild(copy_grand_parent_sibling_before.Pass()); 5362 root->AddChild(copy_grand_parent_sibling_before.Pass());
5363 root->AddChild(copy_grand_parent.Pass()); 5363 root->AddChild(copy_grand_parent.Pass());
5364 root->AddChild(copy_grand_parent_sibling_after.Pass()); 5364 root->AddChild(copy_grand_parent_sibling_after.Pass());
5365 5365
5366 // Hide the copy_grand_parent and its subtree. But make a copy request in that 5366 // Hide the copy_grand_parent and its subtree. But make a copy request in that
5367 // hidden subtree on copy_layer. 5367 // hidden subtree on copy_layer.
5368 copy_grand_parent_layer->SetHideLayerAndSubtree(true); 5368 copy_grand_parent_layer->SetHideLayerAndSubtree(true);
5369 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true); 5369 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true);
5370 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true); 5370 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true);
5371 5371
5372 ScopedPtrVector<CopyOutputRequest> copy_requests; 5372 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
5373 copy_requests.push_back( 5373 copy_requests.push_back(
5374 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5374 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5375 copy_layer->PassCopyRequests(&copy_requests); 5375 copy_layer->PassCopyRequests(&copy_requests);
5376 EXPECT_TRUE(copy_layer->HasCopyRequest()); 5376 EXPECT_TRUE(copy_layer->HasCopyRequest());
5377 5377
5378 LayerImplList render_surface_layer_list; 5378 LayerImplList render_surface_layer_list;
5379 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5379 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5380 root.get(), root->bounds(), &render_surface_layer_list); 5380 root.get(), root->bounds(), &render_surface_layer_list);
5381 inputs.can_adjust_raster_scales = true; 5381 inputs.can_adjust_raster_scales = true;
5382 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 5382 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
5454 true, false, true); 5454 true, false, true);
5455 copy_layer->SetDrawsContent(true); 5455 copy_layer->SetDrawsContent(true);
5456 5456
5457 scoped_ptr<LayerImpl> copy_child = 5457 scoped_ptr<LayerImpl> copy_child =
5458 LayerImpl::Create(host_impl.pending_tree(), 4); 5458 LayerImpl::Create(host_impl.pending_tree(), 4);
5459 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, 5459 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix,
5460 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5460 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5461 true, false, false); 5461 true, false, false);
5462 copy_child->SetDrawsContent(true); 5462 copy_child->SetDrawsContent(true);
5463 5463
5464 ScopedPtrVector<CopyOutputRequest> copy_requests; 5464 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
5465 copy_requests.push_back( 5465 copy_requests.push_back(
5466 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5466 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5467 copy_layer->PassCopyRequests(&copy_requests); 5467 copy_layer->PassCopyRequests(&copy_requests);
5468 EXPECT_TRUE(copy_layer->HasCopyRequest()); 5468 EXPECT_TRUE(copy_layer->HasCopyRequest());
5469 5469
5470 copy_layer->AddChild(copy_child.Pass()); 5470 copy_layer->AddChild(copy_child.Pass());
5471 copy_parent->AddChild(copy_layer.Pass()); 5471 copy_parent->AddChild(copy_layer.Pass());
5472 root->AddChild(copy_parent.Pass()); 5472 root->AddChild(copy_parent.Pass());
5473 5473
5474 LayerImplList render_surface_layer_list; 5474 LayerImplList render_surface_layer_list;
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
8468 child_ptr->SetHideLayerAndSubtree(false); 8468 child_ptr->SetHideLayerAndSubtree(false);
8469 8469
8470 child_ptr->SetOpacity(0.f); 8470 child_ptr->SetOpacity(0.f);
8471 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8471 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8472 EXPECT_EQ(gfx::Rect(0, 0), 8472 EXPECT_EQ(gfx::Rect(0, 0),
8473 grandchild_ptr->visible_rect_from_property_trees()); 8473 grandchild_ptr->visible_rect_from_property_trees());
8474 8474
8475 // Now, even though child has zero opacity, we will configure |grandchild| and 8475 // Now, even though child has zero opacity, we will configure |grandchild| and
8476 // |greatgrandchild| in several ways that should force the subtree to be 8476 // |greatgrandchild| in several ways that should force the subtree to be
8477 // processed anyhow. 8477 // processed anyhow.
8478 ScopedPtrVector<CopyOutputRequest> requests; 8478 std::vector<scoped_ptr<CopyOutputRequest>> requests;
8479 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 8479 requests.push_back(CopyOutputRequest::CreateEmptyRequest());
8480 8480
8481 greatgrandchild_ptr->PassCopyRequests(&requests); 8481 greatgrandchild_ptr->PassCopyRequests(&requests);
8482 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8482 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8483 EXPECT_EQ(gfx::Rect(10, 10), 8483 EXPECT_EQ(gfx::Rect(10, 10),
8484 grandchild_ptr->visible_rect_from_property_trees()); 8484 grandchild_ptr->visible_rect_from_property_trees());
8485 } 8485 }
8486 8486
8487 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { 8487 TEST_F(LayerTreeHostCommonTest, SkippingLayer) {
8488 gfx::Transform identity; 8488 gfx::Transform identity;
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
9218 bool root_in_rsll = 9218 bool root_in_rsll =
9219 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); 9219 std::find(rsll->begin(), rsll->end(), root) != rsll->end();
9220 EXPECT_TRUE(root_in_rsll); 9220 EXPECT_TRUE(root_in_rsll);
9221 bool render_surface2_in_rsll = 9221 bool render_surface2_in_rsll =
9222 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); 9222 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end();
9223 EXPECT_FALSE(render_surface2_in_rsll); 9223 EXPECT_FALSE(render_surface2_in_rsll);
9224 } 9224 }
9225 9225
9226 } // namespace 9226 } // namespace
9227 } // namespace cc 9227 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698