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 5598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5609 | 5609 |
5610 private: | 5610 private: |
5611 int activation_count_; | 5611 int activation_count_; |
5612 bool visible_; | 5612 bool visible_; |
5613 }; | 5613 }; |
5614 | 5614 |
5615 // TODO(vmpstr): Enable with single thread impl-side painting. | 5615 // TODO(vmpstr): Enable with single thread impl-side painting. |
5616 // This test blocks activation which is not supported for single thread mode. | 5616 // This test blocks activation which is not supported for single thread mode. |
5617 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); | 5617 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); |
5618 | 5618 |
| 5619 class LayerTreeHostTestRenderSurfaceEffectTreeIndex : public LayerTreeHostTest { |
| 5620 public: |
| 5621 LayerTreeHostTestRenderSurfaceEffectTreeIndex() = default; |
| 5622 |
| 5623 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5624 |
| 5625 void SetupTree() override { |
| 5626 root_ = Layer::Create(); |
| 5627 child_ = Layer::Create(); |
| 5628 grand_child_ = Layer::Create(); |
| 5629 |
| 5630 layer_tree()->SetRootLayer(root_); |
| 5631 root_->AddChild(child_); |
| 5632 child_->AddChild(grand_child_); |
| 5633 |
| 5634 root_->SetBounds(gfx::Size(50, 50)); |
| 5635 child_->SetBounds(gfx::Size(50, 50)); |
| 5636 grand_child_->SetBounds(gfx::Size(50, 50)); |
| 5637 child_->SetForceRenderSurfaceForTesting(true); |
| 5638 grand_child_->SetForceRenderSurfaceForTesting(true); |
| 5639 |
| 5640 LayerTreeHostTest::SetupTree(); |
| 5641 } |
| 5642 |
| 5643 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 5644 if (host_impl->sync_tree()->source_frame_number() >= 1) { |
| 5645 LayerImpl* grand_child_impl = |
| 5646 host_impl->sync_tree()->LayerById(grand_child_->id()); |
| 5647 EXPECT_EQ(grand_child_impl->effect_tree_index(), |
| 5648 grand_child_impl->render_surface()->EffectTreeIndex()); |
| 5649 } |
| 5650 } |
| 5651 |
| 5652 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 5653 LayerImpl* grand_child_impl = |
| 5654 host_impl->active_tree()->LayerById(grand_child_->id()); |
| 5655 switch (host_impl->active_tree()->source_frame_number()) { |
| 5656 case 0: |
| 5657 PostSetNeedsCommitToMainThread(); |
| 5658 break; |
| 5659 case 1: |
| 5660 case 2: |
| 5661 EXPECT_EQ(grand_child_impl->effect_tree_index(), |
| 5662 grand_child_impl->render_surface()->EffectTreeIndex()); |
| 5663 PostSetNeedsCommitToMainThread(); |
| 5664 break; |
| 5665 case 3: |
| 5666 EXPECT_EQ(grand_child_impl->effect_tree_index(), |
| 5667 grand_child_impl->render_surface()->EffectTreeIndex()); |
| 5668 EndTest(); |
| 5669 } |
| 5670 } |
| 5671 |
| 5672 void DidCommit() override { |
| 5673 switch (layer_tree_host()->SourceFrameNumber()) { |
| 5674 case 2: |
| 5675 // Setting an empty viewport causes draws to get skipped, so the active |
| 5676 // tree won't update draw properties. |
| 5677 layer_tree()->SetViewportSize(gfx::Size()); |
| 5678 child_->SetForceRenderSurfaceForTesting(false); |
| 5679 break; |
| 5680 case 3: |
| 5681 layer_tree()->SetViewportSize(root_->bounds()); |
| 5682 } |
| 5683 } |
| 5684 |
| 5685 void AfterTest() override {} |
| 5686 |
| 5687 private: |
| 5688 scoped_refptr<Layer> root_; |
| 5689 scoped_refptr<Layer> child_; |
| 5690 scoped_refptr<Layer> grand_child_; |
| 5691 }; |
| 5692 |
| 5693 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestRenderSurfaceEffectTreeIndex); |
| 5694 |
5619 // Do a synchronous composite and assert that the swap promise succeeds. | 5695 // Do a synchronous composite and assert that the swap promise succeeds. |
5620 class LayerTreeHostTestSynchronousCompositeSwapPromise | 5696 class LayerTreeHostTestSynchronousCompositeSwapPromise |
5621 : public LayerTreeHostTest { | 5697 : public LayerTreeHostTest { |
5622 public: | 5698 public: |
5623 LayerTreeHostTestSynchronousCompositeSwapPromise() = default; | 5699 LayerTreeHostTestSynchronousCompositeSwapPromise() = default; |
5624 | 5700 |
5625 void InitializeSettings(LayerTreeSettings* settings) override { | 5701 void InitializeSettings(LayerTreeSettings* settings) override { |
5626 settings->single_thread_proxy_scheduler = false; | 5702 settings->single_thread_proxy_scheduler = false; |
5627 settings->use_zero_copy = true; | 5703 settings->use_zero_copy = true; |
5628 } | 5704 } |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6998 EndTest(); | 7074 EndTest(); |
6999 } | 7075 } |
7000 | 7076 |
7001 void AfterTest() override {} | 7077 void AfterTest() override {} |
7002 }; | 7078 }; |
7003 | 7079 |
7004 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7080 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7005 | 7081 |
7006 } // namespace | 7082 } // namespace |
7007 } // namespace cc | 7083 } // namespace cc |
OLD | NEW |