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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 public: | 256 public: |
257 void SetupTree() override { | 257 void SetupTree() override { |
258 client_.set_fill_with_nonsolid_color(true); | 258 client_.set_fill_with_nonsolid_color(true); |
259 scoped_refptr<FakePictureLayer> root_layer = | 259 scoped_refptr<FakePictureLayer> root_layer = |
260 FakePictureLayer::Create(layer_settings(), &client_); | 260 FakePictureLayer::Create(layer_settings(), &client_); |
261 root_layer->SetBounds(gfx::Size(1024, 1024)); | 261 root_layer->SetBounds(gfx::Size(1024, 1024)); |
262 root_layer->SetIsDrawable(true); | 262 root_layer->SetIsDrawable(true); |
263 | 263 |
264 layer_tree_host()->SetRootLayer(root_layer); | 264 layer_tree_host()->SetRootLayer(root_layer); |
265 LayerTreeHostTest::SetupTree(); | 265 LayerTreeHostTest::SetupTree(); |
| 266 client_.set_bounds(root_layer->bounds()); |
266 } | 267 } |
267 | 268 |
268 void AfterTest() override { | 269 void AfterTest() override { |
269 EXPECT_TRUE(did_notify_ready_to_activate_); | 270 EXPECT_TRUE(did_notify_ready_to_activate_); |
270 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); | 271 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); |
271 EXPECT_LE(size_t(1), required_for_activation_count_); | 272 EXPECT_LE(size_t(1), required_for_activation_count_); |
272 } | 273 } |
273 | 274 |
274 private: | 275 private: |
275 FakeContentLayerClient client_; | 276 FakeContentLayerClient client_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 public: | 327 public: |
327 void SetupTree() override { | 328 void SetupTree() override { |
328 client_.set_fill_with_nonsolid_color(true); | 329 client_.set_fill_with_nonsolid_color(true); |
329 scoped_refptr<FakePictureLayer> root_layer = | 330 scoped_refptr<FakePictureLayer> root_layer = |
330 FakePictureLayer::Create(layer_settings(), &client_); | 331 FakePictureLayer::Create(layer_settings(), &client_); |
331 root_layer->SetBounds(gfx::Size(1024, 1024)); | 332 root_layer->SetBounds(gfx::Size(1024, 1024)); |
332 root_layer->SetIsDrawable(true); | 333 root_layer->SetIsDrawable(true); |
333 | 334 |
334 layer_tree_host()->SetRootLayer(root_layer); | 335 layer_tree_host()->SetRootLayer(root_layer); |
335 LayerTreeHostTest::SetupTree(); | 336 LayerTreeHostTest::SetupTree(); |
| 337 client_.set_bounds(root_layer->bounds()); |
336 } | 338 } |
337 | 339 |
338 void AfterTest() override { | 340 void AfterTest() override { |
339 EXPECT_TRUE(did_notify_ready_to_draw_); | 341 EXPECT_TRUE(did_notify_ready_to_draw_); |
340 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); | 342 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); |
341 EXPECT_LE(size_t(1), required_for_draw_count_); | 343 EXPECT_LE(size_t(1), required_for_draw_count_); |
342 } | 344 } |
343 | 345 |
344 private: | 346 private: |
345 FakeContentLayerClient client_; | 347 FakeContentLayerClient client_; |
(...skipping 13 matching lines...) Expand all Loading... |
359 did_notify_ready_to_draw_(false), | 361 did_notify_ready_to_draw_(false), |
360 did_draw_(false) {} | 362 did_draw_(false) {} |
361 | 363 |
362 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 364 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
363 | 365 |
364 void SetupTree() override { | 366 void SetupTree() override { |
365 client_.set_fill_with_nonsolid_color(true); | 367 client_.set_fill_with_nonsolid_color(true); |
366 scoped_refptr<FakePictureLayer> root_layer = | 368 scoped_refptr<FakePictureLayer> root_layer = |
367 FakePictureLayer::Create(layer_settings(), &client_); | 369 FakePictureLayer::Create(layer_settings(), &client_); |
368 root_layer->SetBounds(gfx::Size(1024, 1024)); | 370 root_layer->SetBounds(gfx::Size(1024, 1024)); |
| 371 client_.set_bounds(root_layer->bounds()); |
369 root_layer->SetIsDrawable(true); | 372 root_layer->SetIsDrawable(true); |
370 | 373 |
371 layer_tree_host()->SetRootLayer(root_layer); | 374 layer_tree_host()->SetRootLayer(root_layer); |
372 LayerTreeHostTest::SetupTree(); | 375 LayerTreeHostTest::SetupTree(); |
373 } | 376 } |
374 | 377 |
375 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 378 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
376 if (!toggled_visibility_) { | 379 if (!toggled_visibility_) { |
377 { | 380 { |
378 DebugScopedSetMainThread main(task_runner_provider()); | 381 DebugScopedSetMainThread main(task_runner_provider()); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 LayerTreeHostTestSetNeedsRedrawRect() | 727 LayerTreeHostTestSetNeedsRedrawRect() |
725 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 728 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
726 | 729 |
727 void BeginTest() override { | 730 void BeginTest() override { |
728 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 731 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
729 root_layer_->SetIsDrawable(true); | 732 root_layer_->SetIsDrawable(true); |
730 root_layer_->SetBounds(bounds_); | 733 root_layer_->SetBounds(bounds_); |
731 layer_tree_host()->SetRootLayer(root_layer_); | 734 layer_tree_host()->SetRootLayer(root_layer_); |
732 layer_tree_host()->SetViewportSize(bounds_); | 735 layer_tree_host()->SetViewportSize(bounds_); |
733 PostSetNeedsCommitToMainThread(); | 736 PostSetNeedsCommitToMainThread(); |
| 737 client_.set_bounds(root_layer_->bounds()); |
734 } | 738 } |
735 | 739 |
736 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 740 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
737 LayerTreeHostImpl::FrameData* frame_data, | 741 LayerTreeHostImpl::FrameData* frame_data, |
738 DrawResult draw_result) override { | 742 DrawResult draw_result) override { |
739 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 743 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
740 | 744 |
741 gfx::Rect root_damage_rect; | 745 gfx::Rect root_damage_rect; |
742 if (!frame_data->render_passes.empty()) | 746 if (!frame_data->render_passes.empty()) |
743 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 747 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 gfx::Transform transform; | 792 gfx::Transform transform; |
789 // Translate the layer out of the viewport to force it to not update its | 793 // Translate the layer out of the viewport to force it to not update its |
790 // tile size via PushProperties. | 794 // tile size via PushProperties. |
791 transform.Translate(10000.0, 10000.0); | 795 transform.Translate(10000.0, 10000.0); |
792 root_layer_->SetTransform(transform); | 796 root_layer_->SetTransform(transform); |
793 root_layer_->SetBounds(bounds_); | 797 root_layer_->SetBounds(bounds_); |
794 layer_tree_host()->SetRootLayer(root_layer_); | 798 layer_tree_host()->SetRootLayer(root_layer_); |
795 layer_tree_host()->SetViewportSize(bounds_); | 799 layer_tree_host()->SetViewportSize(bounds_); |
796 | 800 |
797 PostSetNeedsCommitToMainThread(); | 801 PostSetNeedsCommitToMainThread(); |
| 802 client_.set_bounds(root_layer_->bounds()); |
798 } | 803 } |
799 | 804 |
800 void InitializeSettings(LayerTreeSettings* settings) override { | 805 void InitializeSettings(LayerTreeSettings* settings) override { |
801 settings->gpu_rasterization_enabled = true; | 806 settings->gpu_rasterization_enabled = true; |
802 settings->gpu_rasterization_forced = true; | 807 settings->gpu_rasterization_forced = true; |
803 } | 808 } |
804 | 809 |
805 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 810 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
806 // Perform 2 commits. | 811 // Perform 2 commits. |
807 if (!num_draws_) { | 812 if (!num_draws_) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 void SetupTree() override { | 867 void SetupTree() override { |
863 root_layer_ = Layer::Create(layer_settings()); | 868 root_layer_ = Layer::Create(layer_settings()); |
864 root_layer_->SetBounds(gfx::Size(10, 20)); | 869 root_layer_->SetBounds(gfx::Size(10, 20)); |
865 | 870 |
866 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 871 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
867 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 872 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
868 root_layer_->AddChild(scaled_layer_); | 873 root_layer_->AddChild(scaled_layer_); |
869 | 874 |
870 layer_tree_host()->SetRootLayer(root_layer_); | 875 layer_tree_host()->SetRootLayer(root_layer_); |
871 LayerTreeHostTest::SetupTree(); | 876 LayerTreeHostTest::SetupTree(); |
| 877 client_.set_bounds(root_layer_->bounds()); |
872 } | 878 } |
873 | 879 |
874 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 880 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
875 | 881 |
876 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 882 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
877 if (host_impl->active_tree()->source_frame_number() == 1) | 883 if (host_impl->active_tree()->source_frame_number() == 1) |
878 EndTest(); | 884 EndTest(); |
879 } | 885 } |
880 | 886 |
881 void DidCommit() override { | 887 void DidCommit() override { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 bool has_thumb = false; | 923 bool has_thumb = false; |
918 scrollbar_ = FakePaintedScrollbarLayer::Create( | 924 scrollbar_ = FakePaintedScrollbarLayer::Create( |
919 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); | 925 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); |
920 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); | 926 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); |
921 scrollbar_->SetBounds(gfx::Size(10, 10)); | 927 scrollbar_->SetBounds(gfx::Size(10, 10)); |
922 | 928 |
923 root_layer_->AddChild(scrollbar_); | 929 root_layer_->AddChild(scrollbar_); |
924 | 930 |
925 layer_tree_host()->SetRootLayer(root_layer_); | 931 layer_tree_host()->SetRootLayer(root_layer_); |
926 LayerTreeHostTest::SetupTree(); | 932 LayerTreeHostTest::SetupTree(); |
| 933 client_.set_bounds(root_layer_->bounds()); |
927 } | 934 } |
928 | 935 |
929 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 936 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
930 | 937 |
931 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 938 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
932 if (host_impl->active_tree()->source_frame_number() == 1) | 939 if (host_impl->active_tree()->source_frame_number() == 1) |
933 EndTest(); | 940 EndTest(); |
934 } | 941 } |
935 | 942 |
936 void DidCommit() override { | 943 void DidCommit() override { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 void SetupTree() override { | 976 void SetupTree() override { |
970 root_layer_ = Layer::Create(layer_settings()); | 977 root_layer_ = Layer::Create(layer_settings()); |
971 root_layer_->SetBounds(gfx::Size(10, 20)); | 978 root_layer_->SetBounds(gfx::Size(10, 20)); |
972 | 979 |
973 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 980 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
974 child_layer_->SetBounds(gfx::Size(10, 10)); | 981 child_layer_->SetBounds(gfx::Size(10, 10)); |
975 root_layer_->AddChild(child_layer_); | 982 root_layer_->AddChild(child_layer_); |
976 | 983 |
977 layer_tree_host()->SetRootLayer(root_layer_); | 984 layer_tree_host()->SetRootLayer(root_layer_); |
978 LayerTreeHostTest::SetupTree(); | 985 LayerTreeHostTest::SetupTree(); |
| 986 client_.set_bounds(root_layer_->bounds()); |
979 } | 987 } |
980 | 988 |
981 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 989 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
982 | 990 |
983 void DidCommit() override { | 991 void DidCommit() override { |
984 if (layer_tree_host()->source_frame_number() == 1) | 992 if (layer_tree_host()->source_frame_number() == 1) |
985 layer_tree_host()->SetDeviceScaleFactor(4.f); | 993 layer_tree_host()->SetDeviceScaleFactor(4.f); |
986 } | 994 } |
987 | 995 |
988 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 996 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 LayerTreeHostTestSetNextCommitForcesRedraw() | 1036 LayerTreeHostTestSetNextCommitForcesRedraw() |
1029 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1037 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
1030 | 1038 |
1031 void BeginTest() override { | 1039 void BeginTest() override { |
1032 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1040 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
1033 root_layer_->SetIsDrawable(true); | 1041 root_layer_->SetIsDrawable(true); |
1034 root_layer_->SetBounds(bounds_); | 1042 root_layer_->SetBounds(bounds_); |
1035 layer_tree_host()->SetRootLayer(root_layer_); | 1043 layer_tree_host()->SetRootLayer(root_layer_); |
1036 layer_tree_host()->SetViewportSize(bounds_); | 1044 layer_tree_host()->SetViewportSize(bounds_); |
1037 PostSetNeedsCommitToMainThread(); | 1045 PostSetNeedsCommitToMainThread(); |
| 1046 client_.set_bounds(root_layer_->bounds()); |
1038 } | 1047 } |
1039 | 1048 |
1040 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1049 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1041 if (num_draws_ == 3) | 1050 if (num_draws_ == 3) |
1042 host_impl->SetNeedsRedrawRect(invalid_rect_); | 1051 host_impl->SetNeedsRedrawRect(invalid_rect_); |
1043 } | 1052 } |
1044 | 1053 |
1045 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1054 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1046 LayerTreeHostImpl::FrameData* frame_data, | 1055 LayerTreeHostImpl::FrameData* frame_data, |
1047 DrawResult draw_result) override { | 1056 DrawResult draw_result) override { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 // The initially transparent layer has a larger child layer, which is | 1138 // The initially transparent layer has a larger child layer, which is |
1130 // not initially drawn because of the this (parent) layer. | 1139 // not initially drawn because of the this (parent) layer. |
1131 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1140 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
1132 parent_layer_->SetBounds(gfx::Size(15, 15)); | 1141 parent_layer_->SetBounds(gfx::Size(15, 15)); |
1133 parent_layer_->SetOpacity(0.0f); | 1142 parent_layer_->SetOpacity(0.0f); |
1134 root_layer_->AddChild(parent_layer_); | 1143 root_layer_->AddChild(parent_layer_); |
1135 | 1144 |
1136 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1145 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
1137 child_layer_->SetBounds(gfx::Size(25, 25)); | 1146 child_layer_->SetBounds(gfx::Size(25, 25)); |
1138 parent_layer_->AddChild(child_layer_); | 1147 parent_layer_->AddChild(child_layer_); |
| 1148 client_.set_bounds(root_layer_->bounds()); |
1139 | 1149 |
1140 LayerTreeHostTest::SetupTree(); | 1150 LayerTreeHostTest::SetupTree(); |
1141 } | 1151 } |
1142 | 1152 |
1143 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1153 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1144 | 1154 |
1145 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1155 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1146 LayerTreeHostImpl::FrameData* frame_data, | 1156 LayerTreeHostImpl::FrameData* frame_data, |
1147 DrawResult draw_result) override { | 1157 DrawResult draw_result) override { |
1148 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1158 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 recording.reset(new FakeDisplayListRecordingSource); | 1233 recording.reset(new FakeDisplayListRecordingSource); |
1224 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1234 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
1225 layer_settings(), &client_, std::move(recording)); | 1235 layer_settings(), &client_, std::move(recording)); |
1226 child_layer_->SetBounds(gfx::Size(25, 25)); | 1236 child_layer_->SetBounds(gfx::Size(25, 25)); |
1227 child_layer_->SetIsDrawable(true); | 1237 child_layer_->SetIsDrawable(true); |
1228 child_layer_->SetContentsOpaque(true); | 1238 child_layer_->SetContentsOpaque(true); |
1229 root_layer_->AddChild(child_layer_); | 1239 root_layer_->AddChild(child_layer_); |
1230 | 1240 |
1231 layer_tree_host()->SetRootLayer(root_layer_); | 1241 layer_tree_host()->SetRootLayer(root_layer_); |
1232 LayerTreeHostTest::SetupTree(); | 1242 LayerTreeHostTest::SetupTree(); |
| 1243 client_.set_bounds(root_layer_->bounds()); |
1233 } | 1244 } |
1234 | 1245 |
1235 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1246 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
1236 // Force the layer to have a tiling at 1.3f scale. Note that if we simply | 1247 // Force the layer to have a tiling at 1.3f scale. Note that if we simply |
1237 // add tiling, it will be gone by the time we draw because of aggressive | 1248 // add tiling, it will be gone by the time we draw because of aggressive |
1238 // cleanup. AddTilingUntilNextDraw ensures that it remains there during | 1249 // cleanup. AddTilingUntilNextDraw ensures that it remains there during |
1239 // damage calculation. | 1250 // damage calculation. |
1240 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( | 1251 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( |
1241 host_impl->active_tree()->LayerById(child_layer_->id())); | 1252 host_impl->active_tree()->LayerById(child_layer_->id())); |
1242 child_layer_impl->AddTilingUntilNextDraw(1.3f); | 1253 child_layer_impl->AddTilingUntilNextDraw(1.3f); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); | 1473 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); |
1463 | 1474 |
1464 CreateVirtualViewportLayers(root_layer, | 1475 CreateVirtualViewportLayers(root_layer, |
1465 scroll_layer_, | 1476 scroll_layer_, |
1466 root_layer->bounds(), | 1477 root_layer->bounds(), |
1467 root_layer->bounds(), | 1478 root_layer->bounds(), |
1468 layer_tree_host(), | 1479 layer_tree_host(), |
1469 layer_settings()); | 1480 layer_settings()); |
1470 | 1481 |
1471 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 1482 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
| 1483 client_.set_bounds(root_layer->bounds()); |
1472 } | 1484 } |
1473 | 1485 |
1474 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1486 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1475 | 1487 |
1476 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, | 1488 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, |
1477 const gfx::Vector2dF&, | 1489 const gfx::Vector2dF&, |
1478 const gfx::Vector2dF& elastic_overscroll_delta, | 1490 const gfx::Vector2dF& elastic_overscroll_delta, |
1479 float scale, | 1491 float scale, |
1480 float) override { | 1492 float) override { |
1481 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); | 1493 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 }; | 1560 }; |
1549 | 1561 |
1550 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); | 1562 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); |
1551 | 1563 |
1552 class TestOpacityChangeLayerDelegate : public ContentLayerClient { | 1564 class TestOpacityChangeLayerDelegate : public ContentLayerClient { |
1553 public: | 1565 public: |
1554 TestOpacityChangeLayerDelegate() : test_layer_(0) {} | 1566 TestOpacityChangeLayerDelegate() : test_layer_(0) {} |
1555 | 1567 |
1556 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } | 1568 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } |
1557 | 1569 |
| 1570 gfx::Rect PaintableRegion() override { |
| 1571 return gfx::Rect(test_layer_->bounds()); |
| 1572 } |
1558 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 1573 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
1559 const gfx::Rect& clip, | 1574 const gfx::Rect& clip, |
1560 PaintingControlSetting picture_control) override { | 1575 PaintingControlSetting picture_control) override { |
1561 // Set layer opacity to 0. | 1576 // Set layer opacity to 0. |
1562 if (test_layer_) | 1577 if (test_layer_) |
1563 test_layer_->SetOpacity(0.f); | 1578 test_layer_->SetOpacity(0.f); |
1564 | 1579 |
1565 // Return a dummy display list. | 1580 // Return a dummy display list. |
1566 scoped_refptr<DisplayItemList> display_list = | 1581 scoped_refptr<DisplayItemList> display_list = |
1567 DisplayItemList::Create(clip, DisplayItemListSettings()); | 1582 DisplayItemList::Create(clip, DisplayItemListSettings()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); | 1636 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); |
1622 | 1637 |
1623 root_layer_->AddChild(child_layer_); | 1638 root_layer_->AddChild(child_layer_); |
1624 | 1639 |
1625 root_layer_->SetIsDrawable(true); | 1640 root_layer_->SetIsDrawable(true); |
1626 root_layer_->SetBounds(gfx::Size(30, 30)); | 1641 root_layer_->SetBounds(gfx::Size(30, 30)); |
1627 | 1642 |
1628 child_layer_->SetIsDrawable(true); | 1643 child_layer_->SetIsDrawable(true); |
1629 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); | 1644 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); |
1630 child_layer_->SetBounds(gfx::Size(10, 10)); | 1645 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 1646 client_.set_bounds(gfx::Size(10, 10)); |
1631 | 1647 |
1632 layer_tree_host()->SetRootLayer(root_layer_); | 1648 layer_tree_host()->SetRootLayer(root_layer_); |
1633 | 1649 |
1634 PostSetNeedsCommitToMainThread(); | 1650 PostSetNeedsCommitToMainThread(); |
| 1651 client_.set_bounds(root_layer_->bounds()); |
1635 } | 1652 } |
1636 | 1653 |
1637 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 1654 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
1638 // Should only do one commit. | 1655 // Should only do one commit. |
1639 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 1656 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
1640 // Device scale factor should come over to impl. | 1657 // Device scale factor should come over to impl. |
1641 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); | 1658 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); |
1642 | 1659 |
1643 // Both layers are on impl. | 1660 // Both layers are on impl. |
1644 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); | 1661 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 1735 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
1719 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); | 1736 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
1720 | 1737 |
1721 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1738 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
1722 layer_->SetBounds(gfx::Size(10, 10)); | 1739 layer_->SetBounds(gfx::Size(10, 10)); |
1723 layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 1740 layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
1724 layer_->SetIsDrawable(true); | 1741 layer_->SetIsDrawable(true); |
1725 layer_tree_host()->root_layer()->AddChild(layer_); | 1742 layer_tree_host()->root_layer()->AddChild(layer_); |
1726 | 1743 |
1727 PostSetNeedsCommitToMainThread(); | 1744 PostSetNeedsCommitToMainThread(); |
| 1745 client_.set_bounds(layer_->bounds()); |
1728 } | 1746 } |
1729 | 1747 |
1730 void DidCommitAndDrawFrame() override { | 1748 void DidCommitAndDrawFrame() override { |
1731 if (num_draw_layers_ == 2) | 1749 if (num_draw_layers_ == 2) |
1732 return; | 1750 return; |
1733 layer_->SetNeedsDisplay(); | 1751 layer_->SetNeedsDisplay(); |
1734 } | 1752 } |
1735 | 1753 |
1736 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 1754 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
1737 if (num_draw_layers_ == 1) | 1755 if (num_draw_layers_ == 1) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 root_layer->SetBounds(gfx::Size(10, 10)); | 1917 root_layer->SetBounds(gfx::Size(10, 10)); |
1900 root_layer->SetContentsOpaque(true); | 1918 root_layer->SetContentsOpaque(true); |
1901 | 1919 |
1902 layer_tree_host()->SetRootLayer(root_layer); | 1920 layer_tree_host()->SetRootLayer(root_layer); |
1903 | 1921 |
1904 // The expectations are based on the assumption that the default | 1922 // The expectations are based on the assumption that the default |
1905 // LCD settings are: | 1923 // LCD settings are: |
1906 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); | 1924 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); |
1907 | 1925 |
1908 LayerTreeHostTest::SetupTree(); | 1926 LayerTreeHostTest::SetupTree(); |
| 1927 client_.set_bounds(root_layer->bounds()); |
1909 } | 1928 } |
1910 | 1929 |
1911 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1930 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1912 | 1931 |
1913 void DidCommitAndDrawFrame() override { | 1932 void DidCommitAndDrawFrame() override { |
1914 switch (layer_tree_host()->source_frame_number()) { | 1933 switch (layer_tree_host()->source_frame_number()) { |
1915 case 1: | 1934 case 1: |
1916 PostSetNeedsCommitToMainThread(); | 1935 PostSetNeedsCommitToMainThread(); |
1917 break; | 1936 break; |
1918 case 2: | 1937 case 2: |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 : public LayerTreeHostTest { | 2143 : public LayerTreeHostTest { |
2125 protected: | 2144 protected: |
2126 void SetupTree() override { | 2145 void SetupTree() override { |
2127 LayerTreeHostTest::SetupTree(); | 2146 LayerTreeHostTest::SetupTree(); |
2128 | 2147 |
2129 scoped_refptr<Layer> layer = | 2148 scoped_refptr<Layer> layer = |
2130 PictureLayer::Create(layer_settings(), &client_); | 2149 PictureLayer::Create(layer_settings(), &client_); |
2131 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 2150 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
2132 layer->SetBounds(gfx::Size(10, 10)); | 2151 layer->SetBounds(gfx::Size(10, 10)); |
2133 layer_tree_host()->root_layer()->AddChild(layer); | 2152 layer_tree_host()->root_layer()->AddChild(layer); |
| 2153 client_.set_bounds(layer->bounds()); |
2134 } | 2154 } |
2135 | 2155 |
2136 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2156 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2137 | 2157 |
2138 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2158 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
2139 EndTest(); | 2159 EndTest(); |
2140 } | 2160 } |
2141 | 2161 |
2142 void AfterTest() override {} | 2162 void AfterTest() override {} |
2143 | 2163 |
2144 FakeContentLayerClient client_; | 2164 FakeContentLayerClient client_; |
2145 }; | 2165 }; |
2146 | 2166 |
2147 SINGLE_AND_MULTI_THREAD_TEST_F( | 2167 SINGLE_AND_MULTI_THREAD_TEST_F( |
2148 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); | 2168 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); |
2149 | 2169 |
2150 class LayerTreeHostTestChangeLayerPropertiesInPaintContents | 2170 class LayerTreeHostTestChangeLayerPropertiesInPaintContents |
2151 : public LayerTreeHostTest { | 2171 : public LayerTreeHostTest { |
2152 public: | 2172 public: |
2153 class SetBoundsClient : public ContentLayerClient { | 2173 class SetBoundsClient : public ContentLayerClient { |
2154 public: | 2174 public: |
2155 SetBoundsClient() : layer_(0) {} | 2175 SetBoundsClient() : layer_(0) {} |
2156 | 2176 |
2157 void set_layer(Layer* layer) { layer_ = layer; } | 2177 void set_layer(Layer* layer) { layer_ = layer; } |
2158 | 2178 |
| 2179 gfx::Rect PaintableRegion() override { return gfx::Rect(layer_->bounds()); } |
| 2180 |
2159 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 2181 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
2160 const gfx::Rect& clip, | 2182 const gfx::Rect& clip, |
2161 PaintingControlSetting picture_control) override { | 2183 PaintingControlSetting picture_control) override { |
2162 layer_->SetBounds(gfx::Size(2, 2)); | 2184 layer_->SetBounds(gfx::Size(2, 2)); |
2163 | 2185 |
2164 // Return a dummy display list. | 2186 // Return a dummy display list. |
2165 scoped_refptr<DisplayItemList> display_list = | 2187 scoped_refptr<DisplayItemList> display_list = |
2166 DisplayItemList::Create(clip, DisplayItemListSettings()); | 2188 DisplayItemList::Create(clip, DisplayItemListSettings()); |
2167 return display_list; | 2189 return display_list; |
2168 } | 2190 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 | 2436 |
2415 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 2437 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
2416 child_layer_->SetIsDrawable(true); | 2438 child_layer_->SetIsDrawable(true); |
2417 child_layer_->SetBounds(gfx::Size(50, 50)); | 2439 child_layer_->SetBounds(gfx::Size(50, 50)); |
2418 | 2440 |
2419 root_layer_->AddChild(parent_layer_); | 2441 root_layer_->AddChild(parent_layer_); |
2420 parent_layer_->AddChild(child_layer_); | 2442 parent_layer_->AddChild(child_layer_); |
2421 layer_tree_host()->SetRootLayer(root_layer_); | 2443 layer_tree_host()->SetRootLayer(root_layer_); |
2422 | 2444 |
2423 LayerTreeHostTest::SetupTree(); | 2445 LayerTreeHostTest::SetupTree(); |
| 2446 client_.set_bounds(root_layer_->bounds()); |
2424 } | 2447 } |
2425 | 2448 |
2426 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 2449 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
2427 if (delegating_renderer()) { | 2450 if (delegating_renderer()) { |
2428 return FakeOutputSurface::CreateDelegatingSoftware( | 2451 return FakeOutputSurface::CreateDelegatingSoftware( |
2429 make_scoped_ptr(new SoftwareOutputDevice)); | 2452 make_scoped_ptr(new SoftwareOutputDevice)); |
2430 } else { | 2453 } else { |
2431 return FakeOutputSurface::CreateSoftware( | 2454 return FakeOutputSurface::CreateSoftware( |
2432 make_scoped_ptr(new SoftwareOutputDevice)); | 2455 make_scoped_ptr(new SoftwareOutputDevice)); |
2433 } | 2456 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 | 2708 |
2686 root_->AddChild(child_); | 2709 root_->AddChild(child_); |
2687 root_->AddChild(child2_); | 2710 root_->AddChild(child2_); |
2688 child_->AddChild(grandchild_); | 2711 child_->AddChild(grandchild_); |
2689 child2_->AddChild(leaf_always_pushing_layer_); | 2712 child2_->AddChild(leaf_always_pushing_layer_); |
2690 | 2713 |
2691 other_root_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2714 other_root_ = PushPropertiesCountingLayer::Create(layer_settings()); |
2692 | 2715 |
2693 // Don't set the root layer here. | 2716 // Don't set the root layer here. |
2694 LayerTreeHostTest::SetupTree(); | 2717 LayerTreeHostTest::SetupTree(); |
| 2718 client_.set_bounds(root_->bounds()); |
2695 } | 2719 } |
2696 | 2720 |
2697 void DidCommitAndDrawFrame() override { | 2721 void DidCommitAndDrawFrame() override { |
2698 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) | 2722 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) |
2699 << "num_commits: " << num_commits_; | 2723 << "num_commits: " << num_commits_; |
2700 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) | 2724 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) |
2701 << "num_commits: " << num_commits_; | 2725 << "num_commits: " << num_commits_; |
2702 EXPECT_EQ(expected_push_properties_grandchild_, | 2726 EXPECT_EQ(expected_push_properties_grandchild_, |
2703 grandchild_->push_properties_count()) | 2727 grandchild_->push_properties_count()) |
2704 << "num_commits: " << num_commits_; | 2728 << "num_commits: " << num_commits_; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3212 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings()); |
3189 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3213 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings()); |
3190 | 3214 |
3191 root_->AddChild(child_); | 3215 root_->AddChild(child_); |
3192 child_->AddChild(grandchild1_); | 3216 child_->AddChild(grandchild1_); |
3193 child_->AddChild(grandchild2_); | 3217 child_->AddChild(grandchild2_); |
3194 child_->AddChild(grandchild3_); | 3218 child_->AddChild(grandchild3_); |
3195 | 3219 |
3196 // Don't set the root layer here. | 3220 // Don't set the root layer here. |
3197 LayerTreeHostTest::SetupTree(); | 3221 LayerTreeHostTest::SetupTree(); |
| 3222 client_.set_bounds(root_->bounds()); |
3198 } | 3223 } |
3199 | 3224 |
3200 void AfterTest() override {} | 3225 void AfterTest() override {} |
3201 | 3226 |
3202 FakeContentLayerClient client_; | 3227 FakeContentLayerClient client_; |
3203 scoped_refptr<PushPropertiesCountingLayer> root_; | 3228 scoped_refptr<PushPropertiesCountingLayer> root_; |
3204 scoped_refptr<PushPropertiesCountingLayer> child_; | 3229 scoped_refptr<PushPropertiesCountingLayer> child_; |
3205 scoped_refptr<PushPropertiesCountingLayer> grandchild1_; | 3230 scoped_refptr<PushPropertiesCountingLayer> grandchild1_; |
3206 scoped_refptr<PushPropertiesCountingLayer> grandchild2_; | 3231 scoped_refptr<PushPropertiesCountingLayer> grandchild2_; |
3207 scoped_refptr<PushPropertiesCountingLayer> grandchild3_; | 3232 scoped_refptr<PushPropertiesCountingLayer> grandchild3_; |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3791 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 3816 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); |
3792 | 3817 |
3793 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 3818 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
3794 protected: | 3819 protected: |
3795 void SetupTree() override { | 3820 void SetupTree() override { |
3796 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 3821 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
3797 root_layer_->SetBounds(gfx::Size(10, 10)); | 3822 root_layer_->SetBounds(gfx::Size(10, 10)); |
3798 | 3823 |
3799 layer_tree_host()->SetRootLayer(root_layer_); | 3824 layer_tree_host()->SetRootLayer(root_layer_); |
3800 LayerTreeHostTest::SetupTree(); | 3825 LayerTreeHostTest::SetupTree(); |
| 3826 client_.set_bounds(root_layer_->bounds()); |
3801 } | 3827 } |
3802 | 3828 |
3803 void BeginTest() override { | 3829 void BeginTest() override { |
3804 // The viewport is empty, but we still need to update layers on the main | 3830 // The viewport is empty, but we still need to update layers on the main |
3805 // thread. | 3831 // thread. |
3806 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); | 3832 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); |
3807 PostSetNeedsCommitToMainThread(); | 3833 PostSetNeedsCommitToMainThread(); |
3808 } | 3834 } |
3809 | 3835 |
3810 void DidCommit() override { | 3836 void DidCommit() override { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3852 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 3878 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
3853 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 3879 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
3854 return output_surface; | 3880 return output_surface; |
3855 } | 3881 } |
3856 | 3882 |
3857 void SetupTree() override { | 3883 void SetupTree() override { |
3858 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 3884 root_ = FakePictureLayer::Create(layer_settings(), &client_); |
3859 root_->SetBounds(gfx::Size(20, 20)); | 3885 root_->SetBounds(gfx::Size(20, 20)); |
3860 layer_tree_host()->SetRootLayer(root_); | 3886 layer_tree_host()->SetRootLayer(root_); |
3861 LayerTreeHostTest::SetupTree(); | 3887 LayerTreeHostTest::SetupTree(); |
| 3888 client_.set_bounds(root_->bounds()); |
3862 } | 3889 } |
3863 | 3890 |
3864 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3891 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
3865 | 3892 |
3866 void DidCommitAndDrawFrame() override { | 3893 void DidCommitAndDrawFrame() override { |
3867 // Lost context sometimes takes two frames to recreate. The third frame | 3894 // Lost context sometimes takes two frames to recreate. The third frame |
3868 // is sometimes aborted, so wait until the fourth frame to verify that | 3895 // is sometimes aborted, so wait until the fourth frame to verify that |
3869 // the memory has been set, and the fifth frame to end the test. | 3896 // the memory has been set, and the fifth frame to end the test. |
3870 if (layer_tree_host()->source_frame_number() < 5) { | 3897 if (layer_tree_host()->source_frame_number() < 5) { |
3871 layer_tree_host()->SetNeedsCommit(); | 3898 layer_tree_host()->SetNeedsCommit(); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4369 }; | 4396 }; |
4370 | 4397 |
4371 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 4398 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
4372 | 4399 |
4373 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources | 4400 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources |
4374 : public LayerTreeHostTest { | 4401 : public LayerTreeHostTest { |
4375 protected: | 4402 protected: |
4376 void SetupTree() override { | 4403 void SetupTree() override { |
4377 LayerTreeHostTest::SetupTree(); | 4404 LayerTreeHostTest::SetupTree(); |
4378 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); | 4405 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); |
| 4406 client_.set_bounds(layer_tree_host()->root_layer()->bounds()); |
4379 } | 4407 } |
4380 | 4408 |
4381 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4409 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4382 | 4410 |
4383 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 4411 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
4384 host_impl->EvictAllUIResources(); | 4412 host_impl->EvictAllUIResources(); |
4385 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY | 4413 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY |
4386 // mode. Active tree should require high-res to draw after entering this | 4414 // mode. Active tree should require high-res to draw after entering this |
4387 // mode to ensure that high-res tiles are also required for a pending tree | 4415 // mode to ensure that high-res tiles are also required for a pending tree |
4388 // to be activated. | 4416 // to be activated. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4425 new FakeDisplayListRecordingSource); | 4453 new FakeDisplayListRecordingSource); |
4426 recording_source_ = recording_source.get(); | 4454 recording_source_ = recording_source.get(); |
4427 | 4455 |
4428 scoped_refptr<FakePictureLayer> layer = | 4456 scoped_refptr<FakePictureLayer> layer = |
4429 FakePictureLayer::CreateWithRecordingSource( | 4457 FakePictureLayer::CreateWithRecordingSource( |
4430 layer_settings(), &layer_client_, std::move(recording_source)); | 4458 layer_settings(), &layer_client_, std::move(recording_source)); |
4431 layer_ = layer.get(); | 4459 layer_ = layer.get(); |
4432 layer->SetBounds(gfx::Size(10, 10)); | 4460 layer->SetBounds(gfx::Size(10, 10)); |
4433 layer->SetIsDrawable(true); | 4461 layer->SetIsDrawable(true); |
4434 layer_tree_host()->root_layer()->AddChild(layer); | 4462 layer_tree_host()->root_layer()->AddChild(layer); |
| 4463 layer_client_.set_bounds(layer_->bounds()); |
4435 } | 4464 } |
4436 | 4465 |
4437 void BeginTest() override { | 4466 void BeginTest() override { |
4438 // Verify default value. | 4467 // Verify default value. |
4439 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4468 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4440 | 4469 |
4441 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4470 // Setting gpu rasterization trigger does not enable gpu rasterization. |
4442 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4471 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4443 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4472 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4444 | 4473 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4480 new FakeDisplayListRecordingSource); | 4509 new FakeDisplayListRecordingSource); |
4481 recording_source_ = recording_source.get(); | 4510 recording_source_ = recording_source.get(); |
4482 | 4511 |
4483 scoped_refptr<FakePictureLayer> layer = | 4512 scoped_refptr<FakePictureLayer> layer = |
4484 FakePictureLayer::CreateWithRecordingSource( | 4513 FakePictureLayer::CreateWithRecordingSource( |
4485 layer_settings(), &layer_client_, std::move(recording_source)); | 4514 layer_settings(), &layer_client_, std::move(recording_source)); |
4486 layer_ = layer.get(); | 4515 layer_ = layer.get(); |
4487 layer->SetBounds(gfx::Size()); | 4516 layer->SetBounds(gfx::Size()); |
4488 layer->SetIsDrawable(true); | 4517 layer->SetIsDrawable(true); |
4489 layer_tree_host()->root_layer()->AddChild(layer); | 4518 layer_tree_host()->root_layer()->AddChild(layer); |
| 4519 layer_client_.set_bounds(layer->bounds()); |
4490 } | 4520 } |
4491 | 4521 |
4492 void BeginTest() override { | 4522 void BeginTest() override { |
4493 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4523 // Setting gpu rasterization trigger does not enable gpu rasterization. |
4494 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4524 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4495 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4525 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4496 | 4526 |
4497 PostSetNeedsCommitToMainThread(); | 4527 PostSetNeedsCommitToMainThread(); |
4498 } | 4528 } |
4499 | 4529 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4537 new FakeDisplayListRecordingSource); | 4567 new FakeDisplayListRecordingSource); |
4538 recording_source_ = recording_source.get(); | 4568 recording_source_ = recording_source.get(); |
4539 | 4569 |
4540 scoped_refptr<FakePictureLayer> layer = | 4570 scoped_refptr<FakePictureLayer> layer = |
4541 FakePictureLayer::CreateWithRecordingSource( | 4571 FakePictureLayer::CreateWithRecordingSource( |
4542 layer_settings(), &layer_client_, std::move(recording_source)); | 4572 layer_settings(), &layer_client_, std::move(recording_source)); |
4543 layer_ = layer.get(); | 4573 layer_ = layer.get(); |
4544 layer->SetBounds(gfx::Size(10, 10)); | 4574 layer->SetBounds(gfx::Size(10, 10)); |
4545 layer->SetIsDrawable(true); | 4575 layer->SetIsDrawable(true); |
4546 layer_tree_host()->root_layer()->AddChild(layer); | 4576 layer_tree_host()->root_layer()->AddChild(layer); |
| 4577 layer_client_.set_bounds(layer_->bounds()); |
4547 } | 4578 } |
4548 | 4579 |
4549 void BeginTest() override { | 4580 void BeginTest() override { |
4550 // Verify default value. | 4581 // Verify default value. |
4551 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4582 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4552 | 4583 |
4553 // Gpu rasterization trigger is relevant. | 4584 // Gpu rasterization trigger is relevant. |
4554 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4585 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4555 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4586 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4556 | 4587 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 recording_source_ = recording_source.get(); | 4638 recording_source_ = recording_source.get(); |
4608 | 4639 |
4609 scoped_refptr<FakePictureLayer> layer = | 4640 scoped_refptr<FakePictureLayer> layer = |
4610 FakePictureLayer::CreateWithRecordingSource( | 4641 FakePictureLayer::CreateWithRecordingSource( |
4611 layer_settings(), &layer_client_, std::move(recording_source)); | 4642 layer_settings(), &layer_client_, std::move(recording_source)); |
4612 layer_ = layer.get(); | 4643 layer_ = layer.get(); |
4613 | 4644 |
4614 layer->SetBounds(gfx::Size(10, 10)); | 4645 layer->SetBounds(gfx::Size(10, 10)); |
4615 layer->SetIsDrawable(true); | 4646 layer->SetIsDrawable(true); |
4616 layer_tree_host()->root_layer()->AddChild(layer); | 4647 layer_tree_host()->root_layer()->AddChild(layer); |
| 4648 layer_client_.set_bounds(layer_->bounds()); |
4617 } | 4649 } |
4618 | 4650 |
4619 void BeginTest() override { | 4651 void BeginTest() override { |
4620 // Verify default value. | 4652 // Verify default value. |
4621 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4653 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4622 | 4654 |
4623 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 4655 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
4624 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4656 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4625 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4657 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4626 | 4658 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4891 | 4923 |
4892 void AfterTest() override { | 4924 void AfterTest() override { |
4893 // Ensure we activated even though the signal was blocked. | 4925 // Ensure we activated even though the signal was blocked. |
4894 EXPECT_EQ(1, activation_count_); | 4926 EXPECT_EQ(1, activation_count_); |
4895 EXPECT_TRUE(visible_); | 4927 EXPECT_TRUE(visible_); |
4896 } | 4928 } |
4897 | 4929 |
4898 private: | 4930 private: |
4899 int activation_count_; | 4931 int activation_count_; |
4900 bool visible_; | 4932 bool visible_; |
4901 | |
4902 FakeContentLayerClient client_; | |
4903 scoped_refptr<FakePictureLayer> picture_layer_; | |
4904 }; | 4933 }; |
4905 | 4934 |
4906 // TODO(vmpstr): Enable with single thread impl-side painting. | 4935 // TODO(vmpstr): Enable with single thread impl-side painting. |
4907 // This test blocks activation which is not supported for single thread mode. | 4936 // This test blocks activation which is not supported for single thread mode. |
4908 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); | 4937 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); |
4909 | 4938 |
4910 // Do a synchronous composite and assert that the swap promise succeeds. | 4939 // Do a synchronous composite and assert that the swap promise succeeds. |
4911 class LayerTreeHostTestSynchronousCompositeSwapPromise | 4940 class LayerTreeHostTestSynchronousCompositeSwapPromise |
4912 : public LayerTreeHostTest { | 4941 : public LayerTreeHostTest { |
4913 public: | 4942 public: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5057 layer->SetBounds(gfx::Size(500, 500)); | 5086 layer->SetBounds(gfx::Size(500, 500)); |
5058 layer->SetContentsOpaque(true); | 5087 layer->SetContentsOpaque(true); |
5059 // Avoid LCD text on the layer so we don't cause extra commits when we | 5088 // Avoid LCD text on the layer so we don't cause extra commits when we |
5060 // pinch. | 5089 // pinch. |
5061 pinch->AddChild(layer); | 5090 pinch->AddChild(layer); |
5062 | 5091 |
5063 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); | 5092 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); |
5064 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5093 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
5065 layer_tree_host()->SetRootLayer(root); | 5094 layer_tree_host()->SetRootLayer(root); |
5066 LayerTreeHostTest::SetupTree(); | 5095 LayerTreeHostTest::SetupTree(); |
| 5096 client_.set_bounds(root->bounds()); |
5067 } | 5097 } |
5068 | 5098 |
5069 // Returns the delta scale of all quads in the frame's root pass from their | 5099 // Returns the delta scale of all quads in the frame's root pass from their |
5070 // ideal, or 0 if they are not all the same. | 5100 // ideal, or 0 if they are not all the same. |
5071 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 5101 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
5072 if (frame_data->has_no_damage) | 5102 if (frame_data->has_no_damage) |
5073 return 0.f; | 5103 return 0.f; |
5074 float frame_scale = 0.f; | 5104 float frame_scale = 0.f; |
5075 RenderPass* root_pass = frame_data->render_passes.back().get(); | 5105 RenderPass* root_pass = frame_data->render_passes.back().get(); |
5076 for (const auto& draw_quad : root_pass->quad_list) { | 5106 for (const auto& draw_quad : root_pass->quad_list) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5243 | 5273 |
5244 void InitializeSettings(LayerTreeSettings* settings) override { | 5274 void InitializeSettings(LayerTreeSettings* settings) override { |
5245 settings->gpu_rasterization_forced = true; | 5275 settings->gpu_rasterization_forced = true; |
5246 } | 5276 } |
5247 | 5277 |
5248 void SetupTree() override { | 5278 void SetupTree() override { |
5249 client_.set_fill_with_nonsolid_color(true); | 5279 client_.set_fill_with_nonsolid_color(true); |
5250 | 5280 |
5251 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5281 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
5252 root->SetBounds(gfx::Size(500, 500)); | 5282 root->SetBounds(gfx::Size(500, 500)); |
| 5283 client_.set_bounds(root->bounds()); |
5253 | 5284 |
5254 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5285 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5255 new FakeDisplayListRecordingSource); | 5286 new FakeDisplayListRecordingSource); |
5256 scoped_refptr<FakePictureLayer> layer = | 5287 scoped_refptr<FakePictureLayer> layer = |
5257 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5288 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
5258 std::move(recording)); | 5289 std::move(recording)); |
5259 layer->SetBounds(gfx::Size(500, 500)); | 5290 layer->SetBounds(gfx::Size(500, 500)); |
5260 layer->SetContentsOpaque(true); | 5291 layer->SetContentsOpaque(true); |
5261 root->AddChild(layer); | 5292 root->AddChild(layer); |
5262 | 5293 |
5263 layer_tree_host()->SetRootLayer(root); | 5294 layer_tree_host()->SetRootLayer(root); |
5264 LayerTreeHostTest::SetupTree(); | 5295 LayerTreeHostTest::SetupTree(); |
| 5296 client_.set_bounds(root->bounds()); |
5265 } | 5297 } |
5266 | 5298 |
5267 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5299 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5268 | 5300 |
5269 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5301 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5270 LayerTreeHostImpl::FrameData* frame_data, | 5302 LayerTreeHostImpl::FrameData* frame_data, |
5271 DrawResult draw_result) override { | 5303 DrawResult draw_result) override { |
5272 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); | 5304 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); |
5273 EndTest(); | 5305 EndTest(); |
5274 return draw_result; | 5306 return draw_result; |
(...skipping 16 matching lines...) Expand all Loading... |
5291 | 5323 |
5292 void SetupTree() override { | 5324 void SetupTree() override { |
5293 client_.set_fill_with_nonsolid_color(true); | 5325 client_.set_fill_with_nonsolid_color(true); |
5294 | 5326 |
5295 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5327 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5296 new FakeDisplayListRecordingSource); | 5328 new FakeDisplayListRecordingSource); |
5297 scoped_refptr<FakePictureLayer> root = | 5329 scoped_refptr<FakePictureLayer> root = |
5298 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5330 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
5299 std::move(recording)); | 5331 std::move(recording)); |
5300 root->SetBounds(gfx::Size(10000, 10000)); | 5332 root->SetBounds(gfx::Size(10000, 10000)); |
| 5333 client_.set_bounds(root->bounds()); |
5301 root->SetContentsOpaque(true); | 5334 root->SetContentsOpaque(true); |
5302 | 5335 |
5303 layer_tree_host()->SetRootLayer(root); | 5336 layer_tree_host()->SetRootLayer(root); |
5304 LayerTreeHostTest::SetupTree(); | 5337 LayerTreeHostTest::SetupTree(); |
5305 layer_tree_host()->SetViewportSize(viewport_size_); | 5338 layer_tree_host()->SetViewportSize(viewport_size_); |
| 5339 client_.set_bounds(root->bounds()); |
5306 } | 5340 } |
5307 | 5341 |
5308 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5342 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5309 | 5343 |
5310 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5344 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5311 LayerTreeHostImpl::FrameData* frame_data, | 5345 LayerTreeHostImpl::FrameData* frame_data, |
5312 DrawResult draw_result) override { | 5346 DrawResult draw_result) override { |
5313 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); | 5347 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); |
5314 EndTest(); | 5348 EndTest(); |
5315 return draw_result; | 5349 return draw_result; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5353 layer->SetBounds(gfx::Size(500, 500)); | 5387 layer->SetBounds(gfx::Size(500, 500)); |
5354 layer->SetContentsOpaque(true); | 5388 layer->SetContentsOpaque(true); |
5355 // Avoid LCD text on the layer so we don't cause extra commits when we | 5389 // Avoid LCD text on the layer so we don't cause extra commits when we |
5356 // pinch. | 5390 // pinch. |
5357 pinch->AddChild(layer); | 5391 pinch->AddChild(layer); |
5358 | 5392 |
5359 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); | 5393 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); |
5360 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5394 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
5361 layer_tree_host()->SetRootLayer(root); | 5395 layer_tree_host()->SetRootLayer(root); |
5362 LayerTreeHostTest::SetupTree(); | 5396 LayerTreeHostTest::SetupTree(); |
| 5397 client_.set_bounds(root->bounds()); |
5363 } | 5398 } |
5364 | 5399 |
5365 // Returns the delta scale of all quads in the frame's root pass from their | 5400 // Returns the delta scale of all quads in the frame's root pass from their |
5366 // ideal, or 0 if they are not all the same. | 5401 // ideal, or 0 if they are not all the same. |
5367 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { | 5402 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { |
5368 if (frame_data->has_no_damage) | 5403 if (frame_data->has_no_damage) |
5369 return 0.f; | 5404 return 0.f; |
5370 float frame_scale = 0.f; | 5405 float frame_scale = 0.f; |
5371 RenderPass* root_pass = frame_data->render_passes.back().get(); | 5406 RenderPass* root_pass = frame_data->render_passes.back().get(); |
5372 for (const auto& draw_quad : root_pass->quad_list) { | 5407 for (const auto& draw_quad : root_pass->quad_list) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5506 | 5541 |
5507 void SetupTree() override { | 5542 void SetupTree() override { |
5508 client_.set_fill_with_nonsolid_color(true); | 5543 client_.set_fill_with_nonsolid_color(true); |
5509 scoped_refptr<FakePictureLayer> root_layer = | 5544 scoped_refptr<FakePictureLayer> root_layer = |
5510 FakePictureLayer::Create(layer_settings(), &client_); | 5545 FakePictureLayer::Create(layer_settings(), &client_); |
5511 root_layer->SetBounds(gfx::Size(1500, 1500)); | 5546 root_layer->SetBounds(gfx::Size(1500, 1500)); |
5512 root_layer->SetIsDrawable(true); | 5547 root_layer->SetIsDrawable(true); |
5513 | 5548 |
5514 layer_tree_host()->SetRootLayer(root_layer); | 5549 layer_tree_host()->SetRootLayer(root_layer); |
5515 LayerTreeHostTest::SetupTree(); | 5550 LayerTreeHostTest::SetupTree(); |
| 5551 client_.set_bounds(root_layer->bounds()); |
5516 } | 5552 } |
5517 | 5553 |
5518 void BeginTest() override { | 5554 void BeginTest() override { |
5519 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); | 5555 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); |
5520 PostSetNeedsCommitToMainThread(); | 5556 PostSetNeedsCommitToMainThread(); |
5521 } | 5557 } |
5522 | 5558 |
5523 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 5559 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
5524 bool success) override { | 5560 bool success) override { |
5525 ASSERT_TRUE(success); | 5561 ASSERT_TRUE(success); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5572 child_layer->SetIsDrawable(true); | 5608 child_layer->SetIsDrawable(true); |
5573 | 5609 |
5574 std::vector<FrameTimingRequest> requests; | 5610 std::vector<FrameTimingRequest> requests; |
5575 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); | 5611 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); |
5576 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); | 5612 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); |
5577 child_layer->SetFrameTimingRequests(requests); | 5613 child_layer->SetFrameTimingRequests(requests); |
5578 | 5614 |
5579 root_layer->AddChild(child_layer); | 5615 root_layer->AddChild(child_layer); |
5580 layer_tree_host()->SetRootLayer(root_layer); | 5616 layer_tree_host()->SetRootLayer(root_layer); |
5581 LayerTreeHostTest::SetupTree(); | 5617 LayerTreeHostTest::SetupTree(); |
| 5618 client_.set_bounds(root_layer->bounds()); |
5582 } | 5619 } |
5583 | 5620 |
5584 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5621 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5585 | 5622 |
5586 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 5623 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
5587 if (!check_results_on_commit_) | 5624 if (!check_results_on_commit_) |
5588 return; | 5625 return; |
5589 | 5626 |
5590 // Since in reality, the events will be read by LayerTreeHost during commit, | 5627 // Since in reality, the events will be read by LayerTreeHost during commit, |
5591 // we check the requests here to ensure that they are correct at the next | 5628 // we check the requests here to ensure that they are correct at the next |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5648 | 5685 |
5649 void SetupTree() override { | 5686 void SetupTree() override { |
5650 client_.set_fill_with_nonsolid_color(true); | 5687 client_.set_fill_with_nonsolid_color(true); |
5651 scoped_refptr<FakePictureLayer> root_layer = | 5688 scoped_refptr<FakePictureLayer> root_layer = |
5652 FakePictureLayer::Create(layer_settings(), &client_); | 5689 FakePictureLayer::Create(layer_settings(), &client_); |
5653 root_layer->SetBounds(gfx::Size(150, 150)); | 5690 root_layer->SetBounds(gfx::Size(150, 150)); |
5654 root_layer->SetIsDrawable(true); | 5691 root_layer->SetIsDrawable(true); |
5655 | 5692 |
5656 layer_tree_host()->SetRootLayer(root_layer); | 5693 layer_tree_host()->SetRootLayer(root_layer); |
5657 LayerTreeHostTest::SetupTree(); | 5694 LayerTreeHostTest::SetupTree(); |
| 5695 client_.set_bounds(root_layer->bounds()); |
5658 } | 5696 } |
5659 | 5697 |
5660 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5698 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5661 | 5699 |
5662 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | 5700 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
5663 // Ensure we've already activated. | 5701 // Ensure we've already activated. |
5664 EXPECT_FALSE(impl->pending_tree()); | 5702 EXPECT_FALSE(impl->pending_tree()); |
5665 | 5703 |
5666 // After activating, we either need to prepare tiles, or we've already | 5704 // After activating, we either need to prepare tiles, or we've already |
5667 // called a scheduled prepare tiles. This is done because activation might | 5705 // called a scheduled prepare tiles. This is done because activation might |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5802 gfx::Size child_size(50, 50); | 5840 gfx::Size child_size(50, 50); |
5803 content_child_layer->SetBounds(child_size); | 5841 content_child_layer->SetBounds(child_size); |
5804 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); | 5842 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); |
5805 | 5843 |
5806 gfx::Size mask_size(100, 100); | 5844 gfx::Size mask_size(100, 100); |
5807 mask_layer->SetBounds(mask_size); | 5845 mask_layer->SetBounds(mask_size); |
5808 mask_layer->SetIsMask(true); | 5846 mask_layer->SetIsMask(true); |
5809 | 5847 |
5810 layer_tree_host()->SetRootLayer(root); | 5848 layer_tree_host()->SetRootLayer(root); |
5811 LayerTreeTest::SetupTree(); | 5849 LayerTreeTest::SetupTree(); |
| 5850 client_.set_bounds(root->bounds()); |
5812 } | 5851 } |
5813 | 5852 |
5814 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5853 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5815 | 5854 |
5816 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5855 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5817 LayerTreeHostImpl::FrameData* frame_data, | 5856 LayerTreeHostImpl::FrameData* frame_data, |
5818 DrawResult draw_result) override { | 5857 DrawResult draw_result) override { |
5819 EXPECT_EQ(2u, frame_data->render_passes.size()); | 5858 EXPECT_EQ(2u, frame_data->render_passes.size()); |
5820 RenderPass* root_pass = frame_data->render_passes.back().get(); | 5859 RenderPass* root_pass = frame_data->render_passes.back().get(); |
5821 EXPECT_EQ(2u, root_pass->quad_list.size()); | 5860 EXPECT_EQ(2u, root_pass->quad_list.size()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5886 scale.Scale(2.f, 2.f); | 5925 scale.Scale(2.f, 2.f); |
5887 scaling_layer->SetTransform(scale); | 5926 scaling_layer->SetTransform(scale); |
5888 | 5927 |
5889 content_layer->SetBounds(scaling_layer_size); | 5928 content_layer->SetBounds(scaling_layer_size); |
5890 | 5929 |
5891 mask_layer->SetBounds(scaling_layer_size); | 5930 mask_layer->SetBounds(scaling_layer_size); |
5892 mask_layer->SetIsMask(true); | 5931 mask_layer->SetIsMask(true); |
5893 | 5932 |
5894 layer_tree_host()->SetRootLayer(root); | 5933 layer_tree_host()->SetRootLayer(root); |
5895 LayerTreeTest::SetupTree(); | 5934 LayerTreeTest::SetupTree(); |
| 5935 client_.set_bounds(root->bounds()); |
5896 } | 5936 } |
5897 | 5937 |
5898 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5938 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5899 | 5939 |
5900 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 5940 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5901 LayerTreeHostImpl::FrameData* frame_data, | 5941 LayerTreeHostImpl::FrameData* frame_data, |
5902 DrawResult draw_result) override { | 5942 DrawResult draw_result) override { |
5903 EXPECT_EQ(2u, frame_data->render_passes.size()); | 5943 EXPECT_EQ(2u, frame_data->render_passes.size()); |
5904 RenderPass* root_pass = frame_data->render_passes.back().get(); | 5944 RenderPass* root_pass = frame_data->render_passes.back().get(); |
5905 EXPECT_EQ(2u, root_pass->quad_list.size()); | 5945 EXPECT_EQ(2u, root_pass->quad_list.size()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5974 | 6014 |
5975 gfx::Size layer_size(50, 50); | 6015 gfx::Size layer_size(50, 50); |
5976 content_layer->SetBounds(layer_size); | 6016 content_layer->SetBounds(layer_size); |
5977 | 6017 |
5978 gfx::Size mask_size(100, 100); | 6018 gfx::Size mask_size(100, 100); |
5979 mask_layer->SetBounds(mask_size); | 6019 mask_layer->SetBounds(mask_size); |
5980 mask_layer->SetIsMask(true); | 6020 mask_layer->SetIsMask(true); |
5981 | 6021 |
5982 layer_tree_host()->SetRootLayer(root); | 6022 layer_tree_host()->SetRootLayer(root); |
5983 LayerTreeTest::SetupTree(); | 6023 LayerTreeTest::SetupTree(); |
| 6024 client_.set_bounds(root->bounds()); |
5984 } | 6025 } |
5985 | 6026 |
5986 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6027 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5987 | 6028 |
5988 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6029 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
5989 LayerTreeHostImpl::FrameData* frame_data, | 6030 LayerTreeHostImpl::FrameData* frame_data, |
5990 DrawResult draw_result) override { | 6031 DrawResult draw_result) override { |
5991 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6032 EXPECT_EQ(2u, frame_data->render_passes.size()); |
5992 RenderPass* root_pass = frame_data->render_passes.back().get(); | 6033 RenderPass* root_pass = frame_data->render_passes.back().get(); |
5993 EXPECT_EQ(2u, root_pass->quad_list.size()); | 6034 EXPECT_EQ(2u, root_pass->quad_list.size()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6065 | 6106 |
6066 gfx::Size layer_size(50, 50); | 6107 gfx::Size layer_size(50, 50); |
6067 content_layer->SetBounds(layer_size); | 6108 content_layer->SetBounds(layer_size); |
6068 | 6109 |
6069 gfx::Size mask_size(100, 100); | 6110 gfx::Size mask_size(100, 100); |
6070 mask_layer->SetBounds(mask_size); | 6111 mask_layer->SetBounds(mask_size); |
6071 mask_layer->SetIsMask(true); | 6112 mask_layer->SetIsMask(true); |
6072 | 6113 |
6073 layer_tree_host()->SetRootLayer(root); | 6114 layer_tree_host()->SetRootLayer(root); |
6074 LayerTreeTest::SetupTree(); | 6115 LayerTreeTest::SetupTree(); |
| 6116 client_.set_bounds(root->bounds()); |
6075 } | 6117 } |
6076 | 6118 |
6077 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6119 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6078 | 6120 |
6079 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6121 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6080 LayerTreeHostImpl::FrameData* frame_data, | 6122 LayerTreeHostImpl::FrameData* frame_data, |
6081 DrawResult draw_result) override { | 6123 DrawResult draw_result) override { |
6082 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6124 EXPECT_EQ(2u, frame_data->render_passes.size()); |
6083 RenderPass* root_pass = frame_data->render_passes.back().get(); | 6125 RenderPass* root_pass = frame_data->render_passes.back().get(); |
6084 EXPECT_EQ(3u, root_pass->quad_list.size()); | 6126 EXPECT_EQ(3u, root_pass->quad_list.size()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6163 content_layer->SetBounds(layer_size); | 6205 content_layer->SetBounds(layer_size); |
6164 content_child_layer_->SetBounds(layer_size); | 6206 content_child_layer_->SetBounds(layer_size); |
6165 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); | 6207 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); |
6166 | 6208 |
6167 gfx::Size mask_size(100, 100); | 6209 gfx::Size mask_size(100, 100); |
6168 mask_layer->SetBounds(mask_size); | 6210 mask_layer->SetBounds(mask_size); |
6169 mask_layer->SetIsMask(true); | 6211 mask_layer->SetIsMask(true); |
6170 | 6212 |
6171 layer_tree_host()->SetRootLayer(root); | 6213 layer_tree_host()->SetRootLayer(root); |
6172 LayerTreeTest::SetupTree(); | 6214 LayerTreeTest::SetupTree(); |
| 6215 client_.set_bounds(root->bounds()); |
6173 } | 6216 } |
6174 | 6217 |
6175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 6218 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
6176 | 6219 |
6177 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 6220 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
6178 LayerTreeHostImpl::FrameData* frame_data, | 6221 LayerTreeHostImpl::FrameData* frame_data, |
6179 DrawResult draw_result) override { | 6222 DrawResult draw_result) override { |
6180 EXPECT_EQ(2u, frame_data->render_passes.size()); | 6223 EXPECT_EQ(2u, frame_data->render_passes.size()); |
6181 RenderPass* root_pass = frame_data->render_passes.back().get(); | 6224 RenderPass* root_pass = frame_data->render_passes.back().get(); |
6182 EXPECT_EQ(3u, root_pass->quad_list.size()); | 6225 EXPECT_EQ(3u, root_pass->quad_list.size()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6405 EndTest(); | 6448 EndTest(); |
6406 } | 6449 } |
6407 | 6450 |
6408 void AfterTest() override {} | 6451 void AfterTest() override {} |
6409 }; | 6452 }; |
6410 | 6453 |
6411 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6454 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
6412 | 6455 |
6413 } // namespace | 6456 } // namespace |
6414 } // namespace cc | 6457 } // namespace cc |
OLD | NEW |