| 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 client_.add_draw_rect(gfx::Rect(5, 5), paint); | 629 client_.add_draw_rect(gfx::Rect(5, 5), paint); |
| 630 | 630 |
| 631 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 631 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 632 layer_->SetBounds(gfx::Size(10, 10)); | 632 layer_->SetBounds(gfx::Size(10, 10)); |
| 633 layer_->SetIsDrawable(true); | 633 layer_->SetIsDrawable(true); |
| 634 | 634 |
| 635 root_->AddChild(layer_); | 635 root_->AddChild(layer_); |
| 636 | 636 |
| 637 layer_tree_host()->SetRootLayer(root_); | 637 layer_tree_host()->SetRootLayer(root_); |
| 638 LayerTreeHostContextTest::SetupTree(); | 638 LayerTreeHostContextTest::SetupTree(); |
| 639 client_.set_bounds(root_->bounds()); |
| 639 } | 640 } |
| 640 | 641 |
| 641 void InvalidateAndSetNeedsCommit() override { | 642 void InvalidateAndSetNeedsCommit() override { |
| 642 // Invalidate the render surface so we don't try to use a cached copy of the | 643 // 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 | 644 // surface. We want to make sure to test the drawing paths for drawing to |
| 644 // a child surface. | 645 // a child surface. |
| 645 layer_->SetNeedsDisplay(); | 646 layer_->SetNeedsDisplay(); |
| 646 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); | 647 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| 647 } | 648 } |
| 648 | 649 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 703 |
| 703 void SetupTree() override { | 704 void SetupTree() override { |
| 704 // Paint non-solid color. | 705 // Paint non-solid color. |
| 705 SkPaint paint; | 706 SkPaint paint; |
| 706 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); | 707 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
| 707 client_.add_draw_rect(gfx::Rect(5, 5), paint); | 708 client_.add_draw_rect(gfx::Rect(5, 5), paint); |
| 708 | 709 |
| 709 scoped_refptr<FakePictureLayer> picture_layer = | 710 scoped_refptr<FakePictureLayer> picture_layer = |
| 710 FakePictureLayer::Create(layer_settings(), &client_); | 711 FakePictureLayer::Create(layer_settings(), &client_); |
| 711 picture_layer->SetBounds(gfx::Size(10, 20)); | 712 picture_layer->SetBounds(gfx::Size(10, 20)); |
| 713 client_.set_bounds(picture_layer->bounds()); |
| 712 layer_tree_host()->SetRootLayer(picture_layer); | 714 layer_tree_host()->SetRootLayer(picture_layer); |
| 713 | 715 |
| 714 LayerTreeHostContextTest::SetupTree(); | 716 LayerTreeHostContextTest::SetupTree(); |
| 715 } | 717 } |
| 716 | 718 |
| 717 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 719 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 718 | 720 |
| 719 void PostEvictTextures() { | 721 void PostEvictTextures() { |
| 720 if (HasImplThread()) { | 722 if (HasImplThread()) { |
| 721 ImplThreadTaskRunner()->PostTask( | 723 ImplThreadTaskRunner()->PostTask( |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 void SetupTree() override { | 838 void SetupTree() override { |
| 837 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 839 root_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 838 child_ = FakePictureLayer::Create(layer_settings(), &client_); | 840 child_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 839 grandchild_ = FakePictureLayer::Create(layer_settings(), &client_); | 841 grandchild_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 840 | 842 |
| 841 root_->AddChild(child_); | 843 root_->AddChild(child_); |
| 842 child_->AddChild(grandchild_); | 844 child_->AddChild(grandchild_); |
| 843 | 845 |
| 844 layer_tree_host()->SetRootLayer(root_); | 846 layer_tree_host()->SetRootLayer(root_); |
| 845 LayerTreeHostContextTest::SetupTree(); | 847 LayerTreeHostContextTest::SetupTree(); |
| 848 client_.set_bounds(root_->bounds()); |
| 846 } | 849 } |
| 847 | 850 |
| 848 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 851 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 849 | 852 |
| 850 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 853 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 851 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); | 854 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); |
| 852 | 855 |
| 853 FakePictureLayerImpl* root_picture = NULL; | 856 FakePictureLayerImpl* root_picture = NULL; |
| 854 FakePictureLayerImpl* child_picture = NULL; | 857 FakePictureLayerImpl* child_picture = NULL; |
| 855 FakePictureLayerImpl* grandchild_picture = NULL; | 858 FakePictureLayerImpl* grandchild_picture = NULL; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 texture->SetTextureMailbox( | 979 texture->SetTextureMailbox( |
| 977 TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), | 980 TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D), |
| 978 SingleReleaseCallback::Create( | 981 SingleReleaseCallback::Create( |
| 979 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: | 982 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: |
| 980 EmptyReleaseCallback))); | 983 EmptyReleaseCallback))); |
| 981 root->AddChild(texture); | 984 root->AddChild(texture); |
| 982 | 985 |
| 983 scoped_refptr<PictureLayer> mask = | 986 scoped_refptr<PictureLayer> mask = |
| 984 PictureLayer::Create(layer_settings_, &client_); | 987 PictureLayer::Create(layer_settings_, &client_); |
| 985 mask->SetBounds(gfx::Size(10, 10)); | 988 mask->SetBounds(gfx::Size(10, 10)); |
| 989 client_.set_bounds(mask->bounds()); |
| 986 | 990 |
| 987 scoped_refptr<PictureLayer> layer_with_mask = | 991 scoped_refptr<PictureLayer> layer_with_mask = |
| 988 PictureLayer::Create(layer_settings_, &client_); | 992 PictureLayer::Create(layer_settings_, &client_); |
| 989 layer_with_mask->SetBounds(gfx::Size(10, 10)); | 993 layer_with_mask->SetBounds(gfx::Size(10, 10)); |
| 990 layer_with_mask->SetIsDrawable(true); | 994 layer_with_mask->SetIsDrawable(true); |
| 991 layer_with_mask->SetMaskLayer(mask.get()); | 995 layer_with_mask->SetMaskLayer(mask.get()); |
| 992 root->AddChild(layer_with_mask); | 996 root->AddChild(layer_with_mask); |
| 993 | 997 |
| 994 scoped_refptr<VideoLayer> video_color = VideoLayer::Create( | 998 scoped_refptr<VideoLayer> video_color = VideoLayer::Create( |
| 995 layer_settings_, &color_frame_provider_, media::VIDEO_ROTATION_0); | 999 layer_settings_, &color_frame_provider_, media::VIDEO_ROTATION_0); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 : public LayerTreeHostContextTest { | 1132 : public LayerTreeHostContextTest { |
| 1129 public: | 1133 public: |
| 1130 void SetupTree() override { | 1134 void SetupTree() override { |
| 1131 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 1135 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 1132 root->SetBounds(gfx::Size(10, 10)); | 1136 root->SetBounds(gfx::Size(10, 10)); |
| 1133 root->SetIsDrawable(true); | 1137 root->SetIsDrawable(true); |
| 1134 | 1138 |
| 1135 scoped_refptr<PictureLayer> picture = | 1139 scoped_refptr<PictureLayer> picture = |
| 1136 PictureLayer::Create(layer_settings(), &client_); | 1140 PictureLayer::Create(layer_settings(), &client_); |
| 1137 picture->SetBounds(gfx::Size(10, 10)); | 1141 picture->SetBounds(gfx::Size(10, 10)); |
| 1142 client_.set_bounds(picture->bounds()); |
| 1138 picture->SetIsDrawable(true); | 1143 picture->SetIsDrawable(true); |
| 1139 root->AddChild(picture); | 1144 root->AddChild(picture); |
| 1140 | 1145 |
| 1141 layer_tree_host()->SetRootLayer(root); | 1146 layer_tree_host()->SetRootLayer(root); |
| 1142 LayerTreeHostContextTest::SetupTree(); | 1147 LayerTreeHostContextTest::SetupTree(); |
| 1143 } | 1148 } |
| 1144 | 1149 |
| 1145 void BeginTest() override { | 1150 void BeginTest() override { |
| 1146 times_to_lose_during_commit_ = 1; | 1151 times_to_lose_during_commit_ = 1; |
| 1147 PostSetNeedsCommitToMainThread(); | 1152 PostSetNeedsCommitToMainThread(); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 void AfterTest() override {} | 1627 void AfterTest() override {} |
| 1623 | 1628 |
| 1624 bool deferred_; | 1629 bool deferred_; |
| 1625 }; | 1630 }; |
| 1626 | 1631 |
| 1627 SINGLE_AND_MULTI_THREAD_TEST_F( | 1632 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1633 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1629 | 1634 |
| 1630 } // namespace | 1635 } // namespace |
| 1631 } // namespace cc | 1636 } // namespace cc |
| OLD | NEW |