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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { 130 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) {
131 host_impl_.CreatePendingTree(); 131 host_impl_.CreatePendingTree();
132 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 132 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
133 // Clear recycled tree. 133 // Clear recycled tree.
134 pending_tree->DetachLayerTree(); 134 pending_tree->DetachLayerTree();
135 135
136 scoped_ptr<FakePictureLayerImpl> pending_layer = 136 scoped_ptr<FakePictureLayerImpl> pending_layer =
137 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); 137 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile);
138 pending_layer->SetDrawsContent(true); 138 pending_layer->SetDrawsContent(true);
139 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); 139 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>());
140 pending_tree->root_layer()->SetHasRenderSurface(true);
danakj 2014/09/03 19:30:33 nit: do this on pending_layer above the SetRootLay
awoloszyn 2014/09/09 15:31:36 Done.
140 141
141 pending_layer_ = static_cast<FakePictureLayerImpl*>( 142 pending_layer_ = static_cast<FakePictureLayerImpl*>(
142 host_impl_.pending_tree()->LayerById(id_)); 143 host_impl_.pending_tree()->LayerById(id_));
143 pending_layer_->DoPostCommitInitializationIfNeeded(); 144 pending_layer_->DoPostCommitInitializationIfNeeded();
144 } 145 }
145 146
146 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer, 147 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer,
147 float ideal_contents_scale, 148 float ideal_contents_scale,
148 float device_scale_factor, 149 float device_scale_factor,
149 float page_scale_factor, 150 float page_scale_factor,
(...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile( 3446 scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile(
3446 host_impl_.pending_tree(), 3, pending_pile); 3447 host_impl_.pending_tree(), 3, pending_pile);
3447 3448
3448 mask->SetIsMask(true); 3449 mask->SetIsMask(true);
3449 mask->SetBounds(bounds); 3450 mask->SetBounds(bounds);
3450 mask->SetContentBounds(bounds); 3451 mask->SetContentBounds(bounds);
3451 mask->SetDrawsContent(true); 3452 mask->SetDrawsContent(true);
3452 3453
3453 FakePictureLayerImpl* pending_mask_content = mask.get(); 3454 FakePictureLayerImpl* pending_mask_content = mask.get();
3454 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); 3455 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
3455 3456 layer_with_mask->SetHasRenderSurface(true);
3456 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = 3457 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
3457 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); 3458 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4);
3458 3459
3459 child_of_layer_with_mask->SetBounds(bounds); 3460 child_of_layer_with_mask->SetBounds(bounds);
3460 child_of_layer_with_mask->SetContentBounds(bounds); 3461 child_of_layer_with_mask->SetContentBounds(bounds);
3461 child_of_layer_with_mask->SetDrawsContent(true); 3462 child_of_layer_with_mask->SetDrawsContent(true);
3462 3463
3463 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); 3464 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
3464 3465
3465 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); 3466 root->AddChild(layer_with_mask.PassAs<LayerImpl>());
3466 3467 root->SetHasRenderSurface(true);
3467 host_impl_.pending_tree()->SetRootLayer(root.Pass()); 3468 host_impl_.pending_tree()->SetRootLayer(root.Pass());
3468 3469
3469 EXPECT_FALSE(pending_mask_content->tilings()); 3470 EXPECT_FALSE(pending_mask_content->tilings());
3470 host_impl_.pending_tree()->UpdateDrawProperties(); 3471 host_impl_.pending_tree()->UpdateDrawProperties();
3471 EXPECT_NE(0u, pending_mask_content->num_tilings()); 3472 EXPECT_NE(0u, pending_mask_content->num_tilings());
3472 } 3473 }
3473 3474
3474 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { 3475 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest {
3475 public: 3476 public:
3476 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {} 3477 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {}
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
4140 4141
4141 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 4142 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
4142 4143
4143 VerifyEvictionConsidersOcclusion(pending_layer_, 4144 VerifyEvictionConsidersOcclusion(pending_layer_,
4144 total_expected_occluded_tile_count); 4145 total_expected_occluded_tile_count);
4145 VerifyEvictionConsidersOcclusion(active_layer_, 4146 VerifyEvictionConsidersOcclusion(active_layer_,
4146 total_expected_occluded_tile_count); 4147 total_expected_occluded_tile_count);
4147 } 4148 }
4148 } // namespace 4149 } // namespace
4149 } // namespace cc 4150 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698