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/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
9 #include "cc/layers/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 }; | 301 }; |
302 | 302 |
303 MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); | 303 MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); |
304 | 304 |
305 class LayerTreeHostContextTestLostContextSucceedsWithContent | 305 class LayerTreeHostContextTestLostContextSucceedsWithContent |
306 : public LayerTreeHostContextTestLostContextSucceeds { | 306 : public LayerTreeHostContextTestLostContextSucceeds { |
307 public: | 307 public: |
308 virtual void SetupTree() OVERRIDE { | 308 virtual void SetupTree() OVERRIDE { |
309 root_ = Layer::Create(); | 309 root_ = Layer::Create(); |
310 root_->SetBounds(gfx::Size(10, 10)); | 310 root_->SetBounds(gfx::Size(10, 10)); |
311 root_->SetAnchorPoint(gfx::PointF()); | 311 root_->SetTransformOrigin(gfx::Point3F()); |
312 root_->SetIsDrawable(true); | 312 root_->SetIsDrawable(true); |
313 | 313 |
314 content_ = FakeContentLayer::Create(&client_); | 314 content_ = FakeContentLayer::Create(&client_); |
315 content_->SetBounds(gfx::Size(10, 10)); | 315 content_->SetBounds(gfx::Size(10, 10)); |
316 content_->SetAnchorPoint(gfx::PointF()); | 316 content_->SetTransformOrigin(gfx::Point3F()); |
317 content_->SetIsDrawable(true); | 317 content_->SetIsDrawable(true); |
318 | 318 |
319 root_->AddChild(content_); | 319 root_->AddChild(content_); |
320 | 320 |
321 layer_tree_host()->SetRootLayer(root_); | 321 layer_tree_host()->SetRootLayer(root_); |
322 LayerTreeHostContextTest::SetupTree(); | 322 LayerTreeHostContextTest::SetupTree(); |
323 } | 323 } |
324 | 324 |
325 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { | 325 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { |
326 // Invalidate the render surface so we don't try to use a cached copy of the | 326 // Invalidate the render surface so we don't try to use a cached copy of the |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 RGBA_8888); | 722 RGBA_8888); |
723 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), | 723 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), |
724 resource); | 724 resource); |
725 | 725 |
726 gpu::Mailbox mailbox; | 726 gpu::Mailbox mailbox; |
727 gl->GenMailboxCHROMIUM(mailbox.name); | 727 gl->GenMailboxCHROMIUM(mailbox.name); |
728 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); | 728 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); |
729 | 729 |
730 scoped_refptr<Layer> root = Layer::Create(); | 730 scoped_refptr<Layer> root = Layer::Create(); |
731 root->SetBounds(gfx::Size(10, 10)); | 731 root->SetBounds(gfx::Size(10, 10)); |
732 root->SetAnchorPoint(gfx::PointF()); | 732 root->SetTransformOrigin(gfx::Point3F()); |
733 root->SetIsDrawable(true); | 733 root->SetIsDrawable(true); |
734 | 734 |
735 scoped_refptr<FakeDelegatedRendererLayer> delegated = | 735 scoped_refptr<FakeDelegatedRendererLayer> delegated = |
736 FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get()); | 736 FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get()); |
737 delegated->SetBounds(gfx::Size(10, 10)); | 737 delegated->SetBounds(gfx::Size(10, 10)); |
738 delegated->SetAnchorPoint(gfx::PointF()); | 738 delegated->SetTransformOrigin(gfx::Point3F()); |
739 delegated->SetIsDrawable(true); | 739 delegated->SetIsDrawable(true); |
740 root->AddChild(delegated); | 740 root->AddChild(delegated); |
741 | 741 |
742 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_); | 742 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_); |
743 content->SetBounds(gfx::Size(10, 10)); | 743 content->SetBounds(gfx::Size(10, 10)); |
744 content->SetAnchorPoint(gfx::PointF()); | 744 content->SetTransformOrigin(gfx::Point3F()); |
745 content->SetIsDrawable(true); | 745 content->SetIsDrawable(true); |
746 root->AddChild(content); | 746 root->AddChild(content); |
747 | 747 |
748 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); | 748 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); |
749 texture->SetBounds(gfx::Size(10, 10)); | 749 texture->SetBounds(gfx::Size(10, 10)); |
750 texture->SetAnchorPoint(gfx::PointF()); | 750 texture->SetTransformOrigin(gfx::Point3F()); |
751 texture->SetIsDrawable(true); | 751 texture->SetIsDrawable(true); |
752 texture->SetTextureMailbox( | 752 texture->SetTextureMailbox( |
753 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 753 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
754 SingleReleaseCallback::Create( | 754 SingleReleaseCallback::Create( |
755 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: | 755 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: |
756 EmptyReleaseCallback))); | 756 EmptyReleaseCallback))); |
757 root->AddChild(texture); | 757 root->AddChild(texture); |
758 | 758 |
759 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); | 759 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); |
760 mask->SetBounds(gfx::Size(10, 10)); | 760 mask->SetBounds(gfx::Size(10, 10)); |
761 mask->SetAnchorPoint(gfx::PointF()); | 761 mask->SetTransformOrigin(gfx::Point3F()); |
762 | 762 |
763 scoped_refptr<ContentLayer> content_with_mask = | 763 scoped_refptr<ContentLayer> content_with_mask = |
764 ContentLayer::Create(&client_); | 764 ContentLayer::Create(&client_); |
765 content_with_mask->SetBounds(gfx::Size(10, 10)); | 765 content_with_mask->SetBounds(gfx::Size(10, 10)); |
766 content_with_mask->SetAnchorPoint(gfx::PointF()); | 766 content_with_mask->SetTransformOrigin(gfx::Point3F()); |
767 content_with_mask->SetIsDrawable(true); | 767 content_with_mask->SetIsDrawable(true); |
768 content_with_mask->SetMaskLayer(mask.get()); | 768 content_with_mask->SetMaskLayer(mask.get()); |
769 root->AddChild(content_with_mask); | 769 root->AddChild(content_with_mask); |
770 | 770 |
771 scoped_refptr<VideoLayer> video_color = | 771 scoped_refptr<VideoLayer> video_color = |
772 VideoLayer::Create(&color_frame_provider_); | 772 VideoLayer::Create(&color_frame_provider_); |
773 video_color->SetBounds(gfx::Size(10, 10)); | 773 video_color->SetBounds(gfx::Size(10, 10)); |
774 video_color->SetAnchorPoint(gfx::PointF()); | 774 video_color->SetTransformOrigin(gfx::Point3F()); |
775 video_color->SetIsDrawable(true); | 775 video_color->SetIsDrawable(true); |
776 root->AddChild(video_color); | 776 root->AddChild(video_color); |
777 | 777 |
778 scoped_refptr<VideoLayer> video_hw = | 778 scoped_refptr<VideoLayer> video_hw = |
779 VideoLayer::Create(&hw_frame_provider_); | 779 VideoLayer::Create(&hw_frame_provider_); |
780 video_hw->SetBounds(gfx::Size(10, 10)); | 780 video_hw->SetBounds(gfx::Size(10, 10)); |
781 video_hw->SetAnchorPoint(gfx::PointF()); | 781 video_hw->SetTransformOrigin(gfx::Point3F()); |
782 video_hw->SetIsDrawable(true); | 782 video_hw->SetIsDrawable(true); |
783 root->AddChild(video_hw); | 783 root->AddChild(video_hw); |
784 | 784 |
785 scoped_refptr<VideoLayer> video_scaled_hw = | 785 scoped_refptr<VideoLayer> video_scaled_hw = |
786 VideoLayer::Create(&scaled_hw_frame_provider_); | 786 VideoLayer::Create(&scaled_hw_frame_provider_); |
787 video_scaled_hw->SetBounds(gfx::Size(10, 10)); | 787 video_scaled_hw->SetBounds(gfx::Size(10, 10)); |
788 video_scaled_hw->SetAnchorPoint(gfx::PointF()); | 788 video_scaled_hw->SetTransformOrigin(gfx::Point3F()); |
789 video_scaled_hw->SetIsDrawable(true); | 789 video_scaled_hw->SetIsDrawable(true); |
790 root->AddChild(video_scaled_hw); | 790 root->AddChild(video_scaled_hw); |
791 | 791 |
792 color_video_frame_ = VideoFrame::CreateColorFrame( | 792 color_video_frame_ = VideoFrame::CreateColorFrame( |
793 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 793 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
794 hw_video_frame_ = | 794 hw_video_frame_ = |
795 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( | 795 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( |
796 mailbox, GL_TEXTURE_2D, sync_point)), | 796 mailbox, GL_TEXTURE_2D, sync_point)), |
797 media::VideoFrame::ReleaseMailboxCB(), | 797 media::VideoFrame::ReleaseMailboxCB(), |
798 gfx::Size(4, 4), | 798 gfx::Size(4, 4), |
(...skipping 12 matching lines...) Expand all Loading... |
811 VideoFrame::ReadPixelsCB()); | 811 VideoFrame::ReadPixelsCB()); |
812 | 812 |
813 color_frame_provider_.set_frame(color_video_frame_); | 813 color_frame_provider_.set_frame(color_video_frame_); |
814 hw_frame_provider_.set_frame(hw_video_frame_); | 814 hw_frame_provider_.set_frame(hw_video_frame_); |
815 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); | 815 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); |
816 | 816 |
817 if (!delegating_renderer()) { | 817 if (!delegating_renderer()) { |
818 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 | 818 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 |
819 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); | 819 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); |
820 io_surface->SetBounds(gfx::Size(10, 10)); | 820 io_surface->SetBounds(gfx::Size(10, 10)); |
821 io_surface->SetAnchorPoint(gfx::PointF()); | 821 io_surface->SetTransformOrigin(gfx::Point3F()); |
822 io_surface->SetIsDrawable(true); | 822 io_surface->SetIsDrawable(true); |
823 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); | 823 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); |
824 root->AddChild(io_surface); | 824 root->AddChild(io_surface); |
825 } | 825 } |
826 | 826 |
827 // Enable the hud. | 827 // Enable the hud. |
828 LayerTreeDebugState debug_state; | 828 LayerTreeDebugState debug_state; |
829 debug_state.show_property_changed_rects = true; | 829 debug_state.show_property_changed_rects = true; |
830 layer_tree_host()->SetDebugState(debug_state); | 830 layer_tree_host()->SetDebugState(debug_state); |
831 | 831 |
832 scoped_refptr<PaintedScrollbarLayer> scrollbar = | 832 scoped_refptr<PaintedScrollbarLayer> scrollbar = |
833 PaintedScrollbarLayer::Create( | 833 PaintedScrollbarLayer::Create( |
834 scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), content->id()); | 834 scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), content->id()); |
835 scrollbar->SetBounds(gfx::Size(10, 10)); | 835 scrollbar->SetBounds(gfx::Size(10, 10)); |
836 scrollbar->SetAnchorPoint(gfx::PointF()); | 836 scrollbar->SetTransformOrigin(gfx::Point3F()); |
837 scrollbar->SetIsDrawable(true); | 837 scrollbar->SetIsDrawable(true); |
838 root->AddChild(scrollbar); | 838 root->AddChild(scrollbar); |
839 | 839 |
840 layer_tree_host()->SetRootLayer(root); | 840 layer_tree_host()->SetRootLayer(root); |
841 LayerTreeHostContextTest::SetupTree(); | 841 LayerTreeHostContextTest::SetupTree(); |
842 } | 842 } |
843 | 843 |
844 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 844 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
845 | 845 |
846 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 846 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 settings->impl_side_painting = true; | 922 settings->impl_side_painting = true; |
923 } | 923 } |
924 }; | 924 }; |
925 | 925 |
926 class LayerTreeHostContextTestImplSidePainting | 926 class LayerTreeHostContextTestImplSidePainting |
927 : public ImplSidePaintingLayerTreeHostContextTest { | 927 : public ImplSidePaintingLayerTreeHostContextTest { |
928 public: | 928 public: |
929 virtual void SetupTree() OVERRIDE { | 929 virtual void SetupTree() OVERRIDE { |
930 scoped_refptr<Layer> root = Layer::Create(); | 930 scoped_refptr<Layer> root = Layer::Create(); |
931 root->SetBounds(gfx::Size(10, 10)); | 931 root->SetBounds(gfx::Size(10, 10)); |
932 root->SetAnchorPoint(gfx::PointF()); | 932 root->SetTransformOrigin(gfx::Point3F()); |
933 root->SetIsDrawable(true); | 933 root->SetIsDrawable(true); |
934 | 934 |
935 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); | 935 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); |
936 picture->SetBounds(gfx::Size(10, 10)); | 936 picture->SetBounds(gfx::Size(10, 10)); |
937 picture->SetAnchorPoint(gfx::PointF()); | 937 picture->SetTransformOrigin(gfx::Point3F()); |
938 picture->SetIsDrawable(true); | 938 picture->SetIsDrawable(true); |
939 root->AddChild(picture); | 939 root->AddChild(picture); |
940 | 940 |
941 layer_tree_host()->SetRootLayer(root); | 941 layer_tree_host()->SetRootLayer(root); |
942 LayerTreeHostContextTest::SetupTree(); | 942 LayerTreeHostContextTest::SetupTree(); |
943 } | 943 } |
944 | 944 |
945 virtual void BeginTest() OVERRIDE { | 945 virtual void BeginTest() OVERRIDE { |
946 times_to_lose_during_commit_ = 1; | 946 times_to_lose_during_commit_ = 1; |
947 PostSetNeedsCommitToMainThread(); | 947 PostSetNeedsCommitToMainThread(); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 | 1483 |
1484 protected: | 1484 protected: |
1485 FakeContentLayerClient client_; | 1485 FakeContentLayerClient client_; |
1486 scoped_refptr<FakeContentLayer> layer_; | 1486 scoped_refptr<FakeContentLayer> layer_; |
1487 }; | 1487 }; |
1488 | 1488 |
1489 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 1489 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
1490 | 1490 |
1491 } // namespace | 1491 } // namespace |
1492 } // namespace cc | 1492 } // namespace cc |
OLD | NEW |