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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateEmpty); | 253 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateEmpty); |
254 | 254 |
255 // Test if the LTHI receives ReadyToActivate notifications from the TileManager | 255 // Test if the LTHI receives ReadyToActivate notifications from the TileManager |
256 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled. | 256 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled. |
257 class LayerTreeHostTestReadyToActivateNonEmpty | 257 class LayerTreeHostTestReadyToActivateNonEmpty |
258 : public LayerTreeHostTestReadyToActivateEmpty { | 258 : public LayerTreeHostTestReadyToActivateEmpty { |
259 public: | 259 public: |
260 void SetupTree() override { | 260 void SetupTree() override { |
261 client_.set_fill_with_nonsolid_color(true); | 261 client_.set_fill_with_nonsolid_color(true); |
262 scoped_refptr<FakePictureLayer> root_layer = | 262 scoped_refptr<FakePictureLayer> root_layer = |
263 FakePictureLayer::Create(layer_settings(), &client_); | 263 FakePictureLayer::Create(&client_); |
264 root_layer->SetBounds(gfx::Size(1024, 1024)); | 264 root_layer->SetBounds(gfx::Size(1024, 1024)); |
265 root_layer->SetIsDrawable(true); | 265 root_layer->SetIsDrawable(true); |
266 | 266 |
267 layer_tree_host()->SetRootLayer(root_layer); | 267 layer_tree_host()->SetRootLayer(root_layer); |
268 LayerTreeHostTest::SetupTree(); | 268 LayerTreeHostTest::SetupTree(); |
269 client_.set_bounds(root_layer->bounds()); | 269 client_.set_bounds(root_layer->bounds()); |
270 } | 270 } |
271 | 271 |
272 void AfterTest() override { | 272 void AfterTest() override { |
273 EXPECT_TRUE(did_notify_ready_to_activate_); | 273 EXPECT_TRUE(did_notify_ready_to_activate_); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToDrawEmpty); | 324 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToDrawEmpty); |
325 | 325 |
326 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when | 326 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when |
327 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled. | 327 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled. |
328 class LayerTreeHostTestReadyToDrawNonEmpty | 328 class LayerTreeHostTestReadyToDrawNonEmpty |
329 : public LayerTreeHostTestReadyToDrawEmpty { | 329 : public LayerTreeHostTestReadyToDrawEmpty { |
330 public: | 330 public: |
331 void SetupTree() override { | 331 void SetupTree() override { |
332 client_.set_fill_with_nonsolid_color(true); | 332 client_.set_fill_with_nonsolid_color(true); |
333 scoped_refptr<FakePictureLayer> root_layer = | 333 scoped_refptr<FakePictureLayer> root_layer = |
334 FakePictureLayer::Create(layer_settings(), &client_); | 334 FakePictureLayer::Create(&client_); |
335 root_layer->SetBounds(gfx::Size(1024, 1024)); | 335 root_layer->SetBounds(gfx::Size(1024, 1024)); |
336 root_layer->SetIsDrawable(true); | 336 root_layer->SetIsDrawable(true); |
337 | 337 |
338 layer_tree_host()->SetRootLayer(root_layer); | 338 layer_tree_host()->SetRootLayer(root_layer); |
339 LayerTreeHostTest::SetupTree(); | 339 LayerTreeHostTest::SetupTree(); |
340 client_.set_bounds(root_layer->bounds()); | 340 client_.set_bounds(root_layer->bounds()); |
341 } | 341 } |
342 | 342 |
343 void AfterTest() override { | 343 void AfterTest() override { |
344 EXPECT_TRUE(did_notify_ready_to_draw_); | 344 EXPECT_TRUE(did_notify_ready_to_draw_); |
(...skipping 17 matching lines...) Expand all Loading... |
362 : LayerTreeHostTest(), | 362 : LayerTreeHostTest(), |
363 toggled_visibility_(false), | 363 toggled_visibility_(false), |
364 did_notify_ready_to_draw_(false), | 364 did_notify_ready_to_draw_(false), |
365 did_draw_(false) {} | 365 did_draw_(false) {} |
366 | 366 |
367 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 367 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
368 | 368 |
369 void SetupTree() override { | 369 void SetupTree() override { |
370 client_.set_fill_with_nonsolid_color(true); | 370 client_.set_fill_with_nonsolid_color(true); |
371 scoped_refptr<FakePictureLayer> root_layer = | 371 scoped_refptr<FakePictureLayer> root_layer = |
372 FakePictureLayer::Create(layer_settings(), &client_); | 372 FakePictureLayer::Create(&client_); |
373 root_layer->SetBounds(gfx::Size(1024, 1024)); | 373 root_layer->SetBounds(gfx::Size(1024, 1024)); |
374 client_.set_bounds(root_layer->bounds()); | 374 client_.set_bounds(root_layer->bounds()); |
375 root_layer->SetIsDrawable(true); | 375 root_layer->SetIsDrawable(true); |
376 | 376 |
377 layer_tree_host()->SetRootLayer(root_layer); | 377 layer_tree_host()->SetRootLayer(root_layer); |
378 LayerTreeHostTest::SetupTree(); | 378 LayerTreeHostTest::SetupTree(); |
379 } | 379 } |
380 | 380 |
381 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 381 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
382 if (!toggled_visibility_) { | 382 if (!toggled_visibility_) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 int num_commits_; | 591 int num_commits_; |
592 int num_draws_; | 592 int num_draws_; |
593 }; | 593 }; |
594 | 594 |
595 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); | 595 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); |
596 | 596 |
597 // Verify that we pass property values in PushPropertiesTo. | 597 // Verify that we pass property values in PushPropertiesTo. |
598 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { | 598 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { |
599 protected: | 599 protected: |
600 void SetupTree() override { | 600 void SetupTree() override { |
601 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 601 scoped_refptr<Layer> root = Layer::Create(); |
602 root->SetBounds(gfx::Size(10, 10)); | 602 root->SetBounds(gfx::Size(10, 10)); |
603 layer_tree_host()->SetRootLayer(root); | 603 layer_tree_host()->SetRootLayer(root); |
604 LayerTreeHostTest::SetupTree(); | 604 LayerTreeHostTest::SetupTree(); |
605 } | 605 } |
606 | 606 |
607 enum Properties { | 607 enum Properties { |
608 STARTUP, | 608 STARTUP, |
609 BOUNDS, | 609 BOUNDS, |
610 HIDE_LAYER_AND_SUBTREE, | 610 HIDE_LAYER_AND_SUBTREE, |
611 DRAWS_CONTENT, | 611 DRAWS_CONTENT, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 684 |
685 int index_; | 685 int index_; |
686 }; | 686 }; |
687 | 687 |
688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
689 | 689 |
690 // Verify damage status of property trees is preserved after commit. | 690 // Verify damage status of property trees is preserved after commit. |
691 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 691 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
692 protected: | 692 protected: |
693 void SetupTree() override { | 693 void SetupTree() override { |
694 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 694 scoped_refptr<Layer> root = Layer::Create(); |
695 layer_tree_host()->SetRootLayer(root); | 695 layer_tree_host()->SetRootLayer(root); |
696 LayerTreeHostTest::SetupTree(); | 696 LayerTreeHostTest::SetupTree(); |
697 } | 697 } |
698 | 698 |
699 enum Animations { | 699 enum Animations { |
700 OPACITY, | 700 OPACITY, |
701 TRANSFORM, | 701 TRANSFORM, |
702 FILTER, | 702 FILTER, |
703 END, | 703 END, |
704 }; | 704 }; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); | 792 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); |
793 | 793 |
794 // After setNeedsRedrawRect(invalid_rect) the final damage_rect | 794 // After setNeedsRedrawRect(invalid_rect) the final damage_rect |
795 // must contain invalid_rect. | 795 // must contain invalid_rect. |
796 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { | 796 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { |
797 public: | 797 public: |
798 LayerTreeHostTestSetNeedsRedrawRect() | 798 LayerTreeHostTestSetNeedsRedrawRect() |
799 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 799 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
800 | 800 |
801 void BeginTest() override { | 801 void BeginTest() override { |
802 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 802 root_layer_ = FakePictureLayer::Create(&client_); |
803 root_layer_->SetIsDrawable(true); | 803 root_layer_->SetIsDrawable(true); |
804 root_layer_->SetBounds(bounds_); | 804 root_layer_->SetBounds(bounds_); |
805 layer_tree_host()->SetRootLayer(root_layer_); | 805 layer_tree_host()->SetRootLayer(root_layer_); |
806 layer_tree_host()->SetViewportSize(bounds_); | 806 layer_tree_host()->SetViewportSize(bounds_); |
807 PostSetNeedsCommitToMainThread(); | 807 PostSetNeedsCommitToMainThread(); |
808 client_.set_bounds(root_layer_->bounds()); | 808 client_.set_bounds(root_layer_->bounds()); |
809 } | 809 } |
810 | 810 |
811 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 811 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
812 LayerTreeHostImpl::FrameData* frame_data, | 812 LayerTreeHostImpl::FrameData* frame_data, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 | 851 |
852 // Ensure the texture size of the pending and active trees are identical when a | 852 // Ensure the texture size of the pending and active trees are identical when a |
853 // layer is not in the viewport and a resize happens on the viewport | 853 // layer is not in the viewport and a resize happens on the viewport |
854 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { | 854 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { |
855 public: | 855 public: |
856 LayerTreeHostTestGpuRasterDeviceSizeChanged() | 856 LayerTreeHostTestGpuRasterDeviceSizeChanged() |
857 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} | 857 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} |
858 | 858 |
859 void BeginTest() override { | 859 void BeginTest() override { |
860 client_.set_fill_with_nonsolid_color(true); | 860 client_.set_fill_with_nonsolid_color(true); |
861 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 861 root_layer_ = FakePictureLayer::Create(&client_); |
862 root_layer_->SetIsDrawable(true); | 862 root_layer_->SetIsDrawable(true); |
863 gfx::Transform transform; | 863 gfx::Transform transform; |
864 // Translate the layer out of the viewport to force it to not update its | 864 // Translate the layer out of the viewport to force it to not update its |
865 // tile size via PushProperties. | 865 // tile size via PushProperties. |
866 transform.Translate(10000.0, 10000.0); | 866 transform.Translate(10000.0, 10000.0); |
867 root_layer_->SetTransform(transform); | 867 root_layer_->SetTransform(transform); |
868 root_layer_->SetBounds(bounds_); | 868 root_layer_->SetBounds(bounds_); |
869 layer_tree_host()->SetRootLayer(root_layer_); | 869 layer_tree_host()->SetRootLayer(root_layer_); |
870 layer_tree_host()->SetViewportSize(bounds_); | 870 layer_tree_host()->SetViewportSize(bounds_); |
871 | 871 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 | 929 |
930 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); | 930 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); |
931 | 931 |
932 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { | 932 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { |
933 public: | 933 public: |
934 void InitializeSettings(LayerTreeSettings* settings) override { | 934 void InitializeSettings(LayerTreeSettings* settings) override { |
935 settings->layer_transforms_should_scale_layer_contents = true; | 935 settings->layer_transforms_should_scale_layer_contents = true; |
936 } | 936 } |
937 | 937 |
938 void SetupTree() override { | 938 void SetupTree() override { |
939 root_layer_ = Layer::Create(layer_settings()); | 939 root_layer_ = Layer::Create(); |
940 root_layer_->SetBounds(gfx::Size(10, 20)); | 940 root_layer_->SetBounds(gfx::Size(10, 20)); |
941 | 941 |
942 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 942 scaled_layer_ = FakePictureLayer::Create(&client_); |
943 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 943 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
944 root_layer_->AddChild(scaled_layer_); | 944 root_layer_->AddChild(scaled_layer_); |
945 | 945 |
946 layer_tree_host()->SetRootLayer(root_layer_); | 946 layer_tree_host()->SetRootLayer(root_layer_); |
947 LayerTreeHostTest::SetupTree(); | 947 LayerTreeHostTest::SetupTree(); |
948 client_.set_bounds(root_layer_->bounds()); | 948 client_.set_bounds(root_layer_->bounds()); |
949 } | 949 } |
950 | 950 |
951 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 951 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
952 | 952 |
(...skipping 27 matching lines...) Expand all Loading... |
980 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); | 980 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); |
981 | 981 |
982 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate | 982 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate |
983 : public LayerTreeHostTest { | 983 : public LayerTreeHostTest { |
984 public: | 984 public: |
985 void InitializeSettings(LayerTreeSettings* settings) override { | 985 void InitializeSettings(LayerTreeSettings* settings) override { |
986 settings->layer_transforms_should_scale_layer_contents = true; | 986 settings->layer_transforms_should_scale_layer_contents = true; |
987 } | 987 } |
988 | 988 |
989 void SetupTree() override { | 989 void SetupTree() override { |
990 root_layer_ = Layer::Create(layer_settings()); | 990 root_layer_ = Layer::Create(); |
991 root_layer_->SetBounds(gfx::Size(10, 20)); | 991 root_layer_->SetBounds(gfx::Size(10, 20)); |
992 | 992 |
993 bool paint_scrollbar = true; | 993 bool paint_scrollbar = true; |
994 bool has_thumb = false; | 994 bool has_thumb = false; |
995 scrollbar_ = FakePaintedScrollbarLayer::Create( | 995 scrollbar_ = FakePaintedScrollbarLayer::Create(paint_scrollbar, has_thumb, |
996 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); | 996 root_layer_->id()); |
997 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); | 997 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); |
998 scrollbar_->SetBounds(gfx::Size(10, 10)); | 998 scrollbar_->SetBounds(gfx::Size(10, 10)); |
999 | 999 |
1000 root_layer_->AddChild(scrollbar_); | 1000 root_layer_->AddChild(scrollbar_); |
1001 | 1001 |
1002 layer_tree_host()->SetRootLayer(root_layer_); | 1002 layer_tree_host()->SetRootLayer(root_layer_); |
1003 LayerTreeHostTest::SetupTree(); | 1003 LayerTreeHostTest::SetupTree(); |
1004 client_.set_bounds(root_layer_->bounds()); | 1004 client_.set_bounds(root_layer_->bounds()); |
1005 } | 1005 } |
1006 | 1006 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 SINGLE_AND_MULTI_THREAD_TEST_F( | 1038 SINGLE_AND_MULTI_THREAD_TEST_F( |
1039 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); | 1039 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); |
1040 | 1040 |
1041 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest { | 1041 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest { |
1042 public: | 1042 public: |
1043 void InitializeSettings(LayerTreeSettings* settings) override { | 1043 void InitializeSettings(LayerTreeSettings* settings) override { |
1044 settings->layer_transforms_should_scale_layer_contents = true; | 1044 settings->layer_transforms_should_scale_layer_contents = true; |
1045 } | 1045 } |
1046 | 1046 |
1047 void SetupTree() override { | 1047 void SetupTree() override { |
1048 root_layer_ = Layer::Create(layer_settings()); | 1048 root_layer_ = Layer::Create(); |
1049 root_layer_->SetBounds(gfx::Size(10, 20)); | 1049 root_layer_->SetBounds(gfx::Size(10, 20)); |
1050 | 1050 |
1051 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1051 child_layer_ = FakePictureLayer::Create(&client_); |
1052 child_layer_->SetBounds(gfx::Size(10, 10)); | 1052 child_layer_->SetBounds(gfx::Size(10, 10)); |
1053 root_layer_->AddChild(child_layer_); | 1053 root_layer_->AddChild(child_layer_); |
1054 | 1054 |
1055 layer_tree_host()->SetRootLayer(root_layer_); | 1055 layer_tree_host()->SetRootLayer(root_layer_); |
1056 LayerTreeHostTest::SetupTree(); | 1056 LayerTreeHostTest::SetupTree(); |
1057 client_.set_bounds(root_layer_->bounds()); | 1057 client_.set_bounds(root_layer_->bounds()); |
1058 } | 1058 } |
1059 | 1059 |
1060 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1060 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1061 | 1061 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 }; | 1101 }; |
1102 | 1102 |
1103 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); | 1103 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); |
1104 | 1104 |
1105 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 1105 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
1106 public: | 1106 public: |
1107 LayerTreeHostTestSetNextCommitForcesRedraw() | 1107 LayerTreeHostTestSetNextCommitForcesRedraw() |
1108 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1108 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
1109 | 1109 |
1110 void BeginTest() override { | 1110 void BeginTest() override { |
1111 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1111 root_layer_ = FakePictureLayer::Create(&client_); |
1112 root_layer_->SetIsDrawable(true); | 1112 root_layer_->SetIsDrawable(true); |
1113 root_layer_->SetBounds(bounds_); | 1113 root_layer_->SetBounds(bounds_); |
1114 layer_tree_host()->SetRootLayer(root_layer_); | 1114 layer_tree_host()->SetRootLayer(root_layer_); |
1115 layer_tree_host()->SetViewportSize(bounds_); | 1115 layer_tree_host()->SetViewportSize(bounds_); |
1116 PostSetNeedsCommitToMainThread(); | 1116 PostSetNeedsCommitToMainThread(); |
1117 client_.set_bounds(root_layer_->bounds()); | 1117 client_.set_bounds(root_layer_->bounds()); |
1118 } | 1118 } |
1119 | 1119 |
1120 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1120 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1121 if (num_draws_ == 3) | 1121 if (num_draws_ == 3) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { | 1194 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { |
1195 public: | 1195 public: |
1196 void InitializeSettings(LayerTreeSettings* settings) override { | 1196 void InitializeSettings(LayerTreeSettings* settings) override { |
1197 // If we don't set the minimum contents scale, it's harder to verify whether | 1197 // If we don't set the minimum contents scale, it's harder to verify whether |
1198 // the damage we get is correct. For other scale amounts, please see | 1198 // the damage we get is correct. For other scale amounts, please see |
1199 // LayerTreeHostTestDamageWithScale. | 1199 // LayerTreeHostTestDamageWithScale. |
1200 settings->minimum_contents_scale = 1.f; | 1200 settings->minimum_contents_scale = 1.f; |
1201 } | 1201 } |
1202 | 1202 |
1203 void SetupTree() override { | 1203 void SetupTree() override { |
1204 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1204 root_layer_ = FakePictureLayer::Create(&client_); |
1205 root_layer_->SetIsDrawable(true); | 1205 root_layer_->SetIsDrawable(true); |
1206 root_layer_->SetBounds(gfx::Size(50, 50)); | 1206 root_layer_->SetBounds(gfx::Size(50, 50)); |
1207 layer_tree_host()->SetRootLayer(root_layer_); | 1207 layer_tree_host()->SetRootLayer(root_layer_); |
1208 | 1208 |
1209 // The initially transparent layer has a larger child layer, which is | 1209 // The initially transparent layer has a larger child layer, which is |
1210 // not initially drawn because of the this (parent) layer. | 1210 // not initially drawn because of the this (parent) layer. |
1211 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1211 parent_layer_ = FakePictureLayer::Create(&client_); |
1212 parent_layer_->SetBounds(gfx::Size(15, 15)); | 1212 parent_layer_->SetBounds(gfx::Size(15, 15)); |
1213 parent_layer_->SetOpacity(0.0f); | 1213 parent_layer_->SetOpacity(0.0f); |
1214 root_layer_->AddChild(parent_layer_); | 1214 root_layer_->AddChild(parent_layer_); |
1215 | 1215 |
1216 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1216 child_layer_ = FakePictureLayer::Create(&client_); |
1217 child_layer_->SetBounds(gfx::Size(25, 25)); | 1217 child_layer_->SetBounds(gfx::Size(25, 25)); |
1218 parent_layer_->AddChild(child_layer_); | 1218 parent_layer_->AddChild(child_layer_); |
1219 client_.set_bounds(root_layer_->bounds()); | 1219 client_.set_bounds(root_layer_->bounds()); |
1220 | 1220 |
1221 LayerTreeHostTest::SetupTree(); | 1221 LayerTreeHostTest::SetupTree(); |
1222 } | 1222 } |
1223 | 1223 |
1224 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1224 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1225 | 1225 |
1226 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1226 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { | 1291 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { |
1292 public: | 1292 public: |
1293 LayerTreeHostTestDamageWithScale() {} | 1293 LayerTreeHostTestDamageWithScale() {} |
1294 | 1294 |
1295 void SetupTree() override { | 1295 void SetupTree() override { |
1296 client_.set_fill_with_nonsolid_color(true); | 1296 client_.set_fill_with_nonsolid_color(true); |
1297 | 1297 |
1298 scoped_ptr<FakeDisplayListRecordingSource> recording( | 1298 scoped_ptr<FakeDisplayListRecordingSource> recording( |
1299 new FakeDisplayListRecordingSource); | 1299 new FakeDisplayListRecordingSource); |
1300 root_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1300 root_layer_ = FakePictureLayer::CreateWithRecordingSource( |
1301 layer_settings(), &client_, std::move(recording)); | 1301 &client_, std::move(recording)); |
1302 root_layer_->SetBounds(gfx::Size(50, 50)); | 1302 root_layer_->SetBounds(gfx::Size(50, 50)); |
1303 | 1303 |
1304 recording.reset(new FakeDisplayListRecordingSource); | 1304 recording.reset(new FakeDisplayListRecordingSource); |
1305 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1305 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
1306 layer_settings(), &client_, std::move(recording)); | 1306 &client_, std::move(recording)); |
1307 child_layer_->SetBounds(gfx::Size(25, 25)); | 1307 child_layer_->SetBounds(gfx::Size(25, 25)); |
1308 child_layer_->SetIsDrawable(true); | 1308 child_layer_->SetIsDrawable(true); |
1309 child_layer_->SetContentsOpaque(true); | 1309 child_layer_->SetContentsOpaque(true); |
1310 root_layer_->AddChild(child_layer_); | 1310 root_layer_->AddChild(child_layer_); |
1311 | 1311 |
1312 layer_tree_host()->SetRootLayer(root_layer_); | 1312 layer_tree_host()->SetRootLayer(root_layer_); |
1313 LayerTreeHostTest::SetupTree(); | 1313 LayerTreeHostTest::SetupTree(); |
1314 client_.set_bounds(root_layer_->bounds()); | 1314 client_.set_bounds(root_layer_->bounds()); |
1315 } | 1315 } |
1316 | 1316 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 1539 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
1540 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 1540 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
1541 public: | 1541 public: |
1542 LayerTreeHostTestStartPageScaleAnimation() {} | 1542 LayerTreeHostTestStartPageScaleAnimation() {} |
1543 | 1543 |
1544 void SetupTree() override { | 1544 void SetupTree() override { |
1545 LayerTreeHostTest::SetupTree(); | 1545 LayerTreeHostTest::SetupTree(); |
1546 | 1546 |
1547 Layer* root_layer = layer_tree_host()->root_layer(); | 1547 Layer* root_layer = layer_tree_host()->root_layer(); |
1548 | 1548 |
1549 scoped_refptr<FakePictureLayer> layer = | 1549 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); |
1550 FakePictureLayer::Create(layer_settings(), &client_); | |
1551 layer->set_always_update_resources(true); | 1550 layer->set_always_update_resources(true); |
1552 scroll_layer_ = layer; | 1551 scroll_layer_ = layer; |
1553 | 1552 |
1554 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), | 1553 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), |
1555 2 * root_layer->bounds().height())); | 1554 2 * root_layer->bounds().height())); |
1556 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); | 1555 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); |
1557 | 1556 |
1558 CreateVirtualViewportLayers(root_layer, | 1557 CreateVirtualViewportLayers(root_layer, scroll_layer_, root_layer->bounds(), |
1559 scroll_layer_, | 1558 root_layer->bounds(), layer_tree_host()); |
1560 root_layer->bounds(), | |
1561 root_layer->bounds(), | |
1562 layer_tree_host(), | |
1563 layer_settings()); | |
1564 | 1559 |
1565 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 1560 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
1566 client_.set_bounds(root_layer->bounds()); | 1561 client_.set_bounds(root_layer->bounds()); |
1567 } | 1562 } |
1568 | 1563 |
1569 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1564 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1570 | 1565 |
1571 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, | 1566 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, |
1572 const gfx::Vector2dF&, | 1567 const gfx::Vector2dF&, |
1573 const gfx::Vector2dF& elastic_overscroll_delta, | 1568 const gfx::Vector2dF& elastic_overscroll_delta, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 | 1668 |
1674 // Layer opacity change during paint should not prevent compositor resources | 1669 // Layer opacity change during paint should not prevent compositor resources |
1675 // from being updated during commit. | 1670 // from being updated during commit. |
1676 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { | 1671 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { |
1677 public: | 1672 public: |
1678 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {} | 1673 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {} |
1679 | 1674 |
1680 void SetupTree() override { | 1675 void SetupTree() override { |
1681 LayerTreeHostTest::SetupTree(); | 1676 LayerTreeHostTest::SetupTree(); |
1682 | 1677 |
1683 update_check_picture_layer_ = FakePictureLayer::Create( | 1678 update_check_picture_layer_ = |
1684 layer_settings(), &test_opacity_change_delegate_); | 1679 FakePictureLayer::Create(&test_opacity_change_delegate_); |
1685 test_opacity_change_delegate_.SetTestLayer( | 1680 test_opacity_change_delegate_.SetTestLayer( |
1686 update_check_picture_layer_.get()); | 1681 update_check_picture_layer_.get()); |
1687 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_); | 1682 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_); |
1688 } | 1683 } |
1689 | 1684 |
1690 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1685 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1691 | 1686 |
1692 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); } | 1687 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); } |
1693 | 1688 |
1694 void AfterTest() override { | 1689 void AfterTest() override { |
1695 // Update() should have been called once. | 1690 // Update() should have been called once. |
1696 EXPECT_EQ(1, update_check_picture_layer_->update_count()); | 1691 EXPECT_EQ(1, update_check_picture_layer_->update_count()); |
1697 } | 1692 } |
1698 | 1693 |
1699 private: | 1694 private: |
1700 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; | 1695 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; |
1701 scoped_refptr<FakePictureLayer> update_check_picture_layer_; | 1696 scoped_refptr<FakePictureLayer> update_check_picture_layer_; |
1702 }; | 1697 }; |
1703 | 1698 |
1704 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange); | 1699 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange); |
1705 | 1700 |
1706 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 1701 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
1707 : public LayerTreeHostTest { | 1702 : public LayerTreeHostTest { |
1708 public: | 1703 public: |
1709 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} | 1704 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} |
1710 | 1705 |
1711 void BeginTest() override { | 1706 void BeginTest() override { |
1712 client_.set_fill_with_nonsolid_color(true); | 1707 client_.set_fill_with_nonsolid_color(true); |
1713 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1708 root_layer_ = FakePictureLayer::Create(&client_); |
1714 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1709 child_layer_ = FakePictureLayer::Create(&client_); |
1715 | 1710 |
1716 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); | 1711 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); |
1717 layer_tree_host()->SetDeviceScaleFactor(1.5); | 1712 layer_tree_host()->SetDeviceScaleFactor(1.5); |
1718 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); | 1713 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); |
1719 | 1714 |
1720 root_layer_->AddChild(child_layer_); | 1715 root_layer_->AddChild(child_layer_); |
1721 | 1716 |
1722 root_layer_->SetIsDrawable(true); | 1717 root_layer_->SetIsDrawable(true); |
1723 root_layer_->SetBounds(gfx::Size(30, 30)); | 1718 root_layer_->SetBounds(gfx::Size(30, 30)); |
1724 | 1719 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 | 1805 |
1811 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 1806 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
1812 public: | 1807 public: |
1813 LayerTreeHostTestContinuousInvalidate() | 1808 LayerTreeHostTestContinuousInvalidate() |
1814 : num_commit_complete_(0), num_draw_layers_(0) {} | 1809 : num_commit_complete_(0), num_draw_layers_(0) {} |
1815 | 1810 |
1816 void BeginTest() override { | 1811 void BeginTest() override { |
1817 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 1812 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
1818 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); | 1813 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
1819 | 1814 |
1820 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1815 layer_ = FakePictureLayer::Create(&client_); |
1821 layer_->SetBounds(gfx::Size(10, 10)); | 1816 layer_->SetBounds(gfx::Size(10, 10)); |
1822 layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 1817 layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
1823 layer_->SetIsDrawable(true); | 1818 layer_->SetIsDrawable(true); |
1824 layer_tree_host()->root_layer()->AddChild(layer_); | 1819 layer_tree_host()->root_layer()->AddChild(layer_); |
1825 | 1820 |
1826 PostSetNeedsCommitToMainThread(); | 1821 PostSetNeedsCommitToMainThread(); |
1827 client_.set_bounds(layer_->bounds()); | 1822 client_.set_bounds(layer_->bounds()); |
1828 } | 1823 } |
1829 | 1824 |
1830 void DidCommitAndDrawFrame() override { | 1825 void DidCommitAndDrawFrame() override { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 BeginFrameArgs current_begin_frame_args_; | 1980 BeginFrameArgs current_begin_frame_args_; |
1986 }; | 1981 }; |
1987 | 1982 |
1988 SINGLE_THREAD_TEST_F(LayerTreeHostTestCompositeImmediatelyStateTransitions); | 1983 SINGLE_THREAD_TEST_F(LayerTreeHostTestCompositeImmediatelyStateTransitions); |
1989 | 1984 |
1990 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { | 1985 class LayerTreeHostTestLCDChange : public LayerTreeHostTest { |
1991 public: | 1986 public: |
1992 void SetupTree() override { | 1987 void SetupTree() override { |
1993 num_tiles_rastered_ = 0; | 1988 num_tiles_rastered_ = 0; |
1994 | 1989 |
1995 scoped_refptr<Layer> root_layer = | 1990 scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); |
1996 PictureLayer::Create(layer_settings(), &client_); | |
1997 client_.set_fill_with_nonsolid_color(true); | 1991 client_.set_fill_with_nonsolid_color(true); |
1998 root_layer->SetIsDrawable(true); | 1992 root_layer->SetIsDrawable(true); |
1999 root_layer->SetBounds(gfx::Size(10, 10)); | 1993 root_layer->SetBounds(gfx::Size(10, 10)); |
2000 root_layer->SetContentsOpaque(true); | 1994 root_layer->SetContentsOpaque(true); |
2001 | 1995 |
2002 layer_tree_host()->SetRootLayer(root_layer); | 1996 layer_tree_host()->SetRootLayer(root_layer); |
2003 | 1997 |
2004 // The expectations are based on the assumption that the default | 1998 // The expectations are based on the assumption that the default |
2005 // LCD settings are: | 1999 // LCD settings are: |
2006 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); | 2000 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 }; | 2218 }; |
2225 | 2219 |
2226 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync); | 2220 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync); |
2227 | 2221 |
2228 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 2222 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
2229 : public LayerTreeHostTest { | 2223 : public LayerTreeHostTest { |
2230 protected: | 2224 protected: |
2231 void SetupTree() override { | 2225 void SetupTree() override { |
2232 LayerTreeHostTest::SetupTree(); | 2226 LayerTreeHostTest::SetupTree(); |
2233 | 2227 |
2234 scoped_refptr<Layer> layer = | 2228 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); |
2235 PictureLayer::Create(layer_settings(), &client_); | |
2236 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 2229 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
2237 layer->SetBounds(gfx::Size(10, 10)); | 2230 layer->SetBounds(gfx::Size(10, 10)); |
2238 layer_tree_host()->root_layer()->AddChild(layer); | 2231 layer_tree_host()->root_layer()->AddChild(layer); |
2239 client_.set_bounds(layer->bounds()); | 2232 client_.set_bounds(layer->bounds()); |
2240 } | 2233 } |
2241 | 2234 |
2242 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2235 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2243 | 2236 |
2244 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2237 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
2245 EndTest(); | 2238 EndTest(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 bool FillsBoundsCompletely() const override { return false; } | 2270 bool FillsBoundsCompletely() const override { return false; } |
2278 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 2271 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
2279 | 2272 |
2280 private: | 2273 private: |
2281 Layer* layer_; | 2274 Layer* layer_; |
2282 }; | 2275 }; |
2283 | 2276 |
2284 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} | 2277 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} |
2285 | 2278 |
2286 void SetupTree() override { | 2279 void SetupTree() override { |
2287 scoped_refptr<PictureLayer> root_layer = | 2280 scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); |
2288 PictureLayer::Create(layer_settings(), &client_); | |
2289 root_layer->SetIsDrawable(true); | 2281 root_layer->SetIsDrawable(true); |
2290 root_layer->SetBounds(gfx::Size(1, 1)); | 2282 root_layer->SetBounds(gfx::Size(1, 1)); |
2291 client_.set_layer(root_layer.get()); | 2283 client_.set_layer(root_layer.get()); |
2292 | 2284 |
2293 layer_tree_host()->SetRootLayer(root_layer); | 2285 layer_tree_host()->SetRootLayer(root_layer); |
2294 LayerTreeHostTest::SetupTree(); | 2286 LayerTreeHostTest::SetupTree(); |
2295 } | 2287 } |
2296 | 2288 |
2297 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2289 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2298 void AfterTest() override {} | 2290 void AfterTest() override {} |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 } | 2352 } |
2361 | 2353 |
2362 void SetupTree() override { | 2354 void SetupTree() override { |
2363 LayerTreeHostTest::SetupTree(); | 2355 LayerTreeHostTest::SetupTree(); |
2364 | 2356 |
2365 layer_tree_host()->root_layer()->SetIsDrawable(false); | 2357 layer_tree_host()->root_layer()->SetIsDrawable(false); |
2366 | 2358 |
2367 io_surface_id_ = 9; | 2359 io_surface_id_ = 9; |
2368 io_surface_size_ = gfx::Size(6, 7); | 2360 io_surface_size_ = gfx::Size(6, 7); |
2369 | 2361 |
2370 scoped_refptr<IOSurfaceLayer> io_surface_layer = | 2362 scoped_refptr<IOSurfaceLayer> io_surface_layer = IOSurfaceLayer::Create(); |
2371 IOSurfaceLayer::Create(layer_settings()); | |
2372 io_surface_layer->SetBounds(gfx::Size(10, 10)); | 2363 io_surface_layer->SetBounds(gfx::Size(10, 10)); |
2373 io_surface_layer->SetIsDrawable(true); | 2364 io_surface_layer->SetIsDrawable(true); |
2374 io_surface_layer->SetContentsOpaque(true); | 2365 io_surface_layer->SetContentsOpaque(true); |
2375 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_); | 2366 io_surface_layer->SetIOSurfaceProperties(io_surface_id_, io_surface_size_); |
2376 layer_tree_host()->root_layer()->AddChild(io_surface_layer); | 2367 layer_tree_host()->root_layer()->AddChild(io_surface_layer); |
2377 } | 2368 } |
2378 | 2369 |
2379 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2370 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
2380 | 2371 |
2381 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 2372 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 | 2498 |
2508 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNumFramesPending); | 2499 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNumFramesPending); |
2509 | 2500 |
2510 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { | 2501 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { |
2511 public: | 2502 public: |
2512 void InitializeSettings(LayerTreeSettings* settings) override { | 2503 void InitializeSettings(LayerTreeSettings* settings) override { |
2513 settings->using_synchronous_renderer_compositor = true; | 2504 settings->using_synchronous_renderer_compositor = true; |
2514 } | 2505 } |
2515 | 2506 |
2516 void SetupTree() override { | 2507 void SetupTree() override { |
2517 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 2508 root_layer_ = FakePictureLayer::Create(&client_); |
2518 root_layer_->SetIsDrawable(true); | 2509 root_layer_->SetIsDrawable(true); |
2519 root_layer_->SetBounds(gfx::Size(50, 50)); | 2510 root_layer_->SetBounds(gfx::Size(50, 50)); |
2520 | 2511 |
2521 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 2512 parent_layer_ = FakePictureLayer::Create(&client_); |
2522 parent_layer_->SetIsDrawable(true); | 2513 parent_layer_->SetIsDrawable(true); |
2523 parent_layer_->SetBounds(gfx::Size(50, 50)); | 2514 parent_layer_->SetBounds(gfx::Size(50, 50)); |
2524 parent_layer_->SetForceRenderSurface(true); | 2515 parent_layer_->SetForceRenderSurface(true); |
2525 | 2516 |
2526 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 2517 child_layer_ = FakePictureLayer::Create(&client_); |
2527 child_layer_->SetIsDrawable(true); | 2518 child_layer_->SetIsDrawable(true); |
2528 child_layer_->SetBounds(gfx::Size(50, 50)); | 2519 child_layer_->SetBounds(gfx::Size(50, 50)); |
2529 | 2520 |
2530 root_layer_->AddChild(parent_layer_); | 2521 root_layer_->AddChild(parent_layer_); |
2531 parent_layer_->AddChild(child_layer_); | 2522 parent_layer_->AddChild(child_layer_); |
2532 layer_tree_host()->SetRootLayer(root_layer_); | 2523 layer_tree_host()->SetRootLayer(root_layer_); |
2533 | 2524 |
2534 LayerTreeHostTest::SetupTree(); | 2525 LayerTreeHostTest::SetupTree(); |
2535 client_.set_bounds(root_layer_->bounds()); | 2526 client_.set_bounds(root_layer_->bounds()); |
2536 } | 2527 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 | 2726 |
2736 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) | 2727 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) |
2737 : LayerImpl(tree_impl, id), | 2728 : LayerImpl(tree_impl, id), |
2738 push_properties_count_(0) { | 2729 push_properties_count_(0) { |
2739 SetBounds(gfx::Size(1, 1)); | 2730 SetBounds(gfx::Size(1, 1)); |
2740 } | 2731 } |
2741 }; | 2732 }; |
2742 | 2733 |
2743 class PushPropertiesCountingLayer : public Layer { | 2734 class PushPropertiesCountingLayer : public Layer { |
2744 public: | 2735 public: |
2745 static scoped_refptr<PushPropertiesCountingLayer> Create( | 2736 static scoped_refptr<PushPropertiesCountingLayer> Create() { |
2746 const LayerSettings& settings) { | 2737 return new PushPropertiesCountingLayer(); |
2747 return new PushPropertiesCountingLayer(settings); | |
2748 } | 2738 } |
2749 | 2739 |
2750 void PushPropertiesTo(LayerImpl* layer) override { | 2740 void PushPropertiesTo(LayerImpl* layer) override { |
2751 Layer::PushPropertiesTo(layer); | 2741 Layer::PushPropertiesTo(layer); |
2752 push_properties_count_++; | 2742 push_properties_count_++; |
2753 if (persist_needs_push_properties_) | 2743 if (persist_needs_push_properties_) |
2754 needs_push_properties_ = true; | 2744 needs_push_properties_ = true; |
2755 } | 2745 } |
2756 | 2746 |
2757 // Something to make this layer push properties, but no other layer. | 2747 // Something to make this layer push properties, but no other layer. |
2758 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } | 2748 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } |
2759 | 2749 |
2760 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { | 2750 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { |
2761 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); | 2751 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); |
2762 } | 2752 } |
2763 | 2753 |
2764 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } | 2754 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } |
2765 | 2755 |
2766 size_t push_properties_count() const { return push_properties_count_; } | 2756 size_t push_properties_count() const { return push_properties_count_; } |
2767 void reset_push_properties_count() { push_properties_count_ = 0; } | 2757 void reset_push_properties_count() { push_properties_count_ = 0; } |
2768 | 2758 |
2769 void set_persist_needs_push_properties(bool persist) { | 2759 void set_persist_needs_push_properties(bool persist) { |
2770 persist_needs_push_properties_ = persist; | 2760 persist_needs_push_properties_ = persist; |
2771 } | 2761 } |
2772 | 2762 |
2773 private: | 2763 private: |
2774 explicit PushPropertiesCountingLayer(const LayerSettings& settings) | 2764 PushPropertiesCountingLayer() |
2775 : Layer(settings), | 2765 : Layer(), |
2776 push_properties_count_(0), | 2766 push_properties_count_(0), |
2777 persist_needs_push_properties_(false) { | 2767 persist_needs_push_properties_(false) { |
2778 SetBounds(gfx::Size(1, 1)); | 2768 SetBounds(gfx::Size(1, 1)); |
2779 } | 2769 } |
2780 ~PushPropertiesCountingLayer() override {} | 2770 ~PushPropertiesCountingLayer() override {} |
2781 | 2771 |
2782 size_t push_properties_count_; | 2772 size_t push_properties_count_; |
2783 bool persist_needs_push_properties_; | 2773 bool persist_needs_push_properties_; |
2784 }; | 2774 }; |
2785 | 2775 |
2786 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { | 2776 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { |
2787 protected: | 2777 protected: |
2788 void BeginTest() override { | 2778 void BeginTest() override { |
2789 num_commits_ = 0; | 2779 num_commits_ = 0; |
2790 expected_push_properties_root_ = 0; | 2780 expected_push_properties_root_ = 0; |
2791 expected_push_properties_child_ = 0; | 2781 expected_push_properties_child_ = 0; |
2792 expected_push_properties_grandchild_ = 0; | 2782 expected_push_properties_grandchild_ = 0; |
2793 expected_push_properties_child2_ = 0; | 2783 expected_push_properties_child2_ = 0; |
2794 expected_push_properties_other_root_ = 0; | 2784 expected_push_properties_other_root_ = 0; |
2795 expected_push_properties_leaf_layer_ = 0; | 2785 expected_push_properties_leaf_layer_ = 0; |
2796 PostSetNeedsCommitToMainThread(); | 2786 PostSetNeedsCommitToMainThread(); |
2797 } | 2787 } |
2798 | 2788 |
2799 void SetupTree() override { | 2789 void SetupTree() override { |
2800 root_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2790 root_ = PushPropertiesCountingLayer::Create(); |
2801 child_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2791 child_ = PushPropertiesCountingLayer::Create(); |
2802 child2_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2792 child2_ = PushPropertiesCountingLayer::Create(); |
2803 grandchild_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2793 grandchild_ = PushPropertiesCountingLayer::Create(); |
2804 leaf_always_pushing_layer_ = | 2794 leaf_always_pushing_layer_ = PushPropertiesCountingLayer::Create(); |
2805 PushPropertiesCountingLayer::Create(layer_settings()); | |
2806 leaf_always_pushing_layer_->set_persist_needs_push_properties(true); | 2795 leaf_always_pushing_layer_->set_persist_needs_push_properties(true); |
2807 | 2796 |
2808 root_->AddChild(child_); | 2797 root_->AddChild(child_); |
2809 root_->AddChild(child2_); | 2798 root_->AddChild(child2_); |
2810 child_->AddChild(grandchild_); | 2799 child_->AddChild(grandchild_); |
2811 child2_->AddChild(leaf_always_pushing_layer_); | 2800 child2_->AddChild(leaf_always_pushing_layer_); |
2812 | 2801 |
2813 other_root_ = PushPropertiesCountingLayer::Create(layer_settings()); | 2802 other_root_ = PushPropertiesCountingLayer::Create(); |
2814 | 2803 |
2815 // Don't set the root layer here. | 2804 // Don't set the root layer here. |
2816 LayerTreeHostTest::SetupTree(); | 2805 LayerTreeHostTest::SetupTree(); |
2817 client_.set_bounds(root_->bounds()); | 2806 client_.set_bounds(root_->bounds()); |
2818 } | 2807 } |
2819 | 2808 |
2820 void DidCommitAndDrawFrame() override { | 2809 void DidCommitAndDrawFrame() override { |
2821 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) | 2810 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) |
2822 << "num_commits: " << num_commits_; | 2811 << "num_commits: " << num_commits_; |
2823 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) | 2812 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 | 3173 |
3185 // In single thread there's no pending tree to push properties from. | 3174 // In single thread there's no pending tree to push properties from. |
3186 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties); | 3175 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties); |
3187 | 3176 |
3188 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed | 3177 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed |
3189 : public LayerTreeHostTest { | 3178 : public LayerTreeHostTest { |
3190 protected: | 3179 protected: |
3191 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3180 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
3192 | 3181 |
3193 void SetupTree() override { | 3182 void SetupTree() override { |
3194 root_ = Layer::Create(layer_settings()); | 3183 root_ = Layer::Create(); |
3195 root_->SetBounds(gfx::Size(1, 1)); | 3184 root_->SetBounds(gfx::Size(1, 1)); |
3196 | 3185 |
3197 bool paint_scrollbar = true; | 3186 bool paint_scrollbar = true; |
3198 bool has_thumb = false; | 3187 bool has_thumb = false; |
3199 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3188 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
3200 layer_settings(), paint_scrollbar, has_thumb, root_->id()); | 3189 paint_scrollbar, has_thumb, root_->id()); |
3201 | 3190 |
3202 root_->AddChild(scrollbar_layer_); | 3191 root_->AddChild(scrollbar_layer_); |
3203 | 3192 |
3204 layer_tree_host()->SetRootLayer(root_); | 3193 layer_tree_host()->SetRootLayer(root_); |
3205 LayerTreeHostTest::SetupTree(); | 3194 LayerTreeHostTest::SetupTree(); |
3206 } | 3195 } |
3207 | 3196 |
3208 void DidCommitAndDrawFrame() override { | 3197 void DidCommitAndDrawFrame() override { |
3209 switch (layer_tree_host()->source_frame_number()) { | 3198 switch (layer_tree_host()->source_frame_number()) { |
3210 case 0: | 3199 case 0: |
(...skipping 29 matching lines...) Expand all Loading... |
3240 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; | 3229 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; |
3241 }; | 3230 }; |
3242 | 3231 |
3243 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); | 3232 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); |
3244 | 3233 |
3245 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | 3234 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { |
3246 protected: | 3235 protected: |
3247 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3236 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
3248 | 3237 |
3249 void SetupTree() override { | 3238 void SetupTree() override { |
3250 root_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3239 root_ = PushPropertiesCountingLayer::Create(); |
3251 child_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3240 child_ = PushPropertiesCountingLayer::Create(); |
3252 root_->AddChild(child_); | 3241 root_->AddChild(child_); |
3253 | 3242 |
3254 layer_tree_host()->SetRootLayer(root_); | 3243 layer_tree_host()->SetRootLayer(root_); |
3255 LayerTreeHostTest::SetupTree(); | 3244 LayerTreeHostTest::SetupTree(); |
3256 } | 3245 } |
3257 | 3246 |
3258 void DidCommitAndDrawFrame() override { | 3247 void DidCommitAndDrawFrame() override { |
3259 switch (layer_tree_host()->source_frame_number()) { | 3248 switch (layer_tree_host()->source_frame_number()) { |
3260 case 0: | 3249 case 0: |
3261 break; | 3250 break; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 void BeginTest() override { | 3290 void BeginTest() override { |
3302 expected_push_properties_root_ = 0; | 3291 expected_push_properties_root_ = 0; |
3303 expected_push_properties_child_ = 0; | 3292 expected_push_properties_child_ = 0; |
3304 expected_push_properties_grandchild1_ = 0; | 3293 expected_push_properties_grandchild1_ = 0; |
3305 expected_push_properties_grandchild2_ = 0; | 3294 expected_push_properties_grandchild2_ = 0; |
3306 expected_push_properties_grandchild3_ = 0; | 3295 expected_push_properties_grandchild3_ = 0; |
3307 PostSetNeedsCommitToMainThread(); | 3296 PostSetNeedsCommitToMainThread(); |
3308 } | 3297 } |
3309 | 3298 |
3310 void SetupTree() override { | 3299 void SetupTree() override { |
3311 root_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3300 root_ = PushPropertiesCountingLayer::Create(); |
3312 child_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3301 child_ = PushPropertiesCountingLayer::Create(); |
3313 grandchild1_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3302 grandchild1_ = PushPropertiesCountingLayer::Create(); |
3314 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3303 grandchild2_ = PushPropertiesCountingLayer::Create(); |
3315 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings()); | 3304 grandchild3_ = PushPropertiesCountingLayer::Create(); |
3316 | 3305 |
3317 root_->AddChild(child_); | 3306 root_->AddChild(child_); |
3318 child_->AddChild(grandchild1_); | 3307 child_->AddChild(grandchild1_); |
3319 child_->AddChild(grandchild2_); | 3308 child_->AddChild(grandchild2_); |
3320 child_->AddChild(grandchild3_); | 3309 child_->AddChild(grandchild3_); |
3321 | 3310 |
3322 // Don't set the root layer here. | 3311 // Don't set the root layer here. |
3323 LayerTreeHostTest::SetupTree(); | 3312 LayerTreeHostTest::SetupTree(); |
3324 client_.set_bounds(root_->bounds()); | 3313 client_.set_bounds(root_->bounds()); |
3325 } | 3314 } |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3802 int num_draws_; | 3791 int num_draws_; |
3803 }; | 3792 }; |
3804 | 3793 |
3805 // VideoLayer must support being invalidated and then passing that along | 3794 // VideoLayer must support being invalidated and then passing that along |
3806 // to the compositor thread, even though no resources are updated in | 3795 // to the compositor thread, even though no resources are updated in |
3807 // response to that invalidation. | 3796 // response to that invalidation. |
3808 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { | 3797 class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { |
3809 public: | 3798 public: |
3810 void SetupTree() override { | 3799 void SetupTree() override { |
3811 LayerTreeHostTest::SetupTree(); | 3800 LayerTreeHostTest::SetupTree(); |
3812 scoped_refptr<VideoLayer> video_layer = VideoLayer::Create( | 3801 scoped_refptr<VideoLayer> video_layer = |
3813 layer_settings(), &provider_, media::VIDEO_ROTATION_0); | 3802 VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); |
3814 video_layer->SetBounds(gfx::Size(10, 10)); | 3803 video_layer->SetBounds(gfx::Size(10, 10)); |
3815 video_layer->SetIsDrawable(true); | 3804 video_layer->SetIsDrawable(true); |
3816 layer_tree_host()->root_layer()->AddChild(video_layer); | 3805 layer_tree_host()->root_layer()->AddChild(video_layer); |
3817 | 3806 |
3818 invalidate_layer_ = video_layer; | 3807 invalidate_layer_ = video_layer; |
3819 } | 3808 } |
3820 | 3809 |
3821 private: | 3810 private: |
3822 FakeVideoFrameProvider provider_; | 3811 FakeVideoFrameProvider provider_; |
3823 }; | 3812 }; |
3824 | 3813 |
3825 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 3814 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
3826 | 3815 |
3827 // IOSurfaceLayer must support being invalidated and then passing that along | 3816 // IOSurfaceLayer must support being invalidated and then passing that along |
3828 // to the compositor thread, even though no resources are updated in | 3817 // to the compositor thread, even though no resources are updated in |
3829 // response to that invalidation. | 3818 // response to that invalidation. |
3830 class LayerTreeHostTestIOSurfaceLayerInvalidate | 3819 class LayerTreeHostTestIOSurfaceLayerInvalidate |
3831 : public LayerInvalidateCausesDraw { | 3820 : public LayerInvalidateCausesDraw { |
3832 public: | 3821 public: |
3833 void SetupTree() override { | 3822 void SetupTree() override { |
3834 LayerTreeHostTest::SetupTree(); | 3823 LayerTreeHostTest::SetupTree(); |
3835 scoped_refptr<IOSurfaceLayer> layer = | 3824 scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create(); |
3836 IOSurfaceLayer::Create(layer_settings()); | |
3837 layer->SetBounds(gfx::Size(10, 10)); | 3825 layer->SetBounds(gfx::Size(10, 10)); |
3838 uint32_t fake_io_surface_id = 7; | 3826 uint32_t fake_io_surface_id = 7; |
3839 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); | 3827 layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); |
3840 layer->SetIsDrawable(true); | 3828 layer->SetIsDrawable(true); |
3841 layer_tree_host()->root_layer()->AddChild(layer); | 3829 layer_tree_host()->root_layer()->AddChild(layer); |
3842 | 3830 |
3843 invalidate_layer_ = layer; | 3831 invalidate_layer_ = layer; |
3844 } | 3832 } |
3845 }; | 3833 }; |
3846 | 3834 |
3847 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestIOSurfaceLayerInvalidate); | 3835 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestIOSurfaceLayerInvalidate); |
3848 | 3836 |
3849 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { | 3837 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { |
3850 protected: | 3838 protected: |
3851 void SetupTree() override { | 3839 void SetupTree() override { |
3852 root_layer_ = Layer::Create(layer_settings()); | 3840 root_layer_ = Layer::Create(); |
3853 root_layer_->SetPosition(gfx::PointF()); | 3841 root_layer_->SetPosition(gfx::PointF()); |
3854 root_layer_->SetBounds(gfx::Size(10, 10)); | 3842 root_layer_->SetBounds(gfx::Size(10, 10)); |
3855 | 3843 |
3856 parent_layer_ = SolidColorLayer::Create(layer_settings()); | 3844 parent_layer_ = SolidColorLayer::Create(); |
3857 parent_layer_->SetPosition(gfx::PointF()); | 3845 parent_layer_->SetPosition(gfx::PointF()); |
3858 parent_layer_->SetBounds(gfx::Size(10, 10)); | 3846 parent_layer_->SetBounds(gfx::Size(10, 10)); |
3859 parent_layer_->SetIsDrawable(true); | 3847 parent_layer_->SetIsDrawable(true); |
3860 root_layer_->AddChild(parent_layer_); | 3848 root_layer_->AddChild(parent_layer_); |
3861 | 3849 |
3862 child_layer_ = SolidColorLayer::Create(layer_settings()); | 3850 child_layer_ = SolidColorLayer::Create(); |
3863 child_layer_->SetPosition(gfx::PointF()); | 3851 child_layer_->SetPosition(gfx::PointF()); |
3864 child_layer_->SetBounds(gfx::Size(10, 10)); | 3852 child_layer_->SetBounds(gfx::Size(10, 10)); |
3865 child_layer_->SetIsDrawable(true); | 3853 child_layer_->SetIsDrawable(true); |
3866 parent_layer_->AddChild(child_layer_); | 3854 parent_layer_->AddChild(child_layer_); |
3867 | 3855 |
3868 layer_tree_host()->SetRootLayer(root_layer_); | 3856 layer_tree_host()->SetRootLayer(root_layer_); |
3869 LayerTreeHostTest::SetupTree(); | 3857 LayerTreeHostTest::SetupTree(); |
3870 } | 3858 } |
3871 | 3859 |
3872 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3860 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3908 scoped_refptr<Layer> root_layer_; | 3896 scoped_refptr<Layer> root_layer_; |
3909 scoped_refptr<SolidColorLayer> parent_layer_; | 3897 scoped_refptr<SolidColorLayer> parent_layer_; |
3910 scoped_refptr<SolidColorLayer> child_layer_; | 3898 scoped_refptr<SolidColorLayer> child_layer_; |
3911 }; | 3899 }; |
3912 | 3900 |
3913 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 3901 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); |
3914 | 3902 |
3915 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 3903 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
3916 protected: | 3904 protected: |
3917 void SetupTree() override { | 3905 void SetupTree() override { |
3918 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 3906 root_layer_ = FakePictureLayer::Create(&client_); |
3919 root_layer_->SetBounds(gfx::Size(10, 10)); | 3907 root_layer_->SetBounds(gfx::Size(10, 10)); |
3920 | 3908 |
3921 layer_tree_host()->SetRootLayer(root_layer_); | 3909 layer_tree_host()->SetRootLayer(root_layer_); |
3922 LayerTreeHostTest::SetupTree(); | 3910 LayerTreeHostTest::SetupTree(); |
3923 client_.set_bounds(root_layer_->bounds()); | 3911 client_.set_bounds(root_layer_->bounds()); |
3924 } | 3912 } |
3925 | 3913 |
3926 void BeginTest() override { | 3914 void BeginTest() override { |
3927 // The viewport is empty, but we still need to update layers on the main | 3915 // The viewport is empty, but we still need to update layers on the main |
3928 // thread. | 3916 // thread. |
(...skipping 19 matching lines...) Expand all Loading... |
3948 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest { | 3936 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest { |
3949 public: | 3937 public: |
3950 LayerTreeHostTestElasticOverscroll() | 3938 LayerTreeHostTestElasticOverscroll() |
3951 : scroll_elasticity_helper_(nullptr), num_draws_(0) {} | 3939 : scroll_elasticity_helper_(nullptr), num_draws_(0) {} |
3952 | 3940 |
3953 void InitializeSettings(LayerTreeSettings* settings) override { | 3941 void InitializeSettings(LayerTreeSettings* settings) override { |
3954 settings->enable_elastic_overscroll = true; | 3942 settings->enable_elastic_overscroll = true; |
3955 } | 3943 } |
3956 | 3944 |
3957 void SetupTree() override { | 3945 void SetupTree() override { |
3958 root_layer_ = Layer::Create(layer_settings()); | 3946 root_layer_ = Layer::Create(); |
3959 root_layer_->SetBounds(gfx::Size(10, 10)); | 3947 root_layer_->SetBounds(gfx::Size(10, 10)); |
3960 | 3948 |
3961 scoped_refptr<Layer> inner_viewport_container_layer = | 3949 scoped_refptr<Layer> inner_viewport_container_layer = Layer::Create(); |
3962 Layer::Create(layer_settings()); | |
3963 inner_viewport_container_layer->SetBounds(gfx::Size(10, 10)); | 3950 inner_viewport_container_layer->SetBounds(gfx::Size(10, 10)); |
3964 scoped_refptr<Layer> overscroll_elasticity_layer = | 3951 scoped_refptr<Layer> overscroll_elasticity_layer = Layer::Create(); |
3965 Layer::Create(layer_settings()); | 3952 scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
3966 scoped_refptr<Layer> page_scale_layer = Layer::Create(layer_settings()); | 3953 scoped_refptr<Layer> inner_viewport_scroll_layer = Layer::Create(); |
3967 scoped_refptr<Layer> inner_viewport_scroll_layer = | |
3968 Layer::Create(layer_settings()); | |
3969 inner_viewport_scroll_layer->SetScrollClipLayerId( | 3954 inner_viewport_scroll_layer->SetScrollClipLayerId( |
3970 inner_viewport_container_layer->id()); | 3955 inner_viewport_container_layer->id()); |
3971 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 3956 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
3972 | 3957 |
3973 root_layer_->AddChild(inner_viewport_container_layer); | 3958 root_layer_->AddChild(inner_viewport_container_layer); |
3974 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); | 3959 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); |
3975 overscroll_elasticity_layer->AddChild(page_scale_layer); | 3960 overscroll_elasticity_layer->AddChild(page_scale_layer); |
3976 page_scale_layer->AddChild(inner_viewport_scroll_layer); | 3961 page_scale_layer->AddChild(inner_viewport_scroll_layer); |
3977 | 3962 |
3978 scoped_refptr<Layer> content_layer = | 3963 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); |
3979 FakePictureLayer::Create(layer_settings(), &client_); | |
3980 content_layer->SetBounds(gfx::Size(10, 10)); | 3964 content_layer->SetBounds(gfx::Size(10, 10)); |
3981 inner_viewport_scroll_layer->AddChild(content_layer); | 3965 inner_viewport_scroll_layer->AddChild(content_layer); |
3982 | 3966 |
3983 layer_tree_host()->SetRootLayer(root_layer_); | 3967 layer_tree_host()->SetRootLayer(root_layer_); |
3984 layer_tree_host()->RegisterViewportLayers( | 3968 layer_tree_host()->RegisterViewportLayers( |
3985 overscroll_elasticity_layer, page_scale_layer, | 3969 overscroll_elasticity_layer, page_scale_layer, |
3986 inner_viewport_scroll_layer, nullptr); | 3970 inner_viewport_scroll_layer, nullptr); |
3987 LayerTreeHostTest::SetupTree(); | 3971 LayerTreeHostTest::SetupTree(); |
3988 client_.set_bounds(content_layer->bounds()); | 3972 client_.set_bounds(content_layer->bounds()); |
3989 } | 3973 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4070 output_surface->SetMemoryPolicyToSetAtBind( | 4054 output_surface->SetMemoryPolicyToSetAtBind( |
4071 make_scoped_ptr(new ManagedMemoryPolicy( | 4055 make_scoped_ptr(new ManagedMemoryPolicy( |
4072 second_context_provider_.get() ? second_output_surface_memory_limit_ | 4056 second_context_provider_.get() ? second_output_surface_memory_limit_ |
4073 : first_output_surface_memory_limit_, | 4057 : first_output_surface_memory_limit_, |
4074 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 4058 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
4075 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 4059 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
4076 return output_surface; | 4060 return output_surface; |
4077 } | 4061 } |
4078 | 4062 |
4079 void SetupTree() override { | 4063 void SetupTree() override { |
4080 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 4064 root_ = FakePictureLayer::Create(&client_); |
4081 root_->SetBounds(gfx::Size(20, 20)); | 4065 root_->SetBounds(gfx::Size(20, 20)); |
4082 layer_tree_host()->SetRootLayer(root_); | 4066 layer_tree_host()->SetRootLayer(root_); |
4083 LayerTreeHostTest::SetupTree(); | 4067 LayerTreeHostTest::SetupTree(); |
4084 client_.set_bounds(root_->bounds()); | 4068 client_.set_bounds(root_->bounds()); |
4085 } | 4069 } |
4086 | 4070 |
4087 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4071 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4088 | 4072 |
4089 void DidCommitAndDrawFrame() override { | 4073 void DidCommitAndDrawFrame() override { |
4090 // Lost context sometimes takes two frames to recreate. The third frame | 4074 // Lost context sometimes takes two frames to recreate. The third frame |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4324 TestSwapPromiseResult swap_promise_result_[3]; | 4308 TestSwapPromiseResult swap_promise_result_[3]; |
4325 }; | 4309 }; |
4326 | 4310 |
4327 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4311 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
4328 | 4312 |
4329 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { | 4313 class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { |
4330 public: | 4314 public: |
4331 LayerTreeHostTestKeepSwapPromise() {} | 4315 LayerTreeHostTestKeepSwapPromise() {} |
4332 | 4316 |
4333 void BeginTest() override { | 4317 void BeginTest() override { |
4334 layer_ = SolidColorLayer::Create(layer_settings()); | 4318 layer_ = SolidColorLayer::Create(); |
4335 layer_->SetIsDrawable(true); | 4319 layer_->SetIsDrawable(true); |
4336 layer_->SetBounds(gfx::Size(10, 10)); | 4320 layer_->SetBounds(gfx::Size(10, 10)); |
4337 layer_tree_host()->SetRootLayer(layer_); | 4321 layer_tree_host()->SetRootLayer(layer_); |
4338 gfx::Size bounds(100, 100); | 4322 gfx::Size bounds(100, 100); |
4339 layer_tree_host()->SetViewportSize(bounds); | 4323 layer_tree_host()->SetViewportSize(bounds); |
4340 PostSetNeedsCommitToMainThread(); | 4324 PostSetNeedsCommitToMainThread(); |
4341 } | 4325 } |
4342 | 4326 |
4343 void DidCommit() override { | 4327 void DidCommit() override { |
4344 MainThreadTaskRunner()->PostTask( | 4328 MainThreadTaskRunner()->PostTask( |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 | 4628 |
4645 void SetupTree() override { | 4629 void SetupTree() override { |
4646 LayerTreeHostTest::SetupTree(); | 4630 LayerTreeHostTest::SetupTree(); |
4647 | 4631 |
4648 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4632 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
4649 new FakeDisplayListRecordingSource); | 4633 new FakeDisplayListRecordingSource); |
4650 recording_source_ = recording_source.get(); | 4634 recording_source_ = recording_source.get(); |
4651 | 4635 |
4652 scoped_refptr<FakePictureLayer> layer = | 4636 scoped_refptr<FakePictureLayer> layer = |
4653 FakePictureLayer::CreateWithRecordingSource( | 4637 FakePictureLayer::CreateWithRecordingSource( |
4654 layer_settings(), &layer_client_, std::move(recording_source)); | 4638 &layer_client_, std::move(recording_source)); |
4655 layer_ = layer.get(); | 4639 layer_ = layer.get(); |
4656 layer->SetBounds(gfx::Size(10, 10)); | 4640 layer->SetBounds(gfx::Size(10, 10)); |
4657 layer->SetIsDrawable(true); | 4641 layer->SetIsDrawable(true); |
4658 layer_tree_host()->root_layer()->AddChild(layer); | 4642 layer_tree_host()->root_layer()->AddChild(layer); |
4659 layer_client_.set_bounds(layer_->bounds()); | 4643 layer_client_.set_bounds(layer_->bounds()); |
4660 } | 4644 } |
4661 | 4645 |
4662 void BeginTest() override { | 4646 void BeginTest() override { |
4663 // Verify default value. | 4647 // Verify default value. |
4664 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4648 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4700 protected: | 4684 protected: |
4701 void SetupTree() override { | 4685 void SetupTree() override { |
4702 LayerTreeHostTest::SetupTree(); | 4686 LayerTreeHostTest::SetupTree(); |
4703 | 4687 |
4704 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4688 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
4705 new FakeDisplayListRecordingSource); | 4689 new FakeDisplayListRecordingSource); |
4706 recording_source_ = recording_source.get(); | 4690 recording_source_ = recording_source.get(); |
4707 | 4691 |
4708 scoped_refptr<FakePictureLayer> layer = | 4692 scoped_refptr<FakePictureLayer> layer = |
4709 FakePictureLayer::CreateWithRecordingSource( | 4693 FakePictureLayer::CreateWithRecordingSource( |
4710 layer_settings(), &layer_client_, std::move(recording_source)); | 4694 &layer_client_, std::move(recording_source)); |
4711 layer_ = layer.get(); | 4695 layer_ = layer.get(); |
4712 layer->SetBounds(gfx::Size()); | 4696 layer->SetBounds(gfx::Size()); |
4713 layer->SetIsDrawable(true); | 4697 layer->SetIsDrawable(true); |
4714 layer_tree_host()->root_layer()->AddChild(layer); | 4698 layer_tree_host()->root_layer()->AddChild(layer); |
4715 layer_client_.set_bounds(layer->bounds()); | 4699 layer_client_.set_bounds(layer->bounds()); |
4716 } | 4700 } |
4717 | 4701 |
4718 void BeginTest() override { | 4702 void BeginTest() override { |
4719 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4703 // Setting gpu rasterization trigger does not enable gpu rasterization. |
4720 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4704 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4758 | 4742 |
4759 void SetupTree() override { | 4743 void SetupTree() override { |
4760 LayerTreeHostTest::SetupTree(); | 4744 LayerTreeHostTest::SetupTree(); |
4761 | 4745 |
4762 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4746 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
4763 new FakeDisplayListRecordingSource); | 4747 new FakeDisplayListRecordingSource); |
4764 recording_source_ = recording_source.get(); | 4748 recording_source_ = recording_source.get(); |
4765 | 4749 |
4766 scoped_refptr<FakePictureLayer> layer = | 4750 scoped_refptr<FakePictureLayer> layer = |
4767 FakePictureLayer::CreateWithRecordingSource( | 4751 FakePictureLayer::CreateWithRecordingSource( |
4768 layer_settings(), &layer_client_, std::move(recording_source)); | 4752 &layer_client_, std::move(recording_source)); |
4769 layer_ = layer.get(); | 4753 layer_ = layer.get(); |
4770 layer->SetBounds(gfx::Size(10, 10)); | 4754 layer->SetBounds(gfx::Size(10, 10)); |
4771 layer->SetIsDrawable(true); | 4755 layer->SetIsDrawable(true); |
4772 layer_tree_host()->root_layer()->AddChild(layer); | 4756 layer_tree_host()->root_layer()->AddChild(layer); |
4773 layer_client_.set_bounds(layer_->bounds()); | 4757 layer_client_.set_bounds(layer_->bounds()); |
4774 } | 4758 } |
4775 | 4759 |
4776 void BeginTest() override { | 4760 void BeginTest() override { |
4777 // Verify default value. | 4761 // Verify default value. |
4778 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4762 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4828 | 4812 |
4829 void SetupTree() override { | 4813 void SetupTree() override { |
4830 LayerTreeHostTest::SetupTree(); | 4814 LayerTreeHostTest::SetupTree(); |
4831 | 4815 |
4832 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4816 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
4833 new FakeDisplayListRecordingSource); | 4817 new FakeDisplayListRecordingSource); |
4834 recording_source_ = recording_source.get(); | 4818 recording_source_ = recording_source.get(); |
4835 | 4819 |
4836 scoped_refptr<FakePictureLayer> layer = | 4820 scoped_refptr<FakePictureLayer> layer = |
4837 FakePictureLayer::CreateWithRecordingSource( | 4821 FakePictureLayer::CreateWithRecordingSource( |
4838 layer_settings(), &layer_client_, std::move(recording_source)); | 4822 &layer_client_, std::move(recording_source)); |
4839 layer_ = layer.get(); | 4823 layer_ = layer.get(); |
4840 | 4824 |
4841 layer->SetBounds(gfx::Size(10, 10)); | 4825 layer->SetBounds(gfx::Size(10, 10)); |
4842 layer->SetIsDrawable(true); | 4826 layer->SetIsDrawable(true); |
4843 layer_tree_host()->root_layer()->AddChild(layer); | 4827 layer_tree_host()->root_layer()->AddChild(layer); |
4844 layer_client_.set_bounds(layer_->bounds()); | 4828 layer_client_.set_bounds(layer_->bounds()); |
4845 } | 4829 } |
4846 | 4830 |
4847 void BeginTest() override { | 4831 void BeginTest() override { |
4848 // Verify default value. | 4832 // Verify default value. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { | 5241 class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { |
5258 protected: | 5242 protected: |
5259 LayerTreeHostTestCrispUpAfterPinchEnds() | 5243 LayerTreeHostTestCrispUpAfterPinchEnds() |
5260 : playback_allowed_event_(true, true) {} | 5244 : playback_allowed_event_(true, true) {} |
5261 | 5245 |
5262 void SetupTree() override { | 5246 void SetupTree() override { |
5263 frame_ = 1; | 5247 frame_ = 1; |
5264 posted_ = false; | 5248 posted_ = false; |
5265 client_.set_fill_with_nonsolid_color(true); | 5249 client_.set_fill_with_nonsolid_color(true); |
5266 | 5250 |
5267 scoped_refptr<Layer> root_clip = Layer::Create(layer_settings()); | 5251 scoped_refptr<Layer> root_clip = Layer::Create(); |
5268 root_clip->SetBounds(gfx::Size(500, 500)); | 5252 root_clip->SetBounds(gfx::Size(500, 500)); |
5269 scoped_refptr<Layer> page_scale_layer = Layer::Create(layer_settings()); | 5253 scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
5270 page_scale_layer->SetBounds(gfx::Size(500, 500)); | 5254 page_scale_layer->SetBounds(gfx::Size(500, 500)); |
5271 | 5255 |
5272 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); | 5256 scoped_refptr<Layer> pinch = Layer::Create(); |
5273 pinch->SetBounds(gfx::Size(500, 500)); | 5257 pinch->SetBounds(gfx::Size(500, 500)); |
5274 pinch->SetScrollClipLayerId(root_clip->id()); | 5258 pinch->SetScrollClipLayerId(root_clip->id()); |
5275 pinch->SetIsContainerForFixedPositionLayers(true); | 5259 pinch->SetIsContainerForFixedPositionLayers(true); |
5276 page_scale_layer->AddChild(pinch); | 5260 page_scale_layer->AddChild(pinch); |
5277 root_clip->AddChild(page_scale_layer); | 5261 root_clip->AddChild(page_scale_layer); |
5278 | 5262 |
5279 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5263 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5280 new FakeDisplayListRecordingSource); | 5264 new FakeDisplayListRecordingSource); |
5281 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5265 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
5282 scoped_refptr<FakePictureLayer> layer = | 5266 scoped_refptr<FakePictureLayer> layer = |
5283 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5267 FakePictureLayer::CreateWithRecordingSource(&client_, |
5284 std::move(recording)); | 5268 std::move(recording)); |
5285 layer->SetBounds(gfx::Size(500, 500)); | 5269 layer->SetBounds(gfx::Size(500, 500)); |
5286 layer->SetContentsOpaque(true); | 5270 layer->SetContentsOpaque(true); |
5287 // Avoid LCD text on the layer so we don't cause extra commits when we | 5271 // Avoid LCD text on the layer so we don't cause extra commits when we |
5288 // pinch. | 5272 // pinch. |
5289 pinch->AddChild(layer); | 5273 pinch->AddChild(layer); |
5290 | 5274 |
5291 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 5275 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
5292 nullptr); | 5276 nullptr); |
5293 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5277 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5471 protected: | 5455 protected: |
5472 RasterizeWithGpuRasterizationCreatesResources() {} | 5456 RasterizeWithGpuRasterizationCreatesResources() {} |
5473 | 5457 |
5474 void InitializeSettings(LayerTreeSettings* settings) override { | 5458 void InitializeSettings(LayerTreeSettings* settings) override { |
5475 settings->gpu_rasterization_forced = true; | 5459 settings->gpu_rasterization_forced = true; |
5476 } | 5460 } |
5477 | 5461 |
5478 void SetupTree() override { | 5462 void SetupTree() override { |
5479 client_.set_fill_with_nonsolid_color(true); | 5463 client_.set_fill_with_nonsolid_color(true); |
5480 | 5464 |
5481 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5465 scoped_refptr<Layer> root = Layer::Create(); |
5482 root->SetBounds(gfx::Size(500, 500)); | 5466 root->SetBounds(gfx::Size(500, 500)); |
5483 client_.set_bounds(root->bounds()); | 5467 client_.set_bounds(root->bounds()); |
5484 | 5468 |
5485 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5469 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5486 new FakeDisplayListRecordingSource); | 5470 new FakeDisplayListRecordingSource); |
5487 scoped_refptr<FakePictureLayer> layer = | 5471 scoped_refptr<FakePictureLayer> layer = |
5488 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5472 FakePictureLayer::CreateWithRecordingSource(&client_, |
5489 std::move(recording)); | 5473 std::move(recording)); |
5490 layer->SetBounds(gfx::Size(500, 500)); | 5474 layer->SetBounds(gfx::Size(500, 500)); |
5491 layer->SetContentsOpaque(true); | 5475 layer->SetContentsOpaque(true); |
5492 root->AddChild(layer); | 5476 root->AddChild(layer); |
5493 | 5477 |
5494 layer_tree_host()->SetRootLayer(root); | 5478 layer_tree_host()->SetRootLayer(root); |
5495 LayerTreeHostTest::SetupTree(); | 5479 LayerTreeHostTest::SetupTree(); |
5496 client_.set_bounds(root->bounds()); | 5480 client_.set_bounds(root->bounds()); |
5497 } | 5481 } |
5498 | 5482 |
(...skipping 21 matching lines...) Expand all Loading... |
5520 settings->gpu_rasterization_enabled = true; | 5504 settings->gpu_rasterization_enabled = true; |
5521 settings->gpu_rasterization_forced = true; | 5505 settings->gpu_rasterization_forced = true; |
5522 } | 5506 } |
5523 | 5507 |
5524 void SetupTree() override { | 5508 void SetupTree() override { |
5525 client_.set_fill_with_nonsolid_color(true); | 5509 client_.set_fill_with_nonsolid_color(true); |
5526 | 5510 |
5527 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5511 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5528 new FakeDisplayListRecordingSource); | 5512 new FakeDisplayListRecordingSource); |
5529 scoped_refptr<FakePictureLayer> root = | 5513 scoped_refptr<FakePictureLayer> root = |
5530 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5514 FakePictureLayer::CreateWithRecordingSource(&client_, |
5531 std::move(recording)); | 5515 std::move(recording)); |
5532 root->SetBounds(gfx::Size(10000, 10000)); | 5516 root->SetBounds(gfx::Size(10000, 10000)); |
5533 client_.set_bounds(root->bounds()); | 5517 client_.set_bounds(root->bounds()); |
5534 root->SetContentsOpaque(true); | 5518 root->SetContentsOpaque(true); |
5535 | 5519 |
5536 layer_tree_host()->SetRootLayer(root); | 5520 layer_tree_host()->SetRootLayer(root); |
5537 LayerTreeHostTest::SetupTree(); | 5521 LayerTreeHostTest::SetupTree(); |
5538 layer_tree_host()->SetViewportSize(viewport_size_); | 5522 layer_tree_host()->SetViewportSize(viewport_size_); |
5539 client_.set_bounds(root->bounds()); | 5523 client_.set_bounds(root->bounds()); |
5540 } | 5524 } |
(...skipping 21 matching lines...) Expand all Loading... |
5562 : public LayerTreeHostTest { | 5546 : public LayerTreeHostTest { |
5563 protected: | 5547 protected: |
5564 LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles() | 5548 LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles() |
5565 : playback_allowed_event_(true, true) {} | 5549 : playback_allowed_event_(true, true) {} |
5566 | 5550 |
5567 void SetupTree() override { | 5551 void SetupTree() override { |
5568 step_ = 1; | 5552 step_ = 1; |
5569 continuous_draws_ = 0; | 5553 continuous_draws_ = 0; |
5570 client_.set_fill_with_nonsolid_color(true); | 5554 client_.set_fill_with_nonsolid_color(true); |
5571 | 5555 |
5572 scoped_refptr<Layer> root_clip = Layer::Create(layer_settings()); | 5556 scoped_refptr<Layer> root_clip = Layer::Create(); |
5573 root_clip->SetBounds(gfx::Size(500, 500)); | 5557 root_clip->SetBounds(gfx::Size(500, 500)); |
5574 scoped_refptr<Layer> page_scale_layer = Layer::Create(layer_settings()); | 5558 scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
5575 page_scale_layer->SetBounds(gfx::Size(500, 500)); | 5559 page_scale_layer->SetBounds(gfx::Size(500, 500)); |
5576 | 5560 |
5577 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); | 5561 scoped_refptr<Layer> pinch = Layer::Create(); |
5578 pinch->SetBounds(gfx::Size(500, 500)); | 5562 pinch->SetBounds(gfx::Size(500, 500)); |
5579 pinch->SetScrollClipLayerId(root_clip->id()); | 5563 pinch->SetScrollClipLayerId(root_clip->id()); |
5580 pinch->SetIsContainerForFixedPositionLayers(true); | 5564 pinch->SetIsContainerForFixedPositionLayers(true); |
5581 page_scale_layer->AddChild(pinch); | 5565 page_scale_layer->AddChild(pinch); |
5582 root_clip->AddChild(page_scale_layer); | 5566 root_clip->AddChild(page_scale_layer); |
5583 | 5567 |
5584 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5568 scoped_ptr<FakeDisplayListRecordingSource> recording( |
5585 new FakeDisplayListRecordingSource); | 5569 new FakeDisplayListRecordingSource); |
5586 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5570 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
5587 scoped_refptr<FakePictureLayer> layer = | 5571 scoped_refptr<FakePictureLayer> layer = |
5588 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5572 FakePictureLayer::CreateWithRecordingSource(&client_, |
5589 std::move(recording)); | 5573 std::move(recording)); |
5590 layer->SetBounds(gfx::Size(500, 500)); | 5574 layer->SetBounds(gfx::Size(500, 500)); |
5591 layer->SetContentsOpaque(true); | 5575 layer->SetContentsOpaque(true); |
5592 // Avoid LCD text on the layer so we don't cause extra commits when we | 5576 // Avoid LCD text on the layer so we don't cause extra commits when we |
5593 // pinch. | 5577 // pinch. |
5594 pinch->AddChild(layer); | 5578 pinch->AddChild(layer); |
5595 | 5579 |
5596 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, | 5580 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, |
5597 nullptr); | 5581 nullptr); |
5598 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5582 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5739 | 5723 |
5740 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { | 5724 class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { |
5741 public: | 5725 public: |
5742 LayerTreeHostTestOneActivatePerPrepareTiles() | 5726 LayerTreeHostTestOneActivatePerPrepareTiles() |
5743 : notify_ready_to_activate_count_(0u), | 5727 : notify_ready_to_activate_count_(0u), |
5744 scheduled_prepare_tiles_count_(0) {} | 5728 scheduled_prepare_tiles_count_(0) {} |
5745 | 5729 |
5746 void SetupTree() override { | 5730 void SetupTree() override { |
5747 client_.set_fill_with_nonsolid_color(true); | 5731 client_.set_fill_with_nonsolid_color(true); |
5748 scoped_refptr<FakePictureLayer> root_layer = | 5732 scoped_refptr<FakePictureLayer> root_layer = |
5749 FakePictureLayer::Create(layer_settings(), &client_); | 5733 FakePictureLayer::Create(&client_); |
5750 root_layer->SetBounds(gfx::Size(1500, 1500)); | 5734 root_layer->SetBounds(gfx::Size(1500, 1500)); |
5751 root_layer->SetIsDrawable(true); | 5735 root_layer->SetIsDrawable(true); |
5752 | 5736 |
5753 layer_tree_host()->SetRootLayer(root_layer); | 5737 layer_tree_host()->SetRootLayer(root_layer); |
5754 LayerTreeHostTest::SetupTree(); | 5738 LayerTreeHostTest::SetupTree(); |
5755 client_.set_bounds(root_layer->bounds()); | 5739 client_.set_bounds(root_layer->bounds()); |
5756 } | 5740 } |
5757 | 5741 |
5758 void BeginTest() override { | 5742 void BeginTest() override { |
5759 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); | 5743 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5795 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); | 5779 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); |
5796 | 5780 |
5797 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps | 5781 class LayerTreeHostTestFrameTimingRequestsSaveTimestamps |
5798 : public LayerTreeHostTest { | 5782 : public LayerTreeHostTest { |
5799 public: | 5783 public: |
5800 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() | 5784 LayerTreeHostTestFrameTimingRequestsSaveTimestamps() |
5801 : check_results_on_commit_(false) {} | 5785 : check_results_on_commit_(false) {} |
5802 | 5786 |
5803 void SetupTree() override { | 5787 void SetupTree() override { |
5804 scoped_refptr<FakePictureLayer> root_layer = | 5788 scoped_refptr<FakePictureLayer> root_layer = |
5805 FakePictureLayer::Create(layer_settings(), &client_); | 5789 FakePictureLayer::Create(&client_); |
5806 root_layer->SetBounds(gfx::Size(200, 200)); | 5790 root_layer->SetBounds(gfx::Size(200, 200)); |
5807 root_layer->SetIsDrawable(true); | 5791 root_layer->SetIsDrawable(true); |
5808 | 5792 |
5809 scoped_refptr<FakePictureLayer> child_layer = | 5793 scoped_refptr<FakePictureLayer> child_layer = |
5810 FakePictureLayer::Create(layer_settings(), &client_); | 5794 FakePictureLayer::Create(&client_); |
5811 child_layer->SetBounds(gfx::Size(1500, 1500)); | 5795 child_layer->SetBounds(gfx::Size(1500, 1500)); |
5812 child_layer->SetIsDrawable(true); | 5796 child_layer->SetIsDrawable(true); |
5813 | 5797 |
5814 std::vector<FrameTimingRequest> requests; | 5798 std::vector<FrameTimingRequest> requests; |
5815 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); | 5799 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); |
5816 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); | 5800 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); |
5817 child_layer->SetFrameTimingRequests(requests); | 5801 child_layer->SetFrameTimingRequests(requests); |
5818 | 5802 |
5819 root_layer->AddChild(child_layer); | 5803 root_layer->AddChild(child_layer); |
5820 layer_tree_host()->SetRootLayer(root_layer); | 5804 layer_tree_host()->SetRootLayer(root_layer); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5883 MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); | 5867 MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); |
5884 | 5868 |
5885 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { | 5869 class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { |
5886 public: | 5870 public: |
5887 LayerTreeHostTestActivationCausesPrepareTiles() | 5871 LayerTreeHostTestActivationCausesPrepareTiles() |
5888 : scheduled_prepare_tiles_count_(0) {} | 5872 : scheduled_prepare_tiles_count_(0) {} |
5889 | 5873 |
5890 void SetupTree() override { | 5874 void SetupTree() override { |
5891 client_.set_fill_with_nonsolid_color(true); | 5875 client_.set_fill_with_nonsolid_color(true); |
5892 scoped_refptr<FakePictureLayer> root_layer = | 5876 scoped_refptr<FakePictureLayer> root_layer = |
5893 FakePictureLayer::Create(layer_settings(), &client_); | 5877 FakePictureLayer::Create(&client_); |
5894 root_layer->SetBounds(gfx::Size(150, 150)); | 5878 root_layer->SetBounds(gfx::Size(150, 150)); |
5895 root_layer->SetIsDrawable(true); | 5879 root_layer->SetIsDrawable(true); |
5896 | 5880 |
5897 layer_tree_host()->SetRootLayer(root_layer); | 5881 layer_tree_host()->SetRootLayer(root_layer); |
5898 LayerTreeHostTest::SetupTree(); | 5882 LayerTreeHostTest::SetupTree(); |
5899 client_.set_bounds(root_layer->bounds()); | 5883 client_.set_bounds(root_layer->bounds()); |
5900 } | 5884 } |
5901 | 5885 |
5902 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5886 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5903 | 5887 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5962 | 5946 |
5963 private: | 5947 private: |
5964 bool did_commit_; | 5948 bool did_commit_; |
5965 }; | 5949 }; |
5966 | 5950 |
5967 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 5951 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
5968 | 5952 |
5969 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { | 5953 class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { |
5970 protected: | 5954 protected: |
5971 void SetupTree() override { | 5955 void SetupTree() override { |
5972 root = Layer::Create(layer_settings()); | 5956 root = Layer::Create(); |
5973 child = Layer::Create(layer_settings()); | 5957 child = Layer::Create(); |
5974 root->AddChild(child); | 5958 root->AddChild(child); |
5975 layer_tree_host()->SetRootLayer(root); | 5959 layer_tree_host()->SetRootLayer(root); |
5976 LayerTreeHostTest::SetupTree(); | 5960 LayerTreeHostTest::SetupTree(); |
5977 } | 5961 } |
5978 | 5962 |
5979 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 5963 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
5980 | 5964 |
5981 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5965 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
5982 | 5966 |
5983 void WillCommit() override { | 5967 void WillCommit() override { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6021 | 6005 |
6022 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); | 6006 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); |
6023 | 6007 |
6024 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { | 6008 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { |
6025 protected: | 6009 protected: |
6026 void SetupTree() override { | 6010 void SetupTree() override { |
6027 // The masked layer has bounds 50x50, but it has a child that causes | 6011 // The masked layer has bounds 50x50, but it has a child that causes |
6028 // the surface bounds to be larger. It also has a parent that clips the | 6012 // the surface bounds to be larger. It also has a parent that clips the |
6029 // masked layer and its surface. | 6013 // masked layer and its surface. |
6030 | 6014 |
6031 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6015 scoped_refptr<Layer> root = Layer::Create(); |
6032 | 6016 |
6033 scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings()); | 6017 scoped_refptr<Layer> clipping_layer = Layer::Create(); |
6034 root->AddChild(clipping_layer); | 6018 root->AddChild(clipping_layer); |
6035 | 6019 |
6036 scoped_refptr<FakePictureLayer> content_layer = | 6020 scoped_refptr<FakePictureLayer> content_layer = |
6037 FakePictureLayer::Create(layer_settings(), &client_); | 6021 FakePictureLayer::Create(&client_); |
6038 clipping_layer->AddChild(content_layer); | 6022 clipping_layer->AddChild(content_layer); |
6039 | 6023 |
6040 scoped_refptr<FakePictureLayer> content_child_layer = | 6024 scoped_refptr<FakePictureLayer> content_child_layer = |
6041 FakePictureLayer::Create(layer_settings(), &client_); | 6025 FakePictureLayer::Create(&client_); |
6042 content_layer->AddChild(content_child_layer); | 6026 content_layer->AddChild(content_child_layer); |
6043 | 6027 |
6044 scoped_refptr<FakePictureLayer> mask_layer = | 6028 scoped_refptr<FakePictureLayer> mask_layer = |
6045 FakePictureLayer::Create(layer_settings(), &client_); | 6029 FakePictureLayer::Create(&client_); |
6046 content_layer->SetMaskLayer(mask_layer.get()); | 6030 content_layer->SetMaskLayer(mask_layer.get()); |
6047 | 6031 |
6048 gfx::Size root_size(100, 100); | 6032 gfx::Size root_size(100, 100); |
6049 root->SetBounds(root_size); | 6033 root->SetBounds(root_size); |
6050 | 6034 |
6051 gfx::PointF clipping_origin(20.f, 10.f); | 6035 gfx::PointF clipping_origin(20.f, 10.f); |
6052 gfx::Size clipping_size(10, 20); | 6036 gfx::Size clipping_size(10, 20); |
6053 clipping_layer->SetBounds(clipping_size); | 6037 clipping_layer->SetBounds(clipping_size); |
6054 clipping_layer->SetPosition(clipping_origin); | 6038 clipping_layer->SetPosition(clipping_origin); |
6055 clipping_layer->SetMasksToBounds(true); | 6039 clipping_layer->SetMasksToBounds(true); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6118 } | 6102 } |
6119 | 6103 |
6120 void SetupTree() override { | 6104 void SetupTree() override { |
6121 // Root | 6105 // Root |
6122 // | | 6106 // | |
6123 // +-- Scaling Layer (adds a 2x scale) | 6107 // +-- Scaling Layer (adds a 2x scale) |
6124 // | | 6108 // | |
6125 // +-- Content Layer | 6109 // +-- Content Layer |
6126 // +--Mask | 6110 // +--Mask |
6127 | 6111 |
6128 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6112 scoped_refptr<Layer> root = Layer::Create(); |
6129 | 6113 |
6130 scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings()); | 6114 scoped_refptr<Layer> scaling_layer = Layer::Create(); |
6131 root->AddChild(scaling_layer); | 6115 root->AddChild(scaling_layer); |
6132 | 6116 |
6133 scoped_refptr<FakePictureLayer> content_layer = | 6117 scoped_refptr<FakePictureLayer> content_layer = |
6134 FakePictureLayer::Create(layer_settings(), &client_); | 6118 FakePictureLayer::Create(&client_); |
6135 scaling_layer->AddChild(content_layer); | 6119 scaling_layer->AddChild(content_layer); |
6136 | 6120 |
6137 scoped_refptr<FakePictureLayer> mask_layer = | 6121 scoped_refptr<FakePictureLayer> mask_layer = |
6138 FakePictureLayer::Create(layer_settings(), &client_); | 6122 FakePictureLayer::Create(&client_); |
6139 content_layer->SetMaskLayer(mask_layer.get()); | 6123 content_layer->SetMaskLayer(mask_layer.get()); |
6140 | 6124 |
6141 gfx::Size root_size(100, 100); | 6125 gfx::Size root_size(100, 100); |
6142 root->SetBounds(root_size); | 6126 root->SetBounds(root_size); |
6143 | 6127 |
6144 gfx::Size scaling_layer_size(50, 50); | 6128 gfx::Size scaling_layer_size(50, 50); |
6145 scaling_layer->SetBounds(scaling_layer_size); | 6129 scaling_layer->SetBounds(scaling_layer_size); |
6146 gfx::Transform scale; | 6130 gfx::Transform scale; |
6147 scale.Scale(2.f, 2.f); | 6131 scale.Scale(2.f, 2.f); |
6148 scaling_layer->SetTransform(scale); | 6132 scaling_layer->SetTransform(scale); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6214 }; | 6198 }; |
6215 | 6199 |
6216 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); | 6200 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); |
6217 | 6201 |
6218 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { | 6202 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { |
6219 protected: | 6203 protected: |
6220 void SetupTree() override { | 6204 void SetupTree() override { |
6221 // The mask layer has bounds 100x100 but is attached to a layer with bounds | 6205 // The mask layer has bounds 100x100 but is attached to a layer with bounds |
6222 // 50x50. | 6206 // 50x50. |
6223 | 6207 |
6224 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6208 scoped_refptr<Layer> root = Layer::Create(); |
6225 | 6209 |
6226 scoped_refptr<FakePictureLayer> content_layer = | 6210 scoped_refptr<FakePictureLayer> content_layer = |
6227 FakePictureLayer::Create(layer_settings(), &client_); | 6211 FakePictureLayer::Create(&client_); |
6228 root->AddChild(content_layer); | 6212 root->AddChild(content_layer); |
6229 | 6213 |
6230 scoped_refptr<FakePictureLayer> mask_layer = | 6214 scoped_refptr<FakePictureLayer> mask_layer = |
6231 FakePictureLayer::Create(layer_settings(), &client_); | 6215 FakePictureLayer::Create(&client_); |
6232 content_layer->SetMaskLayer(mask_layer.get()); | 6216 content_layer->SetMaskLayer(mask_layer.get()); |
6233 | 6217 |
6234 gfx::Size root_size(100, 100); | 6218 gfx::Size root_size(100, 100); |
6235 root->SetBounds(root_size); | 6219 root->SetBounds(root_size); |
6236 | 6220 |
6237 gfx::Size layer_size(50, 50); | 6221 gfx::Size layer_size(50, 50); |
6238 content_layer->SetBounds(layer_size); | 6222 content_layer->SetBounds(layer_size); |
6239 | 6223 |
6240 gfx::Size mask_size(100, 100); | 6224 gfx::Size mask_size(100, 100); |
6241 mask_layer->SetBounds(mask_size); | 6225 mask_layer->SetBounds(mask_size); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6303 | 6287 |
6304 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); | 6288 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); |
6305 | 6289 |
6306 class LayerTreeTestReflectionMaskLayerWithDifferentBounds | 6290 class LayerTreeTestReflectionMaskLayerWithDifferentBounds |
6307 : public LayerTreeTest { | 6291 : public LayerTreeTest { |
6308 protected: | 6292 protected: |
6309 void SetupTree() override { | 6293 void SetupTree() override { |
6310 // The replica's mask layer has bounds 100x100 but the replica is of a | 6294 // The replica's mask layer has bounds 100x100 but the replica is of a |
6311 // layer with bounds 50x50. | 6295 // layer with bounds 50x50. |
6312 | 6296 |
6313 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6297 scoped_refptr<Layer> root = Layer::Create(); |
6314 | 6298 |
6315 scoped_refptr<FakePictureLayer> content_layer = | 6299 scoped_refptr<FakePictureLayer> content_layer = |
6316 FakePictureLayer::Create(layer_settings(), &client_); | 6300 FakePictureLayer::Create(&client_); |
6317 root->AddChild(content_layer); | 6301 root->AddChild(content_layer); |
6318 | 6302 |
6319 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); | 6303 scoped_refptr<Layer> replica_layer = Layer::Create(); |
6320 content_layer->SetReplicaLayer(replica_layer.get()); | 6304 content_layer->SetReplicaLayer(replica_layer.get()); |
6321 | 6305 |
6322 scoped_refptr<FakePictureLayer> mask_layer = | 6306 scoped_refptr<FakePictureLayer> mask_layer = |
6323 FakePictureLayer::Create(layer_settings(), &client_); | 6307 FakePictureLayer::Create(&client_); |
6324 replica_layer->SetMaskLayer(mask_layer.get()); | 6308 replica_layer->SetMaskLayer(mask_layer.get()); |
6325 | 6309 |
6326 gfx::Size root_size(100, 100); | 6310 gfx::Size root_size(100, 100); |
6327 root->SetBounds(root_size); | 6311 root->SetBounds(root_size); |
6328 | 6312 |
6329 gfx::Size layer_size(50, 50); | 6313 gfx::Size layer_size(50, 50); |
6330 content_layer->SetBounds(layer_size); | 6314 content_layer->SetBounds(layer_size); |
6331 | 6315 |
6332 gfx::Size mask_size(100, 100); | 6316 gfx::Size mask_size(100, 100); |
6333 mask_layer->SetBounds(mask_size); | 6317 mask_layer->SetBounds(mask_size); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 SINGLE_AND_MULTI_THREAD_TEST_F( | 6381 SINGLE_AND_MULTI_THREAD_TEST_F( |
6398 LayerTreeTestReflectionMaskLayerWithDifferentBounds); | 6382 LayerTreeTestReflectionMaskLayerWithDifferentBounds); |
6399 | 6383 |
6400 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild | 6384 class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild |
6401 : public LayerTreeTest { | 6385 : public LayerTreeTest { |
6402 protected: | 6386 protected: |
6403 void SetupTree() override { | 6387 void SetupTree() override { |
6404 // The replica is of a layer with bounds 50x50, but it has a child that | 6388 // The replica is of a layer with bounds 50x50, but it has a child that |
6405 // causes the surface bounds to be larger. | 6389 // causes the surface bounds to be larger. |
6406 | 6390 |
6407 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6391 scoped_refptr<Layer> root = Layer::Create(); |
6408 | 6392 |
6409 scoped_refptr<FakePictureLayer> content_layer = | 6393 scoped_refptr<FakePictureLayer> content_layer = |
6410 FakePictureLayer::Create(layer_settings(), &client_); | 6394 FakePictureLayer::Create(&client_); |
6411 root->AddChild(content_layer); | 6395 root->AddChild(content_layer); |
6412 | 6396 |
6413 content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 6397 content_child_layer_ = FakePictureLayer::Create(&client_); |
6414 content_layer->AddChild(content_child_layer_); | 6398 content_layer->AddChild(content_child_layer_); |
6415 | 6399 |
6416 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); | 6400 scoped_refptr<Layer> replica_layer = Layer::Create(); |
6417 content_layer->SetReplicaLayer(replica_layer.get()); | 6401 content_layer->SetReplicaLayer(replica_layer.get()); |
6418 | 6402 |
6419 scoped_refptr<FakePictureLayer> mask_layer = | 6403 scoped_refptr<FakePictureLayer> mask_layer = |
6420 FakePictureLayer::Create(layer_settings(), &client_); | 6404 FakePictureLayer::Create(&client_); |
6421 replica_layer->SetMaskLayer(mask_layer.get()); | 6405 replica_layer->SetMaskLayer(mask_layer.get()); |
6422 | 6406 |
6423 gfx::Size root_size(100, 100); | 6407 gfx::Size root_size(100, 100); |
6424 root->SetBounds(root_size); | 6408 root->SetBounds(root_size); |
6425 | 6409 |
6426 gfx::Size layer_size(50, 50); | 6410 gfx::Size layer_size(50, 50); |
6427 content_layer->SetBounds(layer_size); | 6411 content_layer->SetBounds(layer_size); |
6428 content_child_layer_->SetBounds(layer_size); | 6412 content_child_layer_->SetBounds(layer_size); |
6429 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); | 6413 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); |
6430 | 6414 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6502 protected: | 6486 protected: |
6503 void SetupTree() override { | 6487 void SetupTree() override { |
6504 // -root | 6488 // -root |
6505 // -pre page scale | 6489 // -pre page scale |
6506 // -page scale | 6490 // -page scale |
6507 // -page scale child1 | 6491 // -page scale child1 |
6508 // -page scale grandchild | 6492 // -page scale grandchild |
6509 // -page scale child2 | 6493 // -page scale child2 |
6510 // -post page scale | 6494 // -post page scale |
6511 | 6495 |
6512 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6496 scoped_refptr<Layer> root = Layer::Create(); |
6513 scoped_refptr<Layer> pre_page_scale = Layer::Create(layer_settings()); | 6497 scoped_refptr<Layer> pre_page_scale = Layer::Create(); |
6514 scoped_refptr<Layer> page_scale = Layer::Create(layer_settings()); | 6498 scoped_refptr<Layer> page_scale = Layer::Create(); |
6515 scoped_refptr<Layer> page_scale_child1 = Layer::Create(layer_settings()); | 6499 scoped_refptr<Layer> page_scale_child1 = Layer::Create(); |
6516 scoped_refptr<Layer> page_scale_grandchild = | 6500 scoped_refptr<Layer> page_scale_grandchild = Layer::Create(); |
6517 Layer::Create(layer_settings()); | 6501 scoped_refptr<Layer> page_scale_child2 = Layer::Create(); |
6518 scoped_refptr<Layer> page_scale_child2 = Layer::Create(layer_settings()); | 6502 scoped_refptr<Layer> post_page_scale = Layer::Create(); |
6519 scoped_refptr<Layer> post_page_scale = Layer::Create(layer_settings()); | |
6520 | 6503 |
6521 root->AddChild(pre_page_scale); | 6504 root->AddChild(pre_page_scale); |
6522 root->AddChild(page_scale); | 6505 root->AddChild(page_scale); |
6523 root->AddChild(post_page_scale); | 6506 root->AddChild(post_page_scale); |
6524 | 6507 |
6525 page_scale->AddChild(page_scale_child1); | 6508 page_scale->AddChild(page_scale_child1); |
6526 page_scale->AddChild(page_scale_child2); | 6509 page_scale->AddChild(page_scale_child2); |
6527 page_scale_child1->AddChild(page_scale_grandchild); | 6510 page_scale_child1->AddChild(page_scale_grandchild); |
6528 | 6511 |
6529 layer_tree_host()->SetRootLayer(root); | 6512 layer_tree_host()->SetRootLayer(root); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6571 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); | 6554 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); |
6572 | 6555 |
6573 class LayerTreeHostScrollingAndScalingUpdatesLayers : public LayerTreeHostTest { | 6556 class LayerTreeHostScrollingAndScalingUpdatesLayers : public LayerTreeHostTest { |
6574 public: | 6557 public: |
6575 LayerTreeHostScrollingAndScalingUpdatesLayers() | 6558 LayerTreeHostScrollingAndScalingUpdatesLayers() |
6576 : requested_update_layers_(false), commit_count_(0) {} | 6559 : requested_update_layers_(false), commit_count_(0) {} |
6577 | 6560 |
6578 void SetupTree() override { | 6561 void SetupTree() override { |
6579 LayerTreeHostTest::SetupTree(); | 6562 LayerTreeHostTest::SetupTree(); |
6580 Layer* root_layer = layer_tree_host()->root_layer(); | 6563 Layer* root_layer = layer_tree_host()->root_layer(); |
6581 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); | 6564 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
6582 CreateVirtualViewportLayers(root_layer, scroll_layer, root_layer->bounds(), | 6565 CreateVirtualViewportLayers(root_layer, scroll_layer, root_layer->bounds(), |
6583 root_layer->bounds(), layer_tree_host(), | 6566 root_layer->bounds(), layer_tree_host()); |
6584 layer_settings()); | |
6585 } | 6567 } |
6586 | 6568 |
6587 void BeginTest() override { | 6569 void BeginTest() override { |
6588 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 6570 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
6589 scroll.layer_id = layer_tree_host()->root_layer()->id(); | 6571 scroll.layer_id = layer_tree_host()->root_layer()->id(); |
6590 scroll.scroll_delta = gfx::Vector2d(0, 33); | 6572 scroll.scroll_delta = gfx::Vector2d(0, 33); |
6591 scroll_info_.scrolls.push_back(scroll); | 6573 scroll_info_.scrolls.push_back(scroll); |
6592 | 6574 |
6593 scale_info_.page_scale_delta = 2.71f; | 6575 scale_info_.page_scale_delta = 2.71f; |
6594 | 6576 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6670 EndTest(); | 6652 EndTest(); |
6671 } | 6653 } |
6672 | 6654 |
6673 void AfterTest() override {} | 6655 void AfterTest() override {} |
6674 }; | 6656 }; |
6675 | 6657 |
6676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6658 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
6677 | 6659 |
6678 } // namespace | 6660 } // namespace |
6679 } // namespace cc | 6661 } // namespace cc |
OLD | NEW |