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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 layer->SetIsDrawable(true); | 681 layer->SetIsDrawable(true); |
682 break; | 682 break; |
683 } | 683 } |
684 } | 684 } |
685 | 685 |
686 int index_; | 686 int index_; |
687 }; | 687 }; |
688 | 688 |
689 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 689 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
690 | 690 |
| 691 class LayerTreeHostTestDamageWithReplica : public LayerTreeHostTest { |
| 692 protected: |
| 693 void SetupTree() override { |
| 694 scoped_refptr<Layer> root = Layer::Create(); |
| 695 layer_tree_host()->SetRootLayer(root); |
| 696 LayerTreeHostTest::SetupTree(); |
| 697 } |
| 698 |
| 699 void BeginTest() override { |
| 700 index_ = 0; |
| 701 PostSetNeedsCommitToMainThread(); |
| 702 } |
| 703 |
| 704 void DidCommit() override { |
| 705 switch (layer_tree_host()->source_frame_number()) { |
| 706 case 0: |
| 707 break; |
| 708 case 1: |
| 709 scoped_refptr<Layer> replica_layer = Layer::Create(); |
| 710 layer_tree_host()->root_layer()->SetReplicaLayer(replica_layer.get()); |
| 711 break; |
| 712 } |
| 713 } |
| 714 |
| 715 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 716 switch (index_) { |
| 717 case 0: |
| 718 impl->sync_tree()->ResetAllChangeTracking( |
| 719 PropertyTrees::ResetFlags::ALL_TREES); |
| 720 EXPECT_FALSE(impl->sync_tree()->root_layer()->LayerPropertyChanged()); |
| 721 PostSetNeedsCommitToMainThread(); |
| 722 index_++; |
| 723 break; |
| 724 case 1: |
| 725 EXPECT_TRUE(impl->sync_tree()->root_layer()->LayerPropertyChanged()); |
| 726 EndTest(); |
| 727 break; |
| 728 } |
| 729 } |
| 730 |
| 731 void AfterTest() override {} |
| 732 |
| 733 int index_; |
| 734 }; |
| 735 |
| 736 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithReplica); |
| 737 |
691 // Verify damage status of property trees is preserved after commit. | 738 // Verify damage status of property trees is preserved after commit. |
692 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 739 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
693 protected: | 740 protected: |
694 void SetupTree() override { | 741 void SetupTree() override { |
695 scoped_refptr<Layer> root = Layer::Create(); | 742 scoped_refptr<Layer> root = Layer::Create(); |
696 scoped_refptr<Layer> child = Layer::Create(); | 743 scoped_refptr<Layer> child = Layer::Create(); |
697 // This is to force the child to create a transform and effect node. | 744 // This is to force the child to create a transform and effect node. |
698 child->SetForceRenderSurface(true); | 745 child->SetForceRenderSurfaceForTesting(true); |
699 root->AddChild(std::move(child)); | 746 root->AddChild(std::move(child)); |
700 layer_tree_host()->SetRootLayer(root); | 747 layer_tree_host()->SetRootLayer(root); |
701 LayerTreeHostTest::SetupTree(); | 748 LayerTreeHostTest::SetupTree(); |
702 } | 749 } |
703 | 750 |
704 enum Animations { | 751 enum Animations { |
705 OPACITY, | 752 OPACITY, |
706 TRANSFORM, | 753 TRANSFORM, |
707 FILTER, | 754 FILTER, |
708 END, | 755 END, |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 case 1: | 1398 case 1: |
1352 // Test not owning the surface. | 1399 // Test not owning the surface. |
1353 parent_layer_->SetOpacity(1.0f); | 1400 parent_layer_->SetOpacity(1.0f); |
1354 break; | 1401 break; |
1355 case 2: | 1402 case 2: |
1356 parent_layer_->SetOpacity(0.0f); | 1403 parent_layer_->SetOpacity(0.0f); |
1357 break; | 1404 break; |
1358 case 3: | 1405 case 3: |
1359 // Test owning the surface. | 1406 // Test owning the surface. |
1360 parent_layer_->SetOpacity(0.5f); | 1407 parent_layer_->SetOpacity(0.5f); |
1361 parent_layer_->SetForceRenderSurface(true); | 1408 parent_layer_->SetForceRenderSurfaceForTesting(true); |
1362 break; | 1409 break; |
1363 case 4: | 1410 case 4: |
1364 EndTest(); | 1411 EndTest(); |
1365 break; | 1412 break; |
1366 default: | 1413 default: |
1367 NOTREACHED(); | 1414 NOTREACHED(); |
1368 } | 1415 } |
1369 } | 1416 } |
1370 | 1417 |
1371 void AfterTest() override {} | 1418 void AfterTest() override {} |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 } | 2384 } |
2338 | 2385 |
2339 void SetupTree() override { | 2386 void SetupTree() override { |
2340 root_layer_ = FakePictureLayer::Create(&client_); | 2387 root_layer_ = FakePictureLayer::Create(&client_); |
2341 root_layer_->SetIsDrawable(true); | 2388 root_layer_->SetIsDrawable(true); |
2342 root_layer_->SetBounds(gfx::Size(50, 50)); | 2389 root_layer_->SetBounds(gfx::Size(50, 50)); |
2343 | 2390 |
2344 parent_layer_ = FakePictureLayer::Create(&client_); | 2391 parent_layer_ = FakePictureLayer::Create(&client_); |
2345 parent_layer_->SetIsDrawable(true); | 2392 parent_layer_->SetIsDrawable(true); |
2346 parent_layer_->SetBounds(gfx::Size(50, 50)); | 2393 parent_layer_->SetBounds(gfx::Size(50, 50)); |
2347 parent_layer_->SetForceRenderSurface(true); | 2394 parent_layer_->SetForceRenderSurfaceForTesting(true); |
2348 | 2395 |
2349 child_layer_ = FakePictureLayer::Create(&client_); | 2396 child_layer_ = FakePictureLayer::Create(&client_); |
2350 child_layer_->SetIsDrawable(true); | 2397 child_layer_->SetIsDrawable(true); |
2351 child_layer_->SetBounds(gfx::Size(50, 50)); | 2398 child_layer_->SetBounds(gfx::Size(50, 50)); |
2352 | 2399 |
2353 root_layer_->AddChild(parent_layer_); | 2400 root_layer_->AddChild(parent_layer_); |
2354 parent_layer_->AddChild(child_layer_); | 2401 parent_layer_->AddChild(child_layer_); |
2355 layer_tree_host()->SetRootLayer(root_layer_); | 2402 layer_tree_host()->SetRootLayer(root_layer_); |
2356 | 2403 |
2357 LayerTreeHostTest::SetupTree(); | 2404 LayerTreeHostTest::SetupTree(); |
(...skipping 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6298 EndTest(); | 6345 EndTest(); |
6299 } | 6346 } |
6300 | 6347 |
6301 void AfterTest() override {} | 6348 void AfterTest() override {} |
6302 }; | 6349 }; |
6303 | 6350 |
6304 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6351 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
6305 | 6352 |
6306 } // namespace | 6353 } // namespace |
6307 } // namespace cc | 6354 } // namespace cc |
OLD | NEW |