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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 EXPECT_EQ(expected_push_properties_other_root_, | 3215 EXPECT_EQ(expected_push_properties_other_root_, |
3216 other_root_->push_properties_count()) | 3216 other_root_->push_properties_count()) |
3217 << "num_commits: " << num_commits_; | 3217 << "num_commits: " << num_commits_; |
3218 EXPECT_EQ(expected_push_properties_leaf_layer_, | 3218 EXPECT_EQ(expected_push_properties_leaf_layer_, |
3219 leaf_always_pushing_layer_->push_properties_count()) | 3219 leaf_always_pushing_layer_->push_properties_count()) |
3220 << "num_commits: " << num_commits_; | 3220 << "num_commits: " << num_commits_; |
3221 | 3221 |
3222 ++num_commits_; | 3222 ++num_commits_; |
3223 | 3223 |
3224 // The scrollbar layer always needs to be pushed. | 3224 // The scrollbar layer always needs to be pushed. |
3225 if (root_->layer_tree_host()) { | 3225 if (root_->GetLayerTree()) { |
3226 EXPECT_FALSE(root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3226 EXPECT_FALSE(root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3227 root_.get())); | 3227 root_.get())); |
3228 } | 3228 } |
3229 if (child2_->layer_tree_host()) { | 3229 if (child2_->GetLayerTree()) { |
3230 EXPECT_FALSE(child2_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3230 EXPECT_FALSE(child2_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3231 child2_.get())); | 3231 child2_.get())); |
3232 } | 3232 } |
3233 if (leaf_always_pushing_layer_->layer_tree_host()) { | 3233 if (leaf_always_pushing_layer_->GetLayerTree()) { |
3234 EXPECT_TRUE(leaf_always_pushing_layer_->GetLayerTree() | 3234 EXPECT_TRUE(leaf_always_pushing_layer_->GetLayerTree() |
3235 ->LayerNeedsPushPropertiesForTesting( | 3235 ->LayerNeedsPushPropertiesForTesting( |
3236 leaf_always_pushing_layer_.get())); | 3236 leaf_always_pushing_layer_.get())); |
3237 } | 3237 } |
3238 | 3238 |
3239 // child_ and grandchild_ don't persist their need to push properties. | 3239 // child_ and grandchild_ don't persist their need to push properties. |
3240 if (child_->layer_tree_host()) { | 3240 if (child_->GetLayerTree()) { |
3241 EXPECT_FALSE(child_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3241 EXPECT_FALSE(child_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3242 child_.get())); | 3242 child_.get())); |
3243 } | 3243 } |
3244 if (grandchild_->layer_tree_host()) { | 3244 if (grandchild_->GetLayerTree()) { |
3245 EXPECT_FALSE( | 3245 EXPECT_FALSE( |
3246 grandchild_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3246 grandchild_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3247 grandchild_.get())); | 3247 grandchild_.get())); |
3248 } | 3248 } |
3249 | 3249 |
3250 if (other_root_->layer_tree_host()) { | 3250 if (other_root_->GetLayerTree()) { |
3251 EXPECT_FALSE( | 3251 EXPECT_FALSE( |
3252 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( | 3252 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
3253 other_root_.get())); | 3253 other_root_.get())); |
3254 } | 3254 } |
3255 | 3255 |
3256 switch (num_commits_) { | 3256 switch (num_commits_) { |
3257 case 1: | 3257 case 1: |
3258 layer_tree()->SetRootLayer(root_); | 3258 layer_tree()->SetRootLayer(root_); |
3259 // Layers added to the tree get committed. | 3259 // Layers added to the tree get committed. |
3260 ++expected_push_properties_root_; | 3260 ++expected_push_properties_root_; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3339 child_->SetNeedsDisplay(); | 3339 child_->SetNeedsDisplay(); |
3340 ++expected_push_properties_child_; | 3340 ++expected_push_properties_child_; |
3341 layer_tree_host()->SetNeedsCommit(); | 3341 layer_tree_host()->SetNeedsCommit(); |
3342 break; | 3342 break; |
3343 case 17: | 3343 case 17: |
3344 EndTest(); | 3344 EndTest(); |
3345 break; | 3345 break; |
3346 } | 3346 } |
3347 | 3347 |
3348 // The leaf layer always pushes. | 3348 // The leaf layer always pushes. |
3349 if (leaf_always_pushing_layer_->layer_tree_host()) | 3349 if (leaf_always_pushing_layer_->GetLayerTree()) |
3350 ++expected_push_properties_leaf_layer_; | 3350 ++expected_push_properties_leaf_layer_; |
3351 } | 3351 } |
3352 | 3352 |
3353 void AfterTest() override {} | 3353 void AfterTest() override {} |
3354 | 3354 |
3355 int num_commits_; | 3355 int num_commits_; |
3356 FakeContentLayerClient client_; | 3356 FakeContentLayerClient client_; |
3357 scoped_refptr<PushPropertiesCountingLayer> root_; | 3357 scoped_refptr<PushPropertiesCountingLayer> root_; |
3358 scoped_refptr<PushPropertiesCountingLayer> child_; | 3358 scoped_refptr<PushPropertiesCountingLayer> child_; |
3359 scoped_refptr<PushPropertiesCountingLayer> child2_; | 3359 scoped_refptr<PushPropertiesCountingLayer> child2_; |
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7061 EndTest(); | 7061 EndTest(); |
7062 } | 7062 } |
7063 | 7063 |
7064 void AfterTest() override {} | 7064 void AfterTest() override {} |
7065 }; | 7065 }; |
7066 | 7066 |
7067 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7067 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7068 | 7068 |
7069 } // namespace | 7069 } // namespace |
7070 } // namespace cc | 7070 } // namespace cc |
OLD | NEW |