| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 gfx::ScrollOffset final_scroll_offset_; | 765 gfx::ScrollOffset final_scroll_offset_; |
| 766 | 766 |
| 767 FakeContentLayerClient fake_content_layer_client_; | 767 FakeContentLayerClient fake_content_layer_client_; |
| 768 | 768 |
| 769 scoped_refptr<Layer> root_scroll_layer_; | 769 scoped_refptr<Layer> root_scroll_layer_; |
| 770 scoped_refptr<Layer> child_layer_; | 770 scoped_refptr<Layer> child_layer_; |
| 771 scoped_refptr<Layer> expected_scroll_layer_; | 771 scoped_refptr<Layer> expected_scroll_layer_; |
| 772 scoped_refptr<Layer> expected_no_scroll_layer_; | 772 scoped_refptr<Layer> expected_no_scroll_layer_; |
| 773 }; | 773 }; |
| 774 | 774 |
| 775 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 775 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor1_ScrollChild) { |
| 776 DeviceScaleFactor1_ScrollChild_DirectRenderer) { | |
| 777 device_scale_factor_ = 1.f; | 776 device_scale_factor_ = 1.f; |
| 778 scroll_child_layer_ = true; | 777 scroll_child_layer_ = true; |
| 779 RunTest(CompositorMode::THREADED, false); | 778 RunTest(CompositorMode::THREADED); |
| 779 } |
| 780 |
| 781 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor15_ScrollChild) { |
| 782 device_scale_factor_ = 1.5f; |
| 783 scroll_child_layer_ = true; |
| 784 RunTest(CompositorMode::THREADED); |
| 785 } |
| 786 |
| 787 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor2_ScrollChild) { |
| 788 device_scale_factor_ = 2.f; |
| 789 scroll_child_layer_ = true; |
| 790 RunTest(CompositorMode::THREADED); |
| 780 } | 791 } |
| 781 | 792 |
| 782 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 793 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| 783 DeviceScaleFactor1_ScrollChild_DelegatingRenderer) { | 794 DeviceScaleFactor1_ScrollRootScrollLayer) { |
| 784 device_scale_factor_ = 1.f; | 795 device_scale_factor_ = 1.f; |
| 785 scroll_child_layer_ = true; | 796 scroll_child_layer_ = false; |
| 786 RunTest(CompositorMode::THREADED, true); | 797 RunTest(CompositorMode::THREADED); |
| 787 } | 798 } |
| 788 | 799 |
| 789 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 800 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| 790 DeviceScaleFactor15_ScrollChild_DirectRenderer) { | 801 DeviceScaleFactor15_ScrollRootScrollLayer) { |
| 791 device_scale_factor_ = 1.5f; | 802 device_scale_factor_ = 1.5f; |
| 792 scroll_child_layer_ = true; | 803 scroll_child_layer_ = false; |
| 793 RunTest(CompositorMode::THREADED, false); | 804 RunTest(CompositorMode::THREADED); |
| 794 } | 805 } |
| 795 | 806 |
| 796 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 807 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| 797 DeviceScaleFactor15_ScrollChild_DelegatingRenderer) { | 808 DeviceScaleFactor2_ScrollRootScrollLayer) { |
| 798 device_scale_factor_ = 1.5f; | |
| 799 scroll_child_layer_ = true; | |
| 800 RunTest(CompositorMode::THREADED, true); | |
| 801 } | |
| 802 | |
| 803 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 804 DeviceScaleFactor2_ScrollChild_DirectRenderer) { | |
| 805 device_scale_factor_ = 2.f; | |
| 806 scroll_child_layer_ = true; | |
| 807 RunTest(CompositorMode::THREADED, false); | |
| 808 } | |
| 809 | |
| 810 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 811 DeviceScaleFactor2_ScrollChild_DelegatingRenderer) { | |
| 812 device_scale_factor_ = 2.f; | |
| 813 scroll_child_layer_ = true; | |
| 814 RunTest(CompositorMode::THREADED, true); | |
| 815 } | |
| 816 | |
| 817 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 818 DeviceScaleFactor1_ScrollRootScrollLayer_DirectRenderer) { | |
| 819 device_scale_factor_ = 1.f; | |
| 820 scroll_child_layer_ = false; | |
| 821 RunTest(CompositorMode::THREADED, false); | |
| 822 } | |
| 823 | |
| 824 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 825 DeviceScaleFactor1_ScrollRootScrollLayer_DelegatingRenderer) { | |
| 826 device_scale_factor_ = 1.f; | |
| 827 scroll_child_layer_ = false; | |
| 828 RunTest(CompositorMode::THREADED, true); | |
| 829 } | |
| 830 | |
| 831 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 832 DeviceScaleFactor15_ScrollRootScrollLayer_DirectRenderer) { | |
| 833 device_scale_factor_ = 1.5f; | |
| 834 scroll_child_layer_ = false; | |
| 835 RunTest(CompositorMode::THREADED, false); | |
| 836 } | |
| 837 | |
| 838 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 839 DeviceScaleFactor15_ScrollRootScrollLayer_DelegatingRenderer) { | |
| 840 device_scale_factor_ = 1.5f; | |
| 841 scroll_child_layer_ = false; | |
| 842 RunTest(CompositorMode::THREADED, true); | |
| 843 } | |
| 844 | |
| 845 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 846 DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer) { | |
| 847 device_scale_factor_ = 2.f; | 809 device_scale_factor_ = 2.f; |
| 848 scroll_child_layer_ = false; | 810 scroll_child_layer_ = false; |
| 849 RunTest(CompositorMode::THREADED, false); | 811 RunTest(CompositorMode::THREADED); |
| 850 } | |
| 851 | |
| 852 TEST_F(LayerTreeHostScrollTestCaseWithChild, | |
| 853 DeviceScaleFactor2_ScrollRootScrollLayer_DelegatingRenderer) { | |
| 854 device_scale_factor_ = 2.f; | |
| 855 scroll_child_layer_ = false; | |
| 856 RunTest(CompositorMode::THREADED, true); | |
| 857 } | 812 } |
| 858 | 813 |
| 859 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { | 814 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { |
| 860 public: | 815 public: |
| 861 LayerTreeHostScrollTestSimple() | 816 LayerTreeHostScrollTestSimple() |
| 862 : initial_scroll_(10, 20), | 817 : initial_scroll_(10, 20), |
| 863 main_thread_scroll_(40, 5), | 818 main_thread_scroll_(40, 5), |
| 864 impl_thread_scroll1_(2, -1), | 819 impl_thread_scroll1_(2, -1), |
| 865 impl_thread_scroll2_(-3, 10), | 820 impl_thread_scroll2_(-3, 10), |
| 866 num_scrolls_(0) {} | 821 num_scrolls_(0) {} |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 int root_scroll_layer_id_; | 1445 int root_scroll_layer_id_; |
| 1491 int sibling_scroll_layer_id_; | 1446 int sibling_scroll_layer_id_; |
| 1492 int child_scroll_layer_id_; | 1447 int child_scroll_layer_id_; |
| 1493 | 1448 |
| 1494 FakeContentLayerClient fake_content_layer_client_; | 1449 FakeContentLayerClient fake_content_layer_client_; |
| 1495 | 1450 |
| 1496 bool scroll_destroy_whole_tree_; | 1451 bool scroll_destroy_whole_tree_; |
| 1497 }; | 1452 }; |
| 1498 | 1453 |
| 1499 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { | 1454 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { |
| 1500 RunTest(CompositorMode::THREADED, false); | 1455 RunTest(CompositorMode::THREADED); |
| 1501 } | 1456 } |
| 1502 | 1457 |
| 1503 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1458 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1504 scroll_destroy_whole_tree_ = true; | 1459 scroll_destroy_whole_tree_ = true; |
| 1505 RunTest(CompositorMode::THREADED, false); | 1460 RunTest(CompositorMode::THREADED); |
| 1506 } | 1461 } |
| 1507 | 1462 |
| 1508 class LayerTreeHostScrollTestScrollMFBA : public LayerTreeHostScrollTest { | 1463 class LayerTreeHostScrollTestScrollMFBA : public LayerTreeHostScrollTest { |
| 1509 public: | 1464 public: |
| 1510 LayerTreeHostScrollTestScrollMFBA() | 1465 LayerTreeHostScrollTestScrollMFBA() |
| 1511 : initial_scroll_(10, 20), | 1466 : initial_scroll_(10, 20), |
| 1512 second_scroll_(40, 5), | 1467 second_scroll_(40, 5), |
| 1513 third_scroll_(20, 10), | 1468 third_scroll_(20, 10), |
| 1514 scroll_amount_(2, -1), | 1469 scroll_amount_(2, -1), |
| 1515 num_commits_(0), | 1470 num_commits_(0), |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 int num_impl_commits_; | 1805 int num_impl_commits_; |
| 1851 int num_aborted_commits_; | 1806 int num_aborted_commits_; |
| 1852 int num_impl_scrolls_; | 1807 int num_impl_scrolls_; |
| 1853 int num_draws_; | 1808 int num_draws_; |
| 1854 }; | 1809 }; |
| 1855 | 1810 |
| 1856 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); | 1811 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA); |
| 1857 | 1812 |
| 1858 } // namespace | 1813 } // namespace |
| 1859 } // namespace cc | 1814 } // namespace cc |
| OLD | NEW |