OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/layers/delegated_frame_provider.h" | 8 #include "cc/layers/delegated_frame_provider.h" |
9 #include "cc/layers/delegated_frame_resource_collection.h" | 9 #include "cc/layers/delegated_frame_resource_collection.h" |
10 #include "cc/layers/heads_up_display_layer.h" | 10 #include "cc/layers/heads_up_display_layer.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 void InvalidateAndSetNeedsCommit() override { | 641 void InvalidateAndSetNeedsCommit() override { |
642 // Invalidate the render surface so we don't try to use a cached copy of the | 642 // Invalidate the render surface so we don't try to use a cached copy of the |
643 // surface. We want to make sure to test the drawing paths for drawing to | 643 // surface. We want to make sure to test the drawing paths for drawing to |
644 // a child surface. | 644 // a child surface. |
645 layer_->SetNeedsDisplay(); | 645 layer_->SetNeedsDisplay(); |
646 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); | 646 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
647 } | 647 } |
648 | 648 |
649 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 649 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
650 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( | 650 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( |
651 host_impl->active_tree()->root_layer()->children()[0]); | 651 host_impl->active_tree()->root_layer()->children()[0].get()); |
652 EXPECT_TRUE(picture_impl->HighResTiling() | 652 EXPECT_TRUE(picture_impl->HighResTiling() |
653 ->TileAt(0, 0) | 653 ->TileAt(0, 0) |
654 ->draw_info() | 654 ->draw_info() |
655 .IsReadyToDraw()); | 655 .IsReadyToDraw()); |
656 } | 656 } |
657 | 657 |
658 protected: | 658 protected: |
659 FakeContentLayerClient client_; | 659 FakeContentLayerClient client_; |
660 scoped_refptr<Layer> root_; | 660 scoped_refptr<Layer> root_; |
661 scoped_refptr<Layer> layer_; | 661 scoped_refptr<Layer> layer_; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 850 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
851 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); | 851 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); |
852 | 852 |
853 FakePictureLayerImpl* root_picture = NULL; | 853 FakePictureLayerImpl* root_picture = NULL; |
854 FakePictureLayerImpl* child_picture = NULL; | 854 FakePictureLayerImpl* child_picture = NULL; |
855 FakePictureLayerImpl* grandchild_picture = NULL; | 855 FakePictureLayerImpl* grandchild_picture = NULL; |
856 | 856 |
857 root_picture = static_cast<FakePictureLayerImpl*>( | 857 root_picture = static_cast<FakePictureLayerImpl*>( |
858 host_impl->active_tree()->root_layer()); | 858 host_impl->active_tree()->root_layer()); |
859 child_picture = | 859 child_picture = |
860 static_cast<FakePictureLayerImpl*>(root_picture->children()[0]); | 860 static_cast<FakePictureLayerImpl*>(root_picture->children()[0].get()); |
861 grandchild_picture = | 861 grandchild_picture = |
862 static_cast<FakePictureLayerImpl*>(child_picture->children()[0]); | 862 static_cast<FakePictureLayerImpl*>(child_picture->children()[0].get()); |
863 | 863 |
864 ++num_commits_; | 864 ++num_commits_; |
865 switch (num_commits_) { | 865 switch (num_commits_) { |
866 case 1: | 866 case 1: |
867 EXPECT_EQ(0u, root_picture->release_resources_count()); | 867 EXPECT_EQ(0u, root_picture->release_resources_count()); |
868 EXPECT_EQ(0u, child_picture->release_resources_count()); | 868 EXPECT_EQ(0u, child_picture->release_resources_count()); |
869 EXPECT_EQ(0u, grandchild_picture->release_resources_count()); | 869 EXPECT_EQ(0u, grandchild_picture->release_resources_count()); |
870 | 870 |
871 // Lose the context and struggle to recreate it. | 871 // Lose the context and struggle to recreate it. |
872 LoseContext(); | 872 LoseContext(); |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 void AfterTest() override {} | 1622 void AfterTest() override {} |
1623 | 1623 |
1624 bool deferred_; | 1624 bool deferred_; |
1625 }; | 1625 }; |
1626 | 1626 |
1627 SINGLE_AND_MULTI_THREAD_TEST_F( | 1627 SINGLE_AND_MULTI_THREAD_TEST_F( |
1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1629 | 1629 |
1630 } // namespace | 1630 } // namespace |
1631 } // namespace cc | 1631 } // namespace cc |
OLD | NEW |