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

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

Issue 1808373002: cc : Make tree synchronization independent of layer tree hierarchy (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 2730
2731 class PushPropertiesCountingLayer : public Layer { 2731 class PushPropertiesCountingLayer : public Layer {
2732 public: 2732 public:
2733 static scoped_refptr<PushPropertiesCountingLayer> Create() { 2733 static scoped_refptr<PushPropertiesCountingLayer> Create() {
2734 return new PushPropertiesCountingLayer(); 2734 return new PushPropertiesCountingLayer();
2735 } 2735 }
2736 2736
2737 void PushPropertiesTo(LayerImpl* layer) override { 2737 void PushPropertiesTo(LayerImpl* layer) override {
2738 Layer::PushPropertiesTo(layer); 2738 Layer::PushPropertiesTo(layer);
2739 push_properties_count_++; 2739 push_properties_count_++;
2740 if (persist_needs_push_properties_) 2740 if (persist_needs_push_properties_) {
2741 needs_push_properties_ = true; 2741 layer_tree_host()->AddLayerShouldPushProperties(this);
2742 }
2742 } 2743 }
2743 2744
2744 // Something to make this layer push properties, but no other layer. 2745 // Something to make this layer push properties, but no other layer.
2745 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } 2746 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); }
2746 2747
2747 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { 2748 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
2748 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); 2749 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
2749 } 2750 }
2750 2751
2751 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } 2752 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2816 other_root_->push_properties_count()) 2817 other_root_->push_properties_count())
2817 << "num_commits: " << num_commits_; 2818 << "num_commits: " << num_commits_;
2818 EXPECT_EQ(expected_push_properties_leaf_layer_, 2819 EXPECT_EQ(expected_push_properties_leaf_layer_,
2819 leaf_always_pushing_layer_->push_properties_count()) 2820 leaf_always_pushing_layer_->push_properties_count())
2820 << "num_commits: " << num_commits_; 2821 << "num_commits: " << num_commits_;
2821 2822
2822 ++num_commits_; 2823 ++num_commits_;
2823 2824
2824 // The scrollbar layer always needs to be pushed. 2825 // The scrollbar layer always needs to be pushed.
2825 if (root_->layer_tree_host()) { 2826 if (root_->layer_tree_host()) {
2826 EXPECT_TRUE(root_->descendant_needs_push_properties()); 2827 EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
2827 EXPECT_FALSE(root_->needs_push_properties()); 2828 root_.get()));
2828 } 2829 }
2829 if (child2_->layer_tree_host()) { 2830 if (child2_->layer_tree_host()) {
2830 EXPECT_TRUE(child2_->descendant_needs_push_properties()); 2831 EXPECT_FALSE(
2831 EXPECT_FALSE(child2_->needs_push_properties()); 2832 child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
2833 child2_.get()));
2832 } 2834 }
2833 if (leaf_always_pushing_layer_->layer_tree_host()) { 2835 if (leaf_always_pushing_layer_->layer_tree_host()) {
2834 EXPECT_FALSE( 2836 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host()
2835 leaf_always_pushing_layer_->descendant_needs_push_properties()); 2837 ->LayerNeedsPushPropertiesForTesting(
2836 EXPECT_TRUE(leaf_always_pushing_layer_->needs_push_properties()); 2838 leaf_always_pushing_layer_.get()));
2837 } 2839 }
2838 2840
2839 // child_ and grandchild_ don't persist their need to push properties. 2841 // child_ and grandchild_ don't persist their need to push properties.
2840 if (child_->layer_tree_host()) { 2842 if (child_->layer_tree_host()) {
2841 EXPECT_FALSE(child_->descendant_needs_push_properties()); 2843 EXPECT_FALSE(
2842 EXPECT_FALSE(child_->needs_push_properties()); 2844 child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
2845 child_.get()));
2843 } 2846 }
2844 if (grandchild_->layer_tree_host()) { 2847 if (grandchild_->layer_tree_host()) {
2845 EXPECT_FALSE(grandchild_->descendant_needs_push_properties()); 2848 EXPECT_FALSE(
2846 EXPECT_FALSE(grandchild_->needs_push_properties()); 2849 grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
2850 grandchild_.get()));
2847 } 2851 }
2848 2852
2849 if (other_root_->layer_tree_host()) { 2853 if (other_root_->layer_tree_host()) {
2850 EXPECT_FALSE(other_root_->descendant_needs_push_properties()); 2854 EXPECT_FALSE(
2851 EXPECT_FALSE(other_root_->needs_push_properties()); 2855 other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting(
2856 other_root_.get()));
2852 } 2857 }
2853 2858
2854 switch (num_commits_) { 2859 switch (num_commits_) {
2855 case 1: 2860 case 1:
2856 layer_tree_host()->SetRootLayer(root_); 2861 layer_tree_host()->SetRootLayer(root_);
2857 // Layers added to the tree get committed. 2862 // Layers added to the tree get committed.
2858 ++expected_push_properties_root_; 2863 ++expected_push_properties_root_;
2859 ++expected_push_properties_child_; 2864 ++expected_push_properties_child_;
2860 ++expected_push_properties_grandchild_; 2865 ++expected_push_properties_grandchild_;
2861 ++expected_push_properties_child2_; 2866 ++expected_push_properties_child2_;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 case 1: { 3201 case 1: {
3197 // During update, the ignore_set_needs_commit_ bit is set to true to 3202 // During update, the ignore_set_needs_commit_ bit is set to true to
3198 // avoid causing a second commit to be scheduled. If a property change 3203 // avoid causing a second commit to be scheduled. If a property change
3199 // is made during this, however, it needs to be pushed in the upcoming 3204 // is made during this, however, it needs to be pushed in the upcoming
3200 // commit. 3205 // commit.
3201 scoped_ptr<base::AutoReset<bool>> ignore = 3206 scoped_ptr<base::AutoReset<bool>> ignore =
3202 scrollbar_layer_->IgnoreSetNeedsCommit(); 3207 scrollbar_layer_->IgnoreSetNeedsCommit();
3203 3208
3204 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); 3209 scrollbar_layer_->SetBounds(gfx::Size(30, 30));
3205 3210
3206 EXPECT_TRUE(scrollbar_layer_->needs_push_properties()); 3211 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3207 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3212 scrollbar_layer_.get()));
3208 layer_tree_host()->SetNeedsCommit(); 3213 layer_tree_host()->SetNeedsCommit();
3209 3214
3210 scrollbar_layer_->reset_push_properties_count(); 3215 scrollbar_layer_->reset_push_properties_count();
3211 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); 3216 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count());
3212 break; 3217 break;
3213 } 3218 }
3214 case 2: 3219 case 2:
3215 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); 3220 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count());
3216 EndTest(); 3221 EndTest();
3217 break; 3222 break;
(...skipping 23 matching lines...) Expand all
3241 3246
3242 void DidCommitAndDrawFrame() override { 3247 void DidCommitAndDrawFrame() override {
3243 switch (layer_tree_host()->source_frame_number()) { 3248 switch (layer_tree_host()->source_frame_number()) {
3244 case 0: 3249 case 0:
3245 break; 3250 break;
3246 case 1: { 3251 case 1: {
3247 // During update, the ignore_set_needs_commit_ bit is set to true to 3252 // During update, the ignore_set_needs_commit_ bit is set to true to
3248 // avoid causing a second commit to be scheduled. If a property change 3253 // avoid causing a second commit to be scheduled. If a property change
3249 // is made during this, however, it needs to be pushed in the upcoming 3254 // is made during this, however, it needs to be pushed in the upcoming
3250 // commit. 3255 // commit.
3251 EXPECT_FALSE(root_->needs_push_properties()); 3256 EXPECT_FALSE(
3252 EXPECT_FALSE(child_->needs_push_properties()); 3257 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3258 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3259 child_.get()));
3253 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); 3260 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent());
3254 root_->reset_push_properties_count(); 3261 root_->reset_push_properties_count();
3255 child_->reset_push_properties_count(); 3262 child_->reset_push_properties_count();
3256 child_->SetDrawsContent(true); 3263 child_->SetDrawsContent(true);
3257 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); 3264 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent());
3258 EXPECT_EQ(0u, root_->push_properties_count()); 3265 EXPECT_EQ(0u, root_->push_properties_count());
3259 EXPECT_EQ(0u, child_->push_properties_count()); 3266 EXPECT_EQ(0u, child_->push_properties_count());
3260 EXPECT_TRUE(root_->needs_push_properties()); 3267 EXPECT_TRUE(
3261 EXPECT_TRUE(child_->needs_push_properties()); 3268 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3269 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3270 child_.get()));
3262 break; 3271 break;
3263 } 3272 }
3264 case 2: 3273 case 2:
3265 EXPECT_EQ(1u, root_->push_properties_count()); 3274 EXPECT_EQ(1u, root_->push_properties_count());
3266 EXPECT_EQ(1u, child_->push_properties_count()); 3275 EXPECT_EQ(1u, child_->push_properties_count());
3267 EXPECT_FALSE(root_->needs_push_properties()); 3276 EXPECT_FALSE(
3268 EXPECT_FALSE(child_->needs_push_properties()); 3277 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3278 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3279 child_.get()));
3269 EndTest(); 3280 EndTest();
3270 break; 3281 break;
3271 } 3282 }
3272 } 3283 }
3273 3284
3274 void AfterTest() override {} 3285 void AfterTest() override {}
3275 3286
3276 scoped_refptr<PushPropertiesCountingLayer> root_; 3287 scoped_refptr<PushPropertiesCountingLayer> root_;
3277 scoped_refptr<PushPropertiesCountingLayer> child_; 3288 scoped_refptr<PushPropertiesCountingLayer> child_;
3278 }; 3289 };
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 size_t expected_push_properties_grandchild3_; 3334 size_t expected_push_properties_grandchild3_;
3324 }; 3335 };
3325 3336
3326 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush 3337 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush
3327 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3338 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3328 protected: 3339 protected:
3329 void DidCommitAndDrawFrame() override { 3340 void DidCommitAndDrawFrame() override {
3330 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3341 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3331 switch (last_source_frame_number) { 3342 switch (last_source_frame_number) {
3332 case 0: 3343 case 0:
3333 // All layers except root will need push properties as they are added 3344 // All layers will need push properties as we set their layer tree host
3334 // as a child to some other layer which changes their stacking order.
3335 EXPECT_FALSE(root_->needs_push_properties());
3336 EXPECT_TRUE(root_->descendant_needs_push_properties());
3337 EXPECT_TRUE(child_->needs_push_properties());
3338 EXPECT_TRUE(child_->descendant_needs_push_properties());
3339 EXPECT_TRUE(grandchild1_->needs_push_properties());
3340 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3341 EXPECT_TRUE(grandchild2_->needs_push_properties());
3342 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3343 EXPECT_TRUE(grandchild3_->needs_push_properties());
3344 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3345
3346 layer_tree_host()->SetRootLayer(root_); 3345 layer_tree_host()->SetRootLayer(root_);
3347 3346 EXPECT_TRUE(
3348 // Now, even the root will need to push properties. 3347 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3349 EXPECT_TRUE(root_->needs_push_properties()); 3348 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3350 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3349 child_.get()));
3350 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3351 grandchild1_.get()));
3352 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3353 grandchild2_.get()));
3354 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3355 grandchild3_.get()));
3351 break; 3356 break;
3352 case 1: 3357 case 1:
3353 EndTest(); 3358 EndTest();
3354 break; 3359 break;
3355 } 3360 }
3356 } 3361 }
3357 }; 3362 };
3358 3363
3359 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); 3364 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush);
3360 3365
3361 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion 3366 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
3362 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3367 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3363 protected: 3368 protected:
3364 void DidCommitAndDrawFrame() override { 3369 void DidCommitAndDrawFrame() override {
3365 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3370 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3366 switch (last_source_frame_number) { 3371 switch (last_source_frame_number) {
3367 case 0: 3372 case 0:
3368 layer_tree_host()->SetRootLayer(root_); 3373 layer_tree_host()->SetRootLayer(root_);
3369 break; 3374 break;
3370 case 1: 3375 case 1:
3371 EXPECT_FALSE(root_->needs_push_properties()); 3376 EXPECT_FALSE(
3372 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3377 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3373 EXPECT_FALSE(child_->needs_push_properties()); 3378 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3374 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3379 child_.get()));
3375 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3380 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3376 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3381 grandchild1_.get()));
3377 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3382 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3378 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3383 grandchild2_.get()));
3379 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3384 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3380 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3385 grandchild3_.get()));
3381 3386
3382 grandchild1_->RemoveFromParent(); 3387 grandchild1_->RemoveFromParent();
3383 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); 3388 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3384 3389
3385 EXPECT_FALSE(root_->needs_push_properties()); 3390 EXPECT_FALSE(
3386 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3391 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3387 EXPECT_FALSE(child_->needs_push_properties()); 3392 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3388 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3393 child_.get()));
3389 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3394 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3390 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3395 grandchild2_.get()));
3391 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3396 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3392 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3397 grandchild3_.get()));
3393 3398
3394 child_->AddChild(grandchild1_); 3399 child_->AddChild(grandchild1_);
3395 3400
3396 EXPECT_FALSE(root_->needs_push_properties()); 3401 EXPECT_FALSE(
3397 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3402 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3398 EXPECT_FALSE(child_->needs_push_properties()); 3403 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3399 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3404 child_.get()));
3400 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3405 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3401 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3406 grandchild1_.get()));
3402 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3407 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3403 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3408 grandchild2_.get()));
3404 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3409 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3405 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3410 grandchild3_.get()));
3406 3411
3407 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); 3412 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3408 3413
3409 EXPECT_FALSE(root_->needs_push_properties()); 3414 EXPECT_FALSE(
3410 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3415 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3411 EXPECT_FALSE(child_->needs_push_properties()); 3416 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3412 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3417 child_.get()));
3413 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3418 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3414 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3419 grandchild1_.get()));
3415 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3420 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3416 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3421 grandchild2_.get()));
3417 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3422 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3418 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3423 grandchild3_.get()));
3419 3424
3420 // grandchild2_ will still need a push properties. 3425 // grandchild2_ will still need a push properties.
3421 grandchild1_->RemoveFromParent(); 3426 grandchild1_->RemoveFromParent();
3422 3427
3423 EXPECT_FALSE(root_->needs_push_properties()); 3428 EXPECT_FALSE(
3424 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3429 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3425 EXPECT_FALSE(child_->needs_push_properties()); 3430 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3426 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3431 child_.get()));
3427 3432
3428 // grandchild3_ does not need a push properties, so recursing should 3433 // grandchild3_ does not need a push properties, so recursing should
3429 // no longer be needed. 3434 // no longer be needed.
3430 grandchild2_->RemoveFromParent(); 3435 grandchild2_->RemoveFromParent();
3431 3436
3432 EXPECT_FALSE(root_->needs_push_properties()); 3437 EXPECT_FALSE(
3433 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3438 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3434 EXPECT_FALSE(child_->needs_push_properties()); 3439 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3435 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3440 child_.get()));
3436 EndTest(); 3441 EndTest();
3437 break; 3442 break;
3438 } 3443 }
3439 } 3444 }
3440 }; 3445 };
3441 3446
3442 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); 3447 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion);
3443 3448
3444 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence 3449 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
3445 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3450 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3446 protected: 3451 protected:
3447 void DidCommitAndDrawFrame() override { 3452 void DidCommitAndDrawFrame() override {
3448 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3453 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3449 switch (last_source_frame_number) { 3454 switch (last_source_frame_number) {
3450 case 0: 3455 case 0:
3451 layer_tree_host()->SetRootLayer(root_); 3456 layer_tree_host()->SetRootLayer(root_);
3452 grandchild1_->set_persist_needs_push_properties(true); 3457 grandchild1_->set_persist_needs_push_properties(true);
3453 grandchild2_->set_persist_needs_push_properties(true); 3458 grandchild2_->set_persist_needs_push_properties(true);
3454 break; 3459 break;
3455 case 1: 3460 case 1:
3456 EXPECT_FALSE(root_->needs_push_properties()); 3461 EXPECT_FALSE(
3457 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3462 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3458 EXPECT_FALSE(child_->needs_push_properties()); 3463 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3459 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3464 child_.get()));
3460 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3465 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3461 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3466 grandchild1_.get()));
3462 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3467 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3463 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3468 grandchild2_.get()));
3464 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3469 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3465 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3470 grandchild3_.get()));
3466 3471
3467 // grandchild2_ will still need a push properties. 3472 // grandchild2_ will still need a push properties.
3468 grandchild1_->RemoveFromParent(); 3473 grandchild1_->RemoveFromParent();
3469 3474
3470 EXPECT_FALSE(root_->needs_push_properties()); 3475 EXPECT_FALSE(
3471 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3476 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3472 EXPECT_FALSE(child_->needs_push_properties()); 3477 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3473 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3478 child_.get()));
3474 3479
3475 // grandchild3_ does not need a push properties, so recursing should 3480 // grandchild3_ does not need a push properties, so recursing should
3476 // no longer be needed. 3481 // no longer be needed.
3477 grandchild2_->RemoveFromParent(); 3482 grandchild2_->RemoveFromParent();
3478 3483
3479 EXPECT_FALSE(root_->needs_push_properties()); 3484 EXPECT_FALSE(
3480 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3485 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3481 EXPECT_FALSE(child_->needs_push_properties()); 3486 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3482 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3487 child_.get()));
3483 EndTest(); 3488 EndTest();
3484 break; 3489 break;
3485 } 3490 }
3486 } 3491 }
3487 }; 3492 };
3488 3493
3489 MULTI_THREAD_TEST_F( 3494 MULTI_THREAD_TEST_F(
3490 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); 3495 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence);
3491 3496
3492 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree 3497 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
3493 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3498 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3494 protected: 3499 protected:
3495 void DidCommitAndDrawFrame() override { 3500 void DidCommitAndDrawFrame() override {
3496 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3501 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3497 switch (last_source_frame_number) { 3502 switch (last_source_frame_number) {
3498 case 0: 3503 case 0:
3499 layer_tree_host()->SetRootLayer(root_); 3504 layer_tree_host()->SetRootLayer(root_);
3500 break; 3505 break;
3501 case 1: 3506 case 1:
3502 EXPECT_FALSE(root_->needs_push_properties()); 3507 EXPECT_FALSE(
3503 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3508 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3504 EXPECT_FALSE(child_->needs_push_properties()); 3509 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3505 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3510 child_.get()));
3506 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3511 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3507 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3512 grandchild1_.get()));
3508 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3513 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3509 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3514 grandchild2_.get()));
3510 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3515 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3511 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3516 grandchild3_.get()));
3512 3517
3513 // Change grandchildren while their parent is not in the tree. 3518 // Change grandchildren while their parent is not in the tree.
3514 child_->RemoveFromParent(); 3519 child_->RemoveFromParent();
3515 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); 3520 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3516 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); 3521 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3517 root_->AddChild(child_); 3522 root_->AddChild(child_);
3518 3523
3519 EXPECT_FALSE(root_->needs_push_properties()); 3524 EXPECT_FALSE(
3520 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3525 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3521 EXPECT_TRUE(child_->needs_push_properties()); 3526 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3522 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3527 child_.get()));
3523 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3528 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3524 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3529 grandchild1_.get()));
3525 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3530 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3526 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3531 grandchild2_.get()));
3527 EXPECT_TRUE(grandchild3_->needs_push_properties()); 3532 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3528 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3533 grandchild3_.get()));
3529 3534
3530 grandchild1_->RemoveFromParent(); 3535 grandchild1_->RemoveFromParent();
3531 3536
3532 EXPECT_FALSE(root_->needs_push_properties()); 3537 EXPECT_FALSE(
3533 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3538 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3534 EXPECT_TRUE(child_->needs_push_properties()); 3539 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3535 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3540 child_.get()));
3536 3541
3537 grandchild2_->RemoveFromParent(); 3542 grandchild2_->RemoveFromParent();
3538 3543
3539 EXPECT_FALSE(root_->needs_push_properties()); 3544 EXPECT_FALSE(
3540 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3545 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3541 EXPECT_TRUE(child_->needs_push_properties()); 3546 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3542 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3547 child_.get()));
3543 3548
3544 grandchild3_->RemoveFromParent(); 3549 grandchild3_->RemoveFromParent();
3545 3550
3546 EXPECT_FALSE(root_->needs_push_properties()); 3551 EXPECT_FALSE(
3547 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3552 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3548 EXPECT_TRUE(child_->needs_push_properties()); 3553 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3549 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3554 child_.get()));
3550 3555
3551 EndTest(); 3556 EndTest();
3552 break; 3557 break;
3553 } 3558 }
3554 } 3559 }
3555 }; 3560 };
3556 3561
3557 MULTI_THREAD_TEST_F( 3562 MULTI_THREAD_TEST_F(
3558 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); 3563 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree);
3559 3564
3560 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild 3565 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
3561 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3566 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3562 protected: 3567 protected:
3563 void DidCommitAndDrawFrame() override { 3568 void DidCommitAndDrawFrame() override {
3564 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3569 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3565 switch (last_source_frame_number) { 3570 switch (last_source_frame_number) {
3566 case 0: 3571 case 0:
3567 layer_tree_host()->SetRootLayer(root_); 3572 layer_tree_host()->SetRootLayer(root_);
3568 break; 3573 break;
3569 case 1: 3574 case 1:
3570 EXPECT_FALSE(root_->needs_push_properties()); 3575 EXPECT_FALSE(
3571 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3576 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3572 EXPECT_FALSE(child_->needs_push_properties()); 3577 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3573 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3578 child_.get()));
3574 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3579 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3575 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3580 grandchild1_.get()));
3576 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3581 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3577 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3582 grandchild2_.get()));
3578 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3583 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3579 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3584 grandchild3_.get()));
3580 3585
3581 child_->SetPosition(gfx::PointF(1.f, 1.f)); 3586 child_->SetPosition(gfx::PointF(1.f, 1.f));
3582 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); 3587 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3583 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); 3588 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3584 3589
3585 EXPECT_FALSE(root_->needs_push_properties()); 3590 EXPECT_FALSE(
3586 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3591 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3587 EXPECT_TRUE(child_->needs_push_properties()); 3592 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3588 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3593 child_.get()));
3589 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3594 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3590 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3595 grandchild1_.get()));
3591 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3596 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3592 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3597 grandchild2_.get()));
3593 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3598 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3594 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3599 grandchild3_.get()));
3595 3600
3596 grandchild1_->RemoveFromParent(); 3601 grandchild1_->RemoveFromParent();
3597 3602
3598 EXPECT_FALSE(root_->needs_push_properties()); 3603 EXPECT_FALSE(
3599 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3604 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3600 EXPECT_TRUE(child_->needs_push_properties()); 3605 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3601 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3606 child_.get()));
3602 3607
3603 grandchild2_->RemoveFromParent(); 3608 grandchild2_->RemoveFromParent();
3604 3609
3605 EXPECT_FALSE(root_->needs_push_properties()); 3610 EXPECT_FALSE(
3606 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3611 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3607 EXPECT_TRUE(child_->needs_push_properties()); 3612 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3608 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3613 child_.get()));
3609 3614
3610 child_->RemoveFromParent(); 3615 child_->RemoveFromParent();
3611 3616
3612 EXPECT_FALSE(root_->needs_push_properties()); 3617 EXPECT_FALSE(
3613 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3618 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3614 3619
3615 EndTest(); 3620 EndTest();
3616 break; 3621 break;
3617 } 3622 }
3618 } 3623 }
3619 }; 3624 };
3620 3625
3621 MULTI_THREAD_TEST_F( 3626 MULTI_THREAD_TEST_F(
3622 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); 3627 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild);
3623 3628
3624 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent 3629 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
3625 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3630 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3626 protected: 3631 protected:
3627 void DidCommitAndDrawFrame() override { 3632 void DidCommitAndDrawFrame() override {
3628 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; 3633 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
3629 switch (last_source_frame_number) { 3634 switch (last_source_frame_number) {
3630 case 0: 3635 case 0:
3631 layer_tree_host()->SetRootLayer(root_); 3636 layer_tree_host()->SetRootLayer(root_);
3632 break; 3637 break;
3633 case 1: 3638 case 1:
3634 EXPECT_FALSE(root_->needs_push_properties()); 3639 EXPECT_FALSE(
3635 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3640 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3636 EXPECT_FALSE(child_->needs_push_properties()); 3641 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3637 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3642 child_.get()));
3638 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3643 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3639 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3644 grandchild1_.get()));
3640 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3645 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3641 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3646 grandchild2_.get()));
3642 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3647 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3643 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3648 grandchild3_.get()));
3644 3649
3645 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); 3650 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3646 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); 3651 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3647 child_->SetPosition(gfx::PointF(1.f, 1.f)); 3652 child_->SetPosition(gfx::PointF(1.f, 1.f));
3648 3653
3649 EXPECT_FALSE(root_->needs_push_properties()); 3654 EXPECT_FALSE(
3650 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3655 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3651 EXPECT_TRUE(child_->needs_push_properties()); 3656 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3652 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3657 child_.get()));
3653 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3658 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3654 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3659 grandchild1_.get()));
3655 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3660 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3656 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3661 grandchild2_.get()));
3657 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3662 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3658 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3663 grandchild3_.get()));
3659 3664
3660 grandchild1_->RemoveFromParent(); 3665 grandchild1_->RemoveFromParent();
3661 3666
3662 EXPECT_FALSE(root_->needs_push_properties()); 3667 EXPECT_FALSE(
3663 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3668 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3664 EXPECT_TRUE(child_->needs_push_properties()); 3669 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3665 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3670 child_.get()));
3666 3671
3667 grandchild2_->RemoveFromParent(); 3672 grandchild2_->RemoveFromParent();
3668 3673
3669 EXPECT_FALSE(root_->needs_push_properties()); 3674 EXPECT_FALSE(
3670 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3675 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3671 EXPECT_TRUE(child_->needs_push_properties()); 3676 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3672 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3677 child_.get()));
3673 3678
3674 child_->RemoveFromParent(); 3679 child_->RemoveFromParent();
3675 3680
3676 EXPECT_FALSE(root_->needs_push_properties()); 3681 EXPECT_FALSE(
3677 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3682 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get()));
3678 3683
3679 EndTest(); 3684 EndTest();
3680 break; 3685 break;
3681 } 3686 }
3682 } 3687 }
3683 }; 3688 };
3684 3689
3685 MULTI_THREAD_TEST_F( 3690 MULTI_THREAD_TEST_F(
3686 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); 3691 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent);
3687 3692
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 layer_tree_host()->SetRootLayer(root_layer_); 3856 layer_tree_host()->SetRootLayer(root_layer_);
3852 LayerTreeHostTest::SetupTree(); 3857 LayerTreeHostTest::SetupTree();
3853 } 3858 }
3854 3859
3855 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3860 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3856 3861
3857 void DidCommitAndDrawFrame() override { 3862 void DidCommitAndDrawFrame() override {
3858 switch (layer_tree_host()->source_frame_number()) { 3863 switch (layer_tree_host()->source_frame_number()) {
3859 case 1: 3864 case 1:
3860 // The layer type used does not need to push properties every frame. 3865 // The layer type used does not need to push properties every frame.
3861 EXPECT_FALSE(child_layer_->needs_push_properties()); 3866 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3867 child_layer_.get()));
3862 3868
3863 // Change the bounds of the child layer, but make it skipped 3869 // Change the bounds of the child layer, but make it skipped
3864 // by CalculateDrawProperties. 3870 // by CalculateDrawProperties.
3865 parent_layer_->SetOpacity(0.f); 3871 parent_layer_->SetOpacity(0.f);
3866 child_layer_->SetBounds(gfx::Size(5, 5)); 3872 child_layer_->SetBounds(gfx::Size(5, 5));
3867 break; 3873 break;
3868 case 2: 3874 case 2:
3869 // The bounds of the child layer were pushed to the impl side. 3875 // The bounds of the child layer were pushed to the impl side.
3870 EXPECT_FALSE(child_layer_->needs_push_properties()); 3876 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting(
3877 child_layer_.get()));
3871 3878
3872 EndTest(); 3879 EndTest();
3873 break; 3880 break;
3874 } 3881 }
3875 } 3882 }
3876 3883
3877 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 3884 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
3878 LayerImpl* root = impl->active_tree()->root_layer(); 3885 LayerImpl* root = impl->active_tree()->root_layer();
3879 LayerImpl* parent = root->children()[0].get(); 3886 LayerImpl* parent = root->children()[0].get();
3880 LayerImpl* child = parent->children()[0].get(); 3887 LayerImpl* child = parent->children()[0].get();
(...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 EndTest(); 6654 EndTest();
6648 } 6655 }
6649 6656
6650 void AfterTest() override {} 6657 void AfterTest() override {}
6651 }; 6658 };
6652 6659
6653 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6660 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6654 6661
6655 } // namespace 6662 } // namespace
6656 } // namespace cc 6663 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698