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