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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 bool in_composite_; | 533 bool in_composite_; |
534 }; | 534 }; |
535 | 535 |
536 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostContextTestAvoidUnnecessaryComposite); | 536 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostContextTestAvoidUnnecessaryComposite); |
537 | 537 |
538 class LayerTreeHostContextTestLostContextSucceedsWithContent | 538 class LayerTreeHostContextTestLostContextSucceedsWithContent |
539 : public LayerTreeHostContextTestLostContextSucceeds { | 539 : public LayerTreeHostContextTestLostContextSucceeds { |
540 public: | 540 public: |
541 void SetupTree() override { | 541 void SetupTree() override { |
542 root_ = Layer::Create(); | 542 root_ = Layer::Create(layer_settings()); |
543 root_->SetBounds(gfx::Size(10, 10)); | 543 root_->SetBounds(gfx::Size(10, 10)); |
544 root_->SetIsDrawable(true); | 544 root_->SetIsDrawable(true); |
545 | 545 |
546 // Paint non-solid color. | 546 // Paint non-solid color. |
547 SkPaint paint; | 547 SkPaint paint; |
548 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); | 548 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
549 client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); | 549 client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); |
550 | 550 |
551 if (layer_tree_host()->settings().impl_side_painting) | 551 if (layer_tree_host()->settings().impl_side_painting) |
552 layer_ = FakePictureLayer::Create(&client_); | 552 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
553 else | 553 else |
554 layer_ = FakeContentLayer::Create(&client_); | 554 layer_ = FakeContentLayer::Create(layer_settings(), &client_); |
555 layer_->SetBounds(gfx::Size(10, 10)); | 555 layer_->SetBounds(gfx::Size(10, 10)); |
556 layer_->SetIsDrawable(true); | 556 layer_->SetIsDrawable(true); |
557 | 557 |
558 root_->AddChild(layer_); | 558 root_->AddChild(layer_); |
559 | 559 |
560 layer_tree_host()->SetRootLayer(root_); | 560 layer_tree_host()->SetRootLayer(root_); |
561 LayerTreeHostContextTest::SetupTree(); | 561 LayerTreeHostContextTest::SetupTree(); |
562 } | 562 } |
563 | 563 |
564 void InvalidateAndSetNeedsCommit() override { | 564 void InvalidateAndSetNeedsCommit() override { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 num_commits_(0), | 633 num_commits_(0), |
634 lost_context_(false) {} | 634 lost_context_(false) {} |
635 | 635 |
636 void SetupTree() override { | 636 void SetupTree() override { |
637 // Paint non-solid color. | 637 // Paint non-solid color. |
638 SkPaint paint; | 638 SkPaint paint; |
639 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); | 639 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
640 client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); | 640 client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); |
641 | 641 |
642 if (layer_tree_host()->settings().impl_side_painting) { | 642 if (layer_tree_host()->settings().impl_side_painting) { |
643 picture_layer_ = FakePictureLayer::Create(&client_); | 643 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
644 picture_layer_->SetBounds(gfx::Size(10, 20)); | 644 picture_layer_->SetBounds(gfx::Size(10, 20)); |
645 layer_tree_host()->SetRootLayer(picture_layer_); | 645 layer_tree_host()->SetRootLayer(picture_layer_); |
646 } else { | 646 } else { |
647 content_layer_ = FakeContentLayer::Create(&client_); | 647 content_layer_ = FakeContentLayer::Create(layer_settings(), &client_); |
648 content_layer_->SetBounds(gfx::Size(10, 20)); | 648 content_layer_->SetBounds(gfx::Size(10, 20)); |
649 layer_tree_host()->SetRootLayer(content_layer_); | 649 layer_tree_host()->SetRootLayer(content_layer_); |
650 } | 650 } |
651 | 651 |
652 LayerTreeHostContextTest::SetupTree(); | 652 LayerTreeHostContextTest::SetupTree(); |
653 } | 653 } |
654 | 654 |
655 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 655 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
656 | 656 |
657 void PostEvictTextures() { | 657 void PostEvictTextures() { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 LayerTreeHostContextTest::CreateContext3d(); | 807 LayerTreeHostContextTest::CreateContext3d(); |
808 if (times_to_lose_on_end_query_) { | 808 if (times_to_lose_on_end_query_) { |
809 --times_to_lose_on_end_query_; | 809 --times_to_lose_on_end_query_; |
810 context->set_times_end_query_succeeds(5); | 810 context->set_times_end_query_succeeds(5); |
811 } | 811 } |
812 return context.Pass(); | 812 return context.Pass(); |
813 } | 813 } |
814 | 814 |
815 void SetupTree() override { | 815 void SetupTree() override { |
816 if (layer_tree_host()->settings().impl_side_painting) | 816 if (layer_tree_host()->settings().impl_side_painting) |
817 parent_ = FakePictureLayer::Create(&client_); | 817 parent_ = FakePictureLayer::Create(layer_settings(), &client_); |
818 else | 818 else |
819 parent_ = FakeContentLayer::Create(&client_); | 819 parent_ = FakeContentLayer::Create(layer_settings(), &client_); |
820 | 820 |
821 parent_->SetBounds(gfx::Size(num_children_, 1)); | 821 parent_->SetBounds(gfx::Size(num_children_, 1)); |
822 | 822 |
823 for (int i = 0; i < num_children_; i++) { | 823 for (int i = 0; i < num_children_; i++) { |
824 scoped_refptr<Layer> child; | 824 scoped_refptr<Layer> child; |
825 if (layer_tree_host()->settings().impl_side_painting) | 825 if (layer_tree_host()->settings().impl_side_painting) |
826 child = FakePictureLayer::Create(&client_); | 826 child = FakePictureLayer::Create(layer_settings(), &client_); |
827 else | 827 else |
828 child = FakeContentLayer::Create(&client_); | 828 child = FakeContentLayer::Create(layer_settings(), &client_); |
829 child->SetPosition(gfx::PointF(i, 0.f)); | 829 child->SetPosition(gfx::PointF(i, 0.f)); |
830 child->SetBounds(gfx::Size(1, 1)); | 830 child->SetBounds(gfx::Size(1, 1)); |
831 parent_->AddChild(child); | 831 parent_->AddChild(child); |
832 } | 832 } |
833 | 833 |
834 layer_tree_host()->SetRootLayer(parent_); | 834 layer_tree_host()->SetRootLayer(parent_); |
835 LayerTreeHostContextTest::SetupTree(); | 835 LayerTreeHostContextTest::SetupTree(); |
836 } | 836 } |
837 | 837 |
838 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 838 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
(...skipping 15 matching lines...) Expand all Loading... |
854 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( | 854 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( |
855 LayerTreeHostContextTestLostContextWhileUpdatingResources); | 855 LayerTreeHostContextTestLostContextWhileUpdatingResources); |
856 | 856 |
857 class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest { | 857 class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest { |
858 public: | 858 public: |
859 LayerTreeHostContextTestLayersNotified() | 859 LayerTreeHostContextTestLayersNotified() |
860 : LayerTreeHostContextTest(), num_commits_(0) {} | 860 : LayerTreeHostContextTest(), num_commits_(0) {} |
861 | 861 |
862 void SetupTree() override { | 862 void SetupTree() override { |
863 if (layer_tree_host()->settings().impl_side_painting) { | 863 if (layer_tree_host()->settings().impl_side_painting) { |
864 root_ = FakePictureLayer::Create(&client_); | 864 root_ = FakePictureLayer::Create(layer_settings(), &client_); |
865 child_ = FakePictureLayer::Create(&client_); | 865 child_ = FakePictureLayer::Create(layer_settings(), &client_); |
866 grandchild_ = FakePictureLayer::Create(&client_); | 866 grandchild_ = FakePictureLayer::Create(layer_settings(), &client_); |
867 } else { | 867 } else { |
868 root_ = FakeContentLayer::Create(&client_); | 868 root_ = FakeContentLayer::Create(layer_settings(), &client_); |
869 child_ = FakeContentLayer::Create(&client_); | 869 child_ = FakeContentLayer::Create(layer_settings(), &client_); |
870 grandchild_ = FakeContentLayer::Create(&client_); | 870 grandchild_ = FakeContentLayer::Create(layer_settings(), &client_); |
871 } | 871 } |
872 | 872 |
873 root_->AddChild(child_); | 873 root_->AddChild(child_); |
874 child_->AddChild(grandchild_); | 874 child_->AddChild(grandchild_); |
875 | 875 |
876 layer_tree_host()->SetRootLayer(root_); | 876 layer_tree_host()->SetRootLayer(root_); |
877 LayerTreeHostContextTest::SetupTree(); | 877 LayerTreeHostContextTest::SetupTree(); |
878 } | 878 } |
879 | 879 |
880 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 880 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 child_resource_provider_->CreateResource( | 1008 child_resource_provider_->CreateResource( |
1009 gfx::Size(4, 4), GL_CLAMP_TO_EDGE, | 1009 gfx::Size(4, 4), GL_CLAMP_TO_EDGE, |
1010 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); | 1010 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); |
1011 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), | 1011 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), |
1012 resource); | 1012 resource); |
1013 | 1013 |
1014 gpu::Mailbox mailbox; | 1014 gpu::Mailbox mailbox; |
1015 gl->GenMailboxCHROMIUM(mailbox.name); | 1015 gl->GenMailboxCHROMIUM(mailbox.name); |
1016 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); | 1016 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); |
1017 | 1017 |
1018 scoped_refptr<Layer> root = Layer::Create(); | 1018 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
1019 root->SetBounds(gfx::Size(10, 10)); | 1019 root->SetBounds(gfx::Size(10, 10)); |
1020 root->SetIsDrawable(true); | 1020 root->SetIsDrawable(true); |
1021 | 1021 |
1022 scoped_refptr<FakeDelegatedRendererLayer> delegated = | 1022 scoped_refptr<FakeDelegatedRendererLayer> delegated = |
1023 FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get()); | 1023 FakeDelegatedRendererLayer::Create(layer_settings(), |
| 1024 delegated_frame_provider_.get()); |
1024 delegated->SetBounds(gfx::Size(10, 10)); | 1025 delegated->SetBounds(gfx::Size(10, 10)); |
1025 delegated->SetIsDrawable(true); | 1026 delegated->SetIsDrawable(true); |
1026 root->AddChild(delegated); | 1027 root->AddChild(delegated); |
1027 | 1028 |
1028 scoped_refptr<Layer> layer; | 1029 scoped_refptr<Layer> layer; |
1029 if (layer_tree_host()->settings().impl_side_painting) | 1030 if (layer_tree_host()->settings().impl_side_painting) |
1030 layer = PictureLayer::Create(&client_); | 1031 layer = PictureLayer::Create(layer_settings(), &client_); |
1031 else | 1032 else |
1032 layer = ContentLayer::Create(&client_); | 1033 layer = ContentLayer::Create(layer_settings(), &client_); |
1033 layer->SetBounds(gfx::Size(10, 10)); | 1034 layer->SetBounds(gfx::Size(10, 10)); |
1034 layer->SetIsDrawable(true); | 1035 layer->SetIsDrawable(true); |
1035 root->AddChild(layer); | 1036 root->AddChild(layer); |
1036 | 1037 |
1037 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); | 1038 scoped_refptr<TextureLayer> texture = |
| 1039 TextureLayer::CreateForMailbox(layer_settings_, NULL); |
1038 texture->SetBounds(gfx::Size(10, 10)); | 1040 texture->SetBounds(gfx::Size(10, 10)); |
1039 texture->SetIsDrawable(true); | 1041 texture->SetIsDrawable(true); |
1040 texture->SetTextureMailbox( | 1042 texture->SetTextureMailbox( |
1041 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 1043 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
1042 SingleReleaseCallback::Create( | 1044 SingleReleaseCallback::Create( |
1043 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: | 1045 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: |
1044 EmptyReleaseCallback))); | 1046 EmptyReleaseCallback))); |
1045 root->AddChild(texture); | 1047 root->AddChild(texture); |
1046 | 1048 |
1047 scoped_refptr<Layer> mask; | 1049 scoped_refptr<Layer> mask; |
1048 if (layer_tree_host()->settings().impl_side_painting) | 1050 if (layer_tree_host()->settings().impl_side_painting) |
1049 mask = PictureLayer::Create(&client_); | 1051 mask = PictureLayer::Create(layer_settings_, &client_); |
1050 else | 1052 else |
1051 mask = ContentLayer::Create(&client_); | 1053 mask = ContentLayer::Create(layer_settings_, &client_); |
1052 mask->SetBounds(gfx::Size(10, 10)); | 1054 mask->SetBounds(gfx::Size(10, 10)); |
1053 | 1055 |
1054 scoped_refptr<Layer> layer_with_mask; | 1056 scoped_refptr<Layer> layer_with_mask; |
1055 if (layer_tree_host()->settings().impl_side_painting) | 1057 if (layer_tree_host()->settings().impl_side_painting) |
1056 layer_with_mask = PictureLayer::Create(&client_); | 1058 layer_with_mask = PictureLayer::Create(layer_settings_, &client_); |
1057 else | 1059 else |
1058 layer_with_mask = ContentLayer::Create(&client_); | 1060 layer_with_mask = ContentLayer::Create(layer_settings_, &client_); |
1059 layer_with_mask->SetBounds(gfx::Size(10, 10)); | 1061 layer_with_mask->SetBounds(gfx::Size(10, 10)); |
1060 layer_with_mask->SetIsDrawable(true); | 1062 layer_with_mask->SetIsDrawable(true); |
1061 layer_with_mask->SetMaskLayer(mask.get()); | 1063 layer_with_mask->SetMaskLayer(mask.get()); |
1062 root->AddChild(layer_with_mask); | 1064 root->AddChild(layer_with_mask); |
1063 | 1065 |
1064 scoped_refptr<VideoLayer> video_color = | 1066 scoped_refptr<VideoLayer> video_color = VideoLayer::Create( |
1065 VideoLayer::Create(&color_frame_provider_, media::VIDEO_ROTATION_0); | 1067 layer_settings_, &color_frame_provider_, media::VIDEO_ROTATION_0); |
1066 video_color->SetBounds(gfx::Size(10, 10)); | 1068 video_color->SetBounds(gfx::Size(10, 10)); |
1067 video_color->SetIsDrawable(true); | 1069 video_color->SetIsDrawable(true); |
1068 root->AddChild(video_color); | 1070 root->AddChild(video_color); |
1069 | 1071 |
1070 scoped_refptr<VideoLayer> video_hw = | 1072 scoped_refptr<VideoLayer> video_hw = VideoLayer::Create( |
1071 VideoLayer::Create(&hw_frame_provider_, media::VIDEO_ROTATION_0); | 1073 layer_settings_, &hw_frame_provider_, media::VIDEO_ROTATION_0); |
1072 video_hw->SetBounds(gfx::Size(10, 10)); | 1074 video_hw->SetBounds(gfx::Size(10, 10)); |
1073 video_hw->SetIsDrawable(true); | 1075 video_hw->SetIsDrawable(true); |
1074 root->AddChild(video_hw); | 1076 root->AddChild(video_hw); |
1075 | 1077 |
1076 scoped_refptr<VideoLayer> video_scaled_hw = | 1078 scoped_refptr<VideoLayer> video_scaled_hw = VideoLayer::Create( |
1077 VideoLayer::Create(&scaled_hw_frame_provider_, media::VIDEO_ROTATION_0); | 1079 layer_settings_, &scaled_hw_frame_provider_, media::VIDEO_ROTATION_0); |
1078 video_scaled_hw->SetBounds(gfx::Size(10, 10)); | 1080 video_scaled_hw->SetBounds(gfx::Size(10, 10)); |
1079 video_scaled_hw->SetIsDrawable(true); | 1081 video_scaled_hw->SetIsDrawable(true); |
1080 root->AddChild(video_scaled_hw); | 1082 root->AddChild(video_scaled_hw); |
1081 | 1083 |
1082 color_video_frame_ = VideoFrame::CreateColorFrame( | 1084 color_video_frame_ = VideoFrame::CreateColorFrame( |
1083 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 1085 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
1084 hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1086 hw_video_frame_ = VideoFrame::WrapNativeTexture( |
1085 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), | 1087 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), |
1086 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), | 1088 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), |
1087 gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta(), | 1089 gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta(), |
1088 false /* allow_overlay */, true /* has_alpha */); | 1090 false /* allow_overlay */, true /* has_alpha */); |
1089 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1091 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( |
1090 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), | 1092 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), |
1091 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), | 1093 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), |
1092 gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta(), | 1094 gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta(), |
1093 false /* allow_overlay */, true /* has_alpha */); | 1095 false /* allow_overlay */, true /* has_alpha */); |
1094 | 1096 |
1095 color_frame_provider_.set_frame(color_video_frame_); | 1097 color_frame_provider_.set_frame(color_video_frame_); |
1096 hw_frame_provider_.set_frame(hw_video_frame_); | 1098 hw_frame_provider_.set_frame(hw_video_frame_); |
1097 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); | 1099 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); |
1098 | 1100 |
1099 if (!delegating_renderer()) { | 1101 if (!delegating_renderer()) { |
1100 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 | 1102 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 |
1101 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); | 1103 scoped_refptr<IOSurfaceLayer> io_surface = |
| 1104 IOSurfaceLayer::Create(layer_settings_); |
1102 io_surface->SetBounds(gfx::Size(10, 10)); | 1105 io_surface->SetBounds(gfx::Size(10, 10)); |
1103 io_surface->SetIsDrawable(true); | 1106 io_surface->SetIsDrawable(true); |
1104 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); | 1107 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); |
1105 root->AddChild(io_surface); | 1108 root->AddChild(io_surface); |
1106 } | 1109 } |
1107 | 1110 |
1108 // Enable the hud. | 1111 // Enable the hud. |
1109 LayerTreeDebugState debug_state; | 1112 LayerTreeDebugState debug_state; |
1110 debug_state.show_property_changed_rects = true; | 1113 debug_state.show_property_changed_rects = true; |
1111 layer_tree_host()->SetDebugState(debug_state); | 1114 layer_tree_host()->SetDebugState(debug_state); |
1112 | 1115 |
1113 scoped_refptr<PaintedScrollbarLayer> scrollbar = | 1116 scoped_refptr<PaintedScrollbarLayer> scrollbar = |
1114 PaintedScrollbarLayer::Create( | 1117 PaintedScrollbarLayer::Create( |
1115 scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), layer->id()); | 1118 layer_settings_, scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), |
| 1119 layer->id()); |
1116 scrollbar->SetBounds(gfx::Size(10, 10)); | 1120 scrollbar->SetBounds(gfx::Size(10, 10)); |
1117 scrollbar->SetIsDrawable(true); | 1121 scrollbar->SetIsDrawable(true); |
1118 root->AddChild(scrollbar); | 1122 root->AddChild(scrollbar); |
1119 | 1123 |
1120 layer_tree_host()->SetRootLayer(root); | 1124 layer_tree_host()->SetRootLayer(root); |
1121 LayerTreeHostContextTest::SetupTree(); | 1125 LayerTreeHostContextTest::SetupTree(); |
1122 } | 1126 } |
1123 | 1127 |
1124 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1128 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1125 | 1129 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 delegated_resource_collection_; | 1186 delegated_resource_collection_; |
1183 scoped_refptr<DelegatedFrameProvider> delegated_frame_provider_; | 1187 scoped_refptr<DelegatedFrameProvider> delegated_frame_provider_; |
1184 | 1188 |
1185 scoped_refptr<VideoFrame> color_video_frame_; | 1189 scoped_refptr<VideoFrame> color_video_frame_; |
1186 scoped_refptr<VideoFrame> hw_video_frame_; | 1190 scoped_refptr<VideoFrame> hw_video_frame_; |
1187 scoped_refptr<VideoFrame> scaled_hw_video_frame_; | 1191 scoped_refptr<VideoFrame> scaled_hw_video_frame_; |
1188 | 1192 |
1189 FakeVideoFrameProvider color_frame_provider_; | 1193 FakeVideoFrameProvider color_frame_provider_; |
1190 FakeVideoFrameProvider hw_frame_provider_; | 1194 FakeVideoFrameProvider hw_frame_provider_; |
1191 FakeVideoFrameProvider scaled_hw_frame_provider_; | 1195 FakeVideoFrameProvider scaled_hw_frame_provider_; |
| 1196 |
| 1197 LayerSettings layer_settings_; |
1192 }; | 1198 }; |
1193 | 1199 |
1194 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestDontUseLostResources); | 1200 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestDontUseLostResources); |
1195 | 1201 |
1196 class ImplSidePaintingLayerTreeHostContextTest | 1202 class ImplSidePaintingLayerTreeHostContextTest |
1197 : public LayerTreeHostContextTest { | 1203 : public LayerTreeHostContextTest { |
1198 public: | 1204 public: |
1199 void InitializeSettings(LayerTreeSettings* settings) override { | 1205 void InitializeSettings(LayerTreeSettings* settings) override { |
1200 settings->impl_side_painting = true; | 1206 settings->impl_side_painting = true; |
1201 } | 1207 } |
1202 }; | 1208 }; |
1203 | 1209 |
1204 class LayerTreeHostContextTestImplSidePainting | 1210 class LayerTreeHostContextTestImplSidePainting |
1205 : public ImplSidePaintingLayerTreeHostContextTest { | 1211 : public ImplSidePaintingLayerTreeHostContextTest { |
1206 public: | 1212 public: |
1207 void SetupTree() override { | 1213 void SetupTree() override { |
1208 scoped_refptr<Layer> root = Layer::Create(); | 1214 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
1209 root->SetBounds(gfx::Size(10, 10)); | 1215 root->SetBounds(gfx::Size(10, 10)); |
1210 root->SetIsDrawable(true); | 1216 root->SetIsDrawable(true); |
1211 | 1217 |
1212 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); | 1218 scoped_refptr<PictureLayer> picture = |
| 1219 PictureLayer::Create(layer_settings(), &client_); |
1213 picture->SetBounds(gfx::Size(10, 10)); | 1220 picture->SetBounds(gfx::Size(10, 10)); |
1214 picture->SetIsDrawable(true); | 1221 picture->SetIsDrawable(true); |
1215 root->AddChild(picture); | 1222 root->AddChild(picture); |
1216 | 1223 |
1217 layer_tree_host()->SetRootLayer(root); | 1224 layer_tree_host()->SetRootLayer(root); |
1218 LayerTreeHostContextTest::SetupTree(); | 1225 LayerTreeHostContextTest::SetupTree(); |
1219 } | 1226 } |
1220 | 1227 |
1221 void BeginTest() override { | 1228 void BeginTest() override { |
1222 times_to_lose_during_commit_ = 1; | 1229 times_to_lose_during_commit_ = 1; |
1223 PostSetNeedsCommitToMainThread(); | 1230 PostSetNeedsCommitToMainThread(); |
1224 } | 1231 } |
1225 | 1232 |
1226 void AfterTest() override {} | 1233 void AfterTest() override {} |
1227 | 1234 |
1228 void DidInitializeOutputSurface() override { EndTest(); } | 1235 void DidInitializeOutputSurface() override { EndTest(); } |
1229 | 1236 |
1230 private: | 1237 private: |
1231 FakeContentLayerClient client_; | 1238 FakeContentLayerClient client_; |
1232 }; | 1239 }; |
1233 | 1240 |
1234 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting); | 1241 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting); |
1235 | 1242 |
1236 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { | 1243 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { |
1237 public: | 1244 public: |
1238 ScrollbarLayerLostContext() : commits_(0) {} | 1245 ScrollbarLayerLostContext() : commits_(0) {} |
1239 | 1246 |
1240 void BeginTest() override { | 1247 void BeginTest() override { |
1241 scoped_refptr<Layer> scroll_layer = Layer::Create(); | 1248 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); |
1242 scrollbar_layer_ = | 1249 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
1243 FakePaintedScrollbarLayer::Create(false, true, scroll_layer->id()); | 1250 layer_settings(), false, true, scroll_layer->id()); |
1244 scrollbar_layer_->SetBounds(gfx::Size(10, 100)); | 1251 scrollbar_layer_->SetBounds(gfx::Size(10, 100)); |
1245 layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); | 1252 layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); |
1246 layer_tree_host()->root_layer()->AddChild(scroll_layer); | 1253 layer_tree_host()->root_layer()->AddChild(scroll_layer); |
1247 PostSetNeedsCommitToMainThread(); | 1254 PostSetNeedsCommitToMainThread(); |
1248 } | 1255 } |
1249 | 1256 |
1250 void AfterTest() override {} | 1257 void AfterTest() override {} |
1251 | 1258 |
1252 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1259 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
1253 LayerTreeHostContextTest::CommitCompleteOnThread(impl); | 1260 LayerTreeHostContextTest::CommitCompleteOnThread(impl); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction); | 1686 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction); |
1680 | 1687 |
1681 class LayerTreeHostContextTestSurfaceCreateCallback | 1688 class LayerTreeHostContextTestSurfaceCreateCallback |
1682 : public LayerTreeHostContextTest { | 1689 : public LayerTreeHostContextTest { |
1683 public: | 1690 public: |
1684 LayerTreeHostContextTestSurfaceCreateCallback() | 1691 LayerTreeHostContextTestSurfaceCreateCallback() |
1685 : LayerTreeHostContextTest() {} | 1692 : LayerTreeHostContextTest() {} |
1686 | 1693 |
1687 void SetupTree() override { | 1694 void SetupTree() override { |
1688 if (layer_tree_host()->settings().impl_side_painting) { | 1695 if (layer_tree_host()->settings().impl_side_painting) { |
1689 picture_layer_ = FakePictureLayer::Create(&client_); | 1696 picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
1690 picture_layer_->SetBounds(gfx::Size(10, 20)); | 1697 picture_layer_->SetBounds(gfx::Size(10, 20)); |
1691 layer_tree_host()->SetRootLayer(picture_layer_); | 1698 layer_tree_host()->SetRootLayer(picture_layer_); |
1692 } else { | 1699 } else { |
1693 content_layer_ = FakeContentLayer::Create(&client_); | 1700 content_layer_ = FakeContentLayer::Create(layer_settings(), &client_); |
1694 content_layer_->SetBounds(gfx::Size(10, 20)); | 1701 content_layer_->SetBounds(gfx::Size(10, 20)); |
1695 layer_tree_host()->SetRootLayer(content_layer_); | 1702 layer_tree_host()->SetRootLayer(content_layer_); |
1696 } | 1703 } |
1697 | 1704 |
1698 LayerTreeHostContextTest::SetupTree(); | 1705 LayerTreeHostContextTest::SetupTree(); |
1699 } | 1706 } |
1700 | 1707 |
1701 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1708 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1702 | 1709 |
1703 void DidCommit() override { | 1710 void DidCommit() override { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 void AfterTest() override {} | 1805 void AfterTest() override {} |
1799 | 1806 |
1800 bool deferred_; | 1807 bool deferred_; |
1801 }; | 1808 }; |
1802 | 1809 |
1803 SINGLE_AND_MULTI_THREAD_TEST_F( | 1810 SINGLE_AND_MULTI_THREAD_TEST_F( |
1804 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1811 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1805 | 1812 |
1806 } // namespace | 1813 } // namespace |
1807 } // namespace cc | 1814 } // namespace cc |
OLD | NEW |