Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 2958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2969 if (persist_needs_push_properties_) | 2969 if (persist_needs_push_properties_) |
| 2970 needs_push_properties_ = true; | 2970 needs_push_properties_ = true; |
| 2971 } | 2971 } |
| 2972 | 2972 |
| 2973 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 2973 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 2974 OVERRIDE { | 2974 OVERRIDE { |
| 2975 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()). | 2975 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()). |
| 2976 PassAs<LayerImpl>(); | 2976 PassAs<LayerImpl>(); |
| 2977 } | 2977 } |
| 2978 | 2978 |
| 2979 void SetDrawsContent(bool draws_content) { | |
| 2980 UpdateDrawsContent(draws_content); | |
| 2981 } | |
| 2982 | |
| 2979 size_t push_properties_count() const { return push_properties_count_; } | 2983 size_t push_properties_count() const { return push_properties_count_; } |
| 2980 void reset_push_properties_count() { push_properties_count_ = 0; } | 2984 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 2981 | 2985 |
| 2982 void set_persist_needs_push_properties(bool persist) { | 2986 void set_persist_needs_push_properties(bool persist) { |
| 2983 persist_needs_push_properties_ = persist; | 2987 persist_needs_push_properties_ = persist; |
| 2984 } | 2988 } |
| 2985 | 2989 |
| 2986 private: | 2990 private: |
| 2987 PushPropertiesCountingLayer() | 2991 PushPropertiesCountingLayer() |
| 2988 : push_properties_count_(0), persist_needs_push_properties_(false) { | 2992 : push_properties_count_(0), persist_needs_push_properties_(false) { |
| 2989 SetBounds(gfx::Size(1, 1)); | 2993 SetBounds(gfx::Size(1, 1)); |
| 2990 SetIsDrawable(true); | 2994 SetIsDrawable(true); |
|
danakj
2014/07/17 17:21:26
What if we don't set this to true. How many of the
awoloszyn
2014/07/17 20:45:00
Very good call. We actually don't have to change a
| |
| 2991 } | 2995 } |
| 2992 virtual ~PushPropertiesCountingLayer() {} | 2996 virtual ~PushPropertiesCountingLayer() {} |
| 2993 | 2997 |
| 2994 size_t push_properties_count_; | 2998 size_t push_properties_count_; |
| 2995 bool persist_needs_push_properties_; | 2999 bool persist_needs_push_properties_; |
| 2996 }; | 3000 }; |
| 2997 | 3001 |
| 2998 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { | 3002 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { |
| 2999 protected: | 3003 protected: |
| 3000 virtual void BeginTest() OVERRIDE { | 3004 virtual void BeginTest() OVERRIDE { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3096 ++expected_push_properties_child_; | 3100 ++expected_push_properties_child_; |
| 3097 ++expected_push_properties_grandchild_; | 3101 ++expected_push_properties_grandchild_; |
| 3098 ++expected_push_properties_child2_; | 3102 ++expected_push_properties_child2_; |
| 3099 break; | 3103 break; |
| 3100 case 5: | 3104 case 5: |
| 3101 layer_tree_host()->SetNeedsCommit(); | 3105 layer_tree_host()->SetNeedsCommit(); |
| 3102 // No layers need commit. | 3106 // No layers need commit. |
| 3103 break; | 3107 break; |
| 3104 case 6: | 3108 case 6: |
| 3105 child_->RemoveFromParent(); | 3109 child_->RemoveFromParent(); |
| 3106 // No layers need commit. | 3110 // No layers need commit. |
|
danakj
2014/07/17 17:21:25
Update comment explaining why this happens now
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3111 ++expected_push_properties_root_; | |
| 3107 break; | 3112 break; |
| 3108 case 7: | 3113 case 7: |
| 3109 root_->AddChild(child_); | 3114 root_->AddChild(child_); |
| 3110 // Layers added to the tree get committed. | 3115 // Layers added to the tree get committed. |
|
danakj
2014/07/17 17:21:26
update comment
awoloszyn
2014/07/17 20:45:01
Done.
| |
| 3111 ++expected_push_properties_child_; | 3116 ++expected_push_properties_child_; |
| 3112 ++expected_push_properties_grandchild_; | 3117 ++expected_push_properties_grandchild_; |
| 3118 ++expected_push_properties_root_; | |
| 3113 break; | 3119 break; |
| 3114 case 8: | 3120 case 8: |
| 3121 ++expected_push_properties_root_; | |
|
danakj
2014/07/17 17:21:26
move below the comment and update it to reflect wh
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3122 ++expected_push_properties_child_; | |
| 3115 grandchild_->RemoveFromParent(); | 3123 grandchild_->RemoveFromParent(); |
| 3116 // No layers need commit. | 3124 // No layers need commit. |
| 3117 break; | 3125 break; |
| 3118 case 9: | 3126 case 9: |
| 3119 child_->AddChild(grandchild_); | 3127 child_->AddChild(grandchild_); |
| 3120 // Layers added to the tree get committed. | 3128 // Layers added to the tree get committed. |
|
danakj
2014/07/17 17:21:26
update comment
awoloszyn
2014/07/17 20:45:01
Done.
| |
| 3121 ++expected_push_properties_grandchild_; | 3129 ++expected_push_properties_grandchild_; |
| 3130 ++expected_push_properties_root_; | |
| 3131 ++expected_push_properties_child_; | |
| 3122 break; | 3132 break; |
| 3123 case 10: | 3133 case 10: |
| 3124 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 3134 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 3125 // No layers need commit. | 3135 // No layers need commit. |
| 3126 break; | 3136 break; |
| 3127 case 11: | 3137 case 11: |
| 3128 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); | 3138 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.8f, 1.1f); |
| 3129 // No layers need commit. | 3139 // No layers need commit. |
| 3130 break; | 3140 break; |
| 3131 case 12: | 3141 case 12: |
| 3132 child_->SetPosition(gfx::Point(1, 1)); | 3142 child_->SetPosition(gfx::Point(1, 1)); |
| 3133 // The modified layer needs commit | 3143 // The modified layer needs commit |
| 3134 ++expected_push_properties_child_; | 3144 ++expected_push_properties_child_; |
| 3135 break; | 3145 break; |
| 3136 case 13: | 3146 case 13: |
| 3137 child2_->SetPosition(gfx::Point(1, 1)); | 3147 child2_->SetPosition(gfx::Point(1, 1)); |
| 3138 // The modified layer needs commit | 3148 // The modified layer needs commit |
| 3139 ++expected_push_properties_child2_; | 3149 ++expected_push_properties_child2_; |
| 3140 break; | 3150 break; |
| 3141 case 14: | 3151 case 14: |
| 3142 child_->RemoveFromParent(); | 3152 child_->RemoveFromParent(); |
| 3143 root_->AddChild(child_); | 3153 root_->AddChild(child_); |
| 3144 // Layers added to the tree get committed. | 3154 // Layers added to the tree get committed. |
|
danakj
2014/07/17 17:21:26
update comment
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3145 ++expected_push_properties_child_; | 3155 ++expected_push_properties_child_; |
| 3146 ++expected_push_properties_grandchild_; | 3156 ++expected_push_properties_grandchild_; |
| 3157 ++expected_push_properties_root_; | |
| 3147 break; | 3158 break; |
| 3148 case 15: | 3159 case 15: |
| 3149 grandchild_->SetPosition(gfx::Point(1, 1)); | 3160 grandchild_->SetPosition(gfx::Point(1, 1)); |
| 3150 // The modified layer needs commit | 3161 // The modified layer needs commit |
| 3151 ++expected_push_properties_grandchild_; | 3162 ++expected_push_properties_grandchild_; |
| 3152 break; | 3163 break; |
| 3153 case 16: | 3164 case 16: |
| 3154 // SetNeedsDisplay does not always set needs commit (so call it | 3165 // SetNeedsDisplay does not always set needs commit (so call it |
| 3155 // explicitly), but is a property change. | 3166 // explicitly), but is a property change. |
| 3156 child_->SetNeedsDisplay(); | 3167 child_->SetNeedsDisplay(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3249 expected_push_properties_child_impl_ = | 3260 expected_push_properties_child_impl_ = |
| 3250 expected_push_properties_child2_impl_; | 3261 expected_push_properties_child2_impl_; |
| 3251 expected_push_properties_child2_impl_ = 0; | 3262 expected_push_properties_child2_impl_ = 0; |
| 3252 // grandchild_impl becomes grandchild2_impl. | 3263 // grandchild_impl becomes grandchild2_impl. |
| 3253 expected_push_properties_grandchild_impl_ = | 3264 expected_push_properties_grandchild_impl_ = |
| 3254 expected_push_properties_grandchild2_impl_; | 3265 expected_push_properties_grandchild2_impl_; |
| 3255 expected_push_properties_grandchild2_impl_ = 0; | 3266 expected_push_properties_grandchild2_impl_ = 0; |
| 3256 | 3267 |
| 3257 // grandchild_impl is now the leaf that always pushes. It is pushed. | 3268 // grandchild_impl is now the leaf that always pushes. It is pushed. |
| 3258 ++expected_push_properties_grandchild_impl_; | 3269 ++expected_push_properties_grandchild_impl_; |
| 3270 ++expected_push_properties_root_impl_; | |
|
danakj
2014/07/17 17:21:25
explain this one in comment too
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3259 break; | 3271 break; |
| 3260 case 7: | 3272 case 7: |
| 3261 // The leaf that always pushes is pushed. | 3273 // The leaf that always pushes is pushed. |
| 3262 ++expected_push_properties_grandchild_impl_; | 3274 ++expected_push_properties_grandchild_impl_; |
| 3263 | 3275 |
| 3264 // Child is added back. New layers are initialized. | 3276 // Child is added back. New layers are initialized. |
| 3265 ++expected_push_properties_grandchild2_impl_; | 3277 ++expected_push_properties_grandchild2_impl_; |
| 3266 ++expected_push_properties_child2_impl_; | 3278 ++expected_push_properties_child2_impl_; |
| 3279 ++expected_push_properties_root_impl_; | |
|
danakj
2014/07/17 17:21:26
explain with commetn
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3267 break; | 3280 break; |
| 3268 case 8: | 3281 case 8: |
| 3269 // Leaf is removed. | 3282 // Leaf is removed. |
| 3270 expected_push_properties_grandchild2_impl_ = 0; | 3283 expected_push_properties_grandchild2_impl_ = 0; |
| 3271 | 3284 |
| 3272 // Always pushing. | 3285 // Always pushing. |
| 3273 ++expected_push_properties_grandchild_impl_; | 3286 ++expected_push_properties_grandchild_impl_; |
| 3287 ++expected_push_properties_child2_impl_; | |
|
danakj
2014/07/17 17:21:26
explain with comment
awoloszyn
2014/07/17 20:45:01
Done.
| |
| 3288 ++expected_push_properties_root_impl_; | |
| 3274 break; | 3289 break; |
| 3275 case 9: | 3290 case 9: |
| 3276 // Leaf is added back | 3291 // Leaf is added back |
| 3277 ++expected_push_properties_grandchild2_impl_; | 3292 ++expected_push_properties_grandchild2_impl_; |
| 3278 | 3293 |
| 3279 // The leaf that always pushes is pushed. | 3294 // The leaf that always pushes is pushed. |
| 3280 ++expected_push_properties_grandchild_impl_; | 3295 ++expected_push_properties_grandchild_impl_; |
| 3296 ++expected_push_properties_root_impl_; | |
|
danakj
2014/07/17 17:21:26
explain with comment
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3297 ++expected_push_properties_child2_impl_; | |
| 3281 break; | 3298 break; |
| 3282 case 10: | 3299 case 10: |
| 3283 // The leaf that always pushes is pushed. | 3300 // The leaf that always pushes is pushed. |
| 3284 ++expected_push_properties_grandchild_impl_; | 3301 ++expected_push_properties_grandchild_impl_; |
| 3285 break; | 3302 break; |
| 3286 case 11: | 3303 case 11: |
| 3287 // The leaf that always pushes is pushed. | 3304 // The leaf that always pushes is pushed. |
| 3288 ++expected_push_properties_grandchild_impl_; | 3305 ++expected_push_properties_grandchild_impl_; |
| 3289 break; | 3306 break; |
| 3290 case 12: | 3307 case 12: |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 3305 // Second child is removed from tree. Don't discard counts because | 3322 // Second child is removed from tree. Don't discard counts because |
| 3306 // they are added back before commit. | 3323 // they are added back before commit. |
| 3307 | 3324 |
| 3308 // The leaf that always pushes is pushed. | 3325 // The leaf that always pushes is pushed. |
| 3309 ++expected_push_properties_grandchild_impl_; | 3326 ++expected_push_properties_grandchild_impl_; |
| 3310 | 3327 |
| 3311 // Second child added back. | 3328 // Second child added back. |
| 3312 ++expected_push_properties_child2_impl_; | 3329 ++expected_push_properties_child2_impl_; |
| 3313 ++expected_push_properties_grandchild2_impl_; | 3330 ++expected_push_properties_grandchild2_impl_; |
| 3314 | 3331 |
| 3332 ++expected_push_properties_root_impl_; | |
| 3315 break; | 3333 break; |
| 3316 case 15: | 3334 case 15: |
| 3317 // The position of this child was changed. | 3335 // The position of this child was changed. |
| 3318 ++expected_push_properties_grandchild2_impl_; | 3336 ++expected_push_properties_grandchild2_impl_; |
| 3319 | 3337 |
| 3320 // The leaf that always pushes is pushed. | 3338 // The leaf that always pushes is pushed. |
| 3321 ++expected_push_properties_grandchild_impl_; | 3339 ++expected_push_properties_grandchild_impl_; |
| 3322 break; | 3340 break; |
| 3323 case 16: | 3341 case 16: |
| 3324 // Second child is invalidated with SetNeedsDisplay | 3342 // Second child is invalidated with SetNeedsDisplay |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3437 } | 3455 } |
| 3438 | 3456 |
| 3439 virtual void AfterTest() OVERRIDE {} | 3457 virtual void AfterTest() OVERRIDE {} |
| 3440 | 3458 |
| 3441 scoped_refptr<Layer> root_; | 3459 scoped_refptr<Layer> root_; |
| 3442 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; | 3460 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; |
| 3443 }; | 3461 }; |
| 3444 | 3462 |
| 3445 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); | 3463 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); |
| 3446 | 3464 |
| 3465 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | |
| 3466 protected: | |
| 3467 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | |
| 3468 | |
| 3469 virtual void SetupTree() OVERRIDE { | |
| 3470 root_ = PushPropertiesCountingLayer::Create(); | |
| 3471 child_ = PushPropertiesCountingLayer::Create(); | |
| 3472 root_->AddChild(child_); | |
| 3473 | |
| 3474 layer_tree_host()->SetRootLayer(root_); | |
| 3475 LayerTreeHostTest::SetupTree(); | |
| 3476 } | |
| 3477 | |
| 3478 virtual void DidCommitAndDrawFrame() OVERRIDE { | |
| 3479 switch (layer_tree_host()->source_frame_number()) { | |
| 3480 case 0: | |
| 3481 break; | |
| 3482 case 1: { | |
| 3483 // During update, the ignore_set_needs_commit_ bit is set to true to | |
| 3484 // avoid causing a second commit to be scheduled. If a property change | |
| 3485 // is made during this, however, it needs to be pushed in the upcoming | |
| 3486 // commit. | |
| 3487 EXPECT_FALSE(root_->needs_push_properties()); | |
| 3488 EXPECT_FALSE(child_->needs_push_properties()); | |
| 3489 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | |
| 3490 root_->reset_push_properties_count(); | |
| 3491 child_->reset_push_properties_count(); | |
| 3492 child_->SetDrawsContent(false); | |
| 3493 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | |
| 3494 EXPECT_EQ(0u, root_->push_properties_count()); | |
| 3495 EXPECT_EQ(0u, child_->push_properties_count()); | |
| 3496 EXPECT_TRUE(root_->needs_push_properties()); | |
| 3497 EXPECT_TRUE(child_->needs_push_properties()); | |
| 3498 break; | |
| 3499 } | |
| 3500 case 2: | |
| 3501 EXPECT_EQ(1u, root_->push_properties_count()); | |
| 3502 EXPECT_EQ(1u, child_->push_properties_count()); | |
| 3503 EXPECT_FALSE(root_->needs_push_properties()); | |
| 3504 EXPECT_FALSE(child_->needs_push_properties()); | |
| 3505 EndTest(); | |
| 3506 break; | |
| 3507 } | |
| 3508 } | |
| 3509 | |
| 3510 virtual void AfterTest() OVERRIDE {} | |
| 3511 | |
| 3512 scoped_refptr<PushPropertiesCountingLayer> root_; | |
| 3513 scoped_refptr<PushPropertiesCountingLayer> child_; | |
| 3514 }; | |
| 3515 | |
| 3516 MULTI_THREAD_TEST_F(LayerTreeHostTestSetDrawableCausesCommit); | |
| 3517 | |
| 3447 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren | 3518 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren |
| 3448 : public LayerTreeHostTest { | 3519 : public LayerTreeHostTest { |
| 3449 protected: | 3520 protected: |
| 3450 virtual void BeginTest() OVERRIDE { | 3521 virtual void BeginTest() OVERRIDE { |
| 3451 expected_push_properties_root_ = 0; | 3522 expected_push_properties_root_ = 0; |
| 3452 expected_push_properties_child_ = 0; | 3523 expected_push_properties_child_ = 0; |
| 3453 expected_push_properties_grandchild1_ = 0; | 3524 expected_push_properties_grandchild1_ = 0; |
| 3454 expected_push_properties_grandchild2_ = 0; | 3525 expected_push_properties_grandchild2_ = 0; |
| 3455 expected_push_properties_grandchild3_ = 0; | 3526 expected_push_properties_grandchild3_ = 0; |
| 3456 PostSetNeedsCommitToMainThread(); | 3527 PostSetNeedsCommitToMainThread(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3544 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3615 EXPECT_FALSE(grandchild1_->needs_push_properties()); |
| 3545 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3616 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3546 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3617 EXPECT_FALSE(grandchild2_->needs_push_properties()); |
| 3547 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3618 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3548 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3619 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3549 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3620 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3550 | 3621 |
| 3551 grandchild1_->RemoveFromParent(); | 3622 grandchild1_->RemoveFromParent(); |
| 3552 grandchild1_->SetPosition(gfx::Point(1, 1)); | 3623 grandchild1_->SetPosition(gfx::Point(1, 1)); |
| 3553 | 3624 |
| 3554 EXPECT_FALSE(root_->needs_push_properties()); | 3625 EXPECT_TRUE(root_->needs_push_properties()); |
| 3555 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3626 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3556 EXPECT_FALSE(child_->needs_push_properties()); | 3627 EXPECT_TRUE(child_->needs_push_properties()); |
| 3557 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3628 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3558 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3629 EXPECT_FALSE(grandchild2_->needs_push_properties()); |
| 3559 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3630 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3560 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3631 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3561 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3632 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3562 | 3633 |
| 3563 child_->AddChild(grandchild1_); | 3634 child_->AddChild(grandchild1_); |
| 3564 | 3635 |
| 3565 EXPECT_FALSE(root_->needs_push_properties()); | 3636 EXPECT_TRUE(root_->needs_push_properties()); |
| 3566 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3637 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3567 EXPECT_FALSE(child_->needs_push_properties()); | 3638 EXPECT_TRUE(child_->needs_push_properties()); |
| 3568 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3639 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3569 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3640 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3570 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3641 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3571 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3642 EXPECT_FALSE(grandchild2_->needs_push_properties()); |
| 3572 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3643 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3573 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3644 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3574 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3645 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3575 | 3646 |
| 3576 grandchild2_->SetPosition(gfx::Point(1, 1)); | 3647 grandchild2_->SetPosition(gfx::Point(1, 1)); |
| 3577 | 3648 |
| 3578 EXPECT_FALSE(root_->needs_push_properties()); | 3649 EXPECT_TRUE(root_->needs_push_properties()); |
| 3579 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3650 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3580 EXPECT_FALSE(child_->needs_push_properties()); | 3651 EXPECT_TRUE(child_->needs_push_properties()); |
| 3581 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3652 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3582 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3653 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3583 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3654 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3584 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3655 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3585 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3656 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3586 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3657 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3587 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3658 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3588 | 3659 |
| 3589 // grandchild2_ will still need a push properties. | 3660 // grandchild2_ will still need a push properties. |
| 3590 grandchild1_->RemoveFromParent(); | 3661 grandchild1_->RemoveFromParent(); |
| 3591 | 3662 |
| 3592 EXPECT_FALSE(root_->needs_push_properties()); | 3663 EXPECT_TRUE(root_->needs_push_properties()); |
| 3593 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3664 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3594 EXPECT_FALSE(child_->needs_push_properties()); | 3665 EXPECT_TRUE(child_->needs_push_properties()); |
| 3595 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3666 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3596 | 3667 |
| 3597 // grandchild3_ does not need a push properties, so recursing should | 3668 // grandchild3_ does not need a push properties, so recursing should |
| 3598 // no longer be needed. | 3669 // no longer be needed. |
| 3599 grandchild2_->RemoveFromParent(); | 3670 grandchild2_->RemoveFromParent(); |
| 3600 | 3671 |
| 3601 EXPECT_FALSE(root_->needs_push_properties()); | 3672 EXPECT_TRUE(root_->needs_push_properties()); |
| 3602 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3673 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3603 EXPECT_FALSE(child_->needs_push_properties()); | 3674 EXPECT_TRUE(child_->needs_push_properties()); |
| 3604 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3675 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3605 EndTest(); | 3676 EndTest(); |
| 3606 break; | 3677 break; |
| 3607 } | 3678 } |
| 3608 } | 3679 } |
| 3609 }; | 3680 }; |
| 3610 | 3681 |
| 3611 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3682 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 3612 | 3683 |
| 3613 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3684 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 3629 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3700 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3630 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3701 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3631 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3702 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3632 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3703 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3633 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3704 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3634 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3705 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3635 | 3706 |
| 3636 // grandchild2_ will still need a push properties. | 3707 // grandchild2_ will still need a push properties. |
| 3637 grandchild1_->RemoveFromParent(); | 3708 grandchild1_->RemoveFromParent(); |
| 3638 | 3709 |
| 3639 EXPECT_FALSE(root_->needs_push_properties()); | 3710 // We will need push properties because our drawable children changed |
|
danakj
2014/07/17 17:21:25
nit: .
awoloszyn
2014/07/17 20:45:00
Done.
| |
| 3711 EXPECT_TRUE(root_->needs_push_properties()); | |
| 3640 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3712 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3641 EXPECT_FALSE(child_->needs_push_properties()); | 3713 EXPECT_TRUE(child_->needs_push_properties()); |
| 3642 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3714 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3643 | 3715 |
| 3644 // grandchild3_ does not need a push properties, so recursing should | 3716 // grandchild3_ does not need a push properties, so recursing should |
| 3645 // no longer be needed. | 3717 // no longer be needed. |
| 3646 grandchild2_->RemoveFromParent(); | 3718 grandchild2_->RemoveFromParent(); |
| 3647 | 3719 |
| 3648 EXPECT_FALSE(root_->needs_push_properties()); | 3720 EXPECT_TRUE(root_->needs_push_properties()); |
| 3649 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3721 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3650 EXPECT_FALSE(child_->needs_push_properties()); | 3722 EXPECT_TRUE(child_->needs_push_properties()); |
| 3651 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3723 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3652 EndTest(); | 3724 EndTest(); |
| 3653 break; | 3725 break; |
| 3654 } | 3726 } |
| 3655 } | 3727 } |
| 3656 }; | 3728 }; |
| 3657 | 3729 |
| 3658 MULTI_THREAD_TEST_F( | 3730 MULTI_THREAD_TEST_F( |
| 3659 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3731 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 3660 | 3732 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3678 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3750 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3679 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3751 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3680 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3752 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3681 | 3753 |
| 3682 // Change grandchildren while their parent is not in the tree. | 3754 // Change grandchildren while their parent is not in the tree. |
| 3683 child_->RemoveFromParent(); | 3755 child_->RemoveFromParent(); |
| 3684 grandchild1_->SetPosition(gfx::Point(1, 1)); | 3756 grandchild1_->SetPosition(gfx::Point(1, 1)); |
| 3685 grandchild2_->SetPosition(gfx::Point(1, 1)); | 3757 grandchild2_->SetPosition(gfx::Point(1, 1)); |
| 3686 root_->AddChild(child_); | 3758 root_->AddChild(child_); |
| 3687 | 3759 |
| 3688 EXPECT_FALSE(root_->needs_push_properties()); | 3760 EXPECT_TRUE(root_->needs_push_properties()); |
| 3689 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3761 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3690 EXPECT_TRUE(child_->needs_push_properties()); | 3762 EXPECT_TRUE(child_->needs_push_properties()); |
| 3691 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3763 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3692 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3764 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3693 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3765 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3694 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3766 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3695 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3767 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3696 EXPECT_TRUE(grandchild3_->needs_push_properties()); | 3768 EXPECT_TRUE(grandchild3_->needs_push_properties()); |
| 3697 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3769 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3698 | 3770 |
| 3699 grandchild1_->RemoveFromParent(); | 3771 grandchild1_->RemoveFromParent(); |
| 3700 | 3772 |
| 3701 EXPECT_FALSE(root_->needs_push_properties()); | 3773 EXPECT_TRUE(root_->needs_push_properties()); |
| 3702 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3774 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3703 EXPECT_TRUE(child_->needs_push_properties()); | 3775 EXPECT_TRUE(child_->needs_push_properties()); |
| 3704 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3776 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3705 | 3777 |
| 3706 grandchild2_->RemoveFromParent(); | 3778 grandchild2_->RemoveFromParent(); |
| 3707 | 3779 |
| 3708 EXPECT_FALSE(root_->needs_push_properties()); | 3780 EXPECT_TRUE(root_->needs_push_properties()); |
| 3709 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3781 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3710 EXPECT_TRUE(child_->needs_push_properties()); | 3782 EXPECT_TRUE(child_->needs_push_properties()); |
| 3711 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3783 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3712 | 3784 |
| 3713 grandchild3_->RemoveFromParent(); | 3785 grandchild3_->RemoveFromParent(); |
| 3714 | 3786 |
| 3715 EXPECT_FALSE(root_->needs_push_properties()); | 3787 EXPECT_TRUE(root_->needs_push_properties()); |
| 3716 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3788 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3717 EXPECT_TRUE(child_->needs_push_properties()); | 3789 EXPECT_TRUE(child_->needs_push_properties()); |
| 3718 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3790 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3719 | 3791 |
| 3720 EndTest(); | 3792 EndTest(); |
| 3721 break; | 3793 break; |
| 3722 } | 3794 } |
| 3723 } | 3795 } |
| 3724 }; | 3796 }; |
| 3725 | 3797 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3757 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3829 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3758 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3830 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3759 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3831 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3760 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3832 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3761 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3833 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3762 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3834 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3763 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3835 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3764 | 3836 |
| 3765 grandchild1_->RemoveFromParent(); | 3837 grandchild1_->RemoveFromParent(); |
| 3766 | 3838 |
| 3767 EXPECT_FALSE(root_->needs_push_properties()); | 3839 EXPECT_TRUE(root_->needs_push_properties()); |
| 3768 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3840 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3769 EXPECT_TRUE(child_->needs_push_properties()); | 3841 EXPECT_TRUE(child_->needs_push_properties()); |
| 3770 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3842 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3771 | 3843 |
| 3772 grandchild2_->RemoveFromParent(); | 3844 grandchild2_->RemoveFromParent(); |
| 3773 | 3845 |
| 3774 EXPECT_FALSE(root_->needs_push_properties()); | 3846 EXPECT_TRUE(root_->needs_push_properties()); |
| 3775 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3847 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3776 EXPECT_TRUE(child_->needs_push_properties()); | 3848 EXPECT_TRUE(child_->needs_push_properties()); |
| 3777 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3849 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3778 | 3850 |
| 3779 child_->RemoveFromParent(); | 3851 child_->RemoveFromParent(); |
| 3780 | 3852 |
| 3781 EXPECT_FALSE(root_->needs_push_properties()); | 3853 EXPECT_TRUE(root_->needs_push_properties()); |
| 3782 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3854 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3783 | 3855 |
| 3784 EndTest(); | 3856 EndTest(); |
| 3785 break; | 3857 break; |
| 3786 } | 3858 } |
| 3787 } | 3859 } |
| 3788 }; | 3860 }; |
| 3789 | 3861 |
| 3790 MULTI_THREAD_TEST_F( | 3862 MULTI_THREAD_TEST_F( |
| 3791 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3863 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 3821 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3893 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3822 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3894 EXPECT_TRUE(grandchild1_->needs_push_properties()); |
| 3823 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3895 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3824 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3896 EXPECT_TRUE(grandchild2_->needs_push_properties()); |
| 3825 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3897 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); |
| 3826 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3898 EXPECT_FALSE(grandchild3_->needs_push_properties()); |
| 3827 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3899 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); |
| 3828 | 3900 |
| 3829 grandchild1_->RemoveFromParent(); | 3901 grandchild1_->RemoveFromParent(); |
| 3830 | 3902 |
| 3831 EXPECT_FALSE(root_->needs_push_properties()); | 3903 EXPECT_TRUE(root_->needs_push_properties()); |
| 3832 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3904 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3833 EXPECT_TRUE(child_->needs_push_properties()); | 3905 EXPECT_TRUE(child_->needs_push_properties()); |
| 3834 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3906 EXPECT_TRUE(child_->descendant_needs_push_properties()); |
| 3835 | 3907 |
| 3836 grandchild2_->RemoveFromParent(); | 3908 grandchild2_->RemoveFromParent(); |
| 3837 | 3909 |
| 3838 EXPECT_FALSE(root_->needs_push_properties()); | 3910 EXPECT_TRUE(root_->needs_push_properties()); |
| 3839 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3911 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| 3840 EXPECT_TRUE(child_->needs_push_properties()); | 3912 EXPECT_TRUE(child_->needs_push_properties()); |
| 3841 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3913 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3842 | 3914 |
| 3843 child_->RemoveFromParent(); | 3915 child_->RemoveFromParent(); |
| 3844 | 3916 |
| 3845 EXPECT_FALSE(root_->needs_push_properties()); | 3917 EXPECT_TRUE(root_->needs_push_properties()); |
| 3846 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3918 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3847 | 3919 |
| 3848 EndTest(); | 3920 EndTest(); |
| 3849 break; | 3921 break; |
| 3850 } | 3922 } |
| 3851 } | 3923 } |
| 3852 }; | 3924 }; |
| 3853 | 3925 |
| 3854 MULTI_THREAD_TEST_F( | 3926 MULTI_THREAD_TEST_F( |
| 3855 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 3927 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4899 const gfx::Size bounds_; | 4971 const gfx::Size bounds_; |
| 4900 FakeContentLayerClient client_; | 4972 FakeContentLayerClient client_; |
| 4901 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4973 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 4902 scoped_refptr<FakePictureLayer> picture_layer_; | 4974 scoped_refptr<FakePictureLayer> picture_layer_; |
| 4903 Layer* child_layer_; | 4975 Layer* child_layer_; |
| 4904 }; | 4976 }; |
| 4905 | 4977 |
| 4906 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4978 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 4907 | 4979 |
| 4908 } // namespace cc | 4980 } // namespace cc |
| OLD | NEW |