| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 780 |
| 781 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 781 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 782 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); | 782 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); |
| 783 | 783 |
| 784 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 784 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 785 impl->output_surface()->context3d()); | 785 impl->output_surface()->context3d()); |
| 786 | 786 |
| 787 switch (impl->active_tree()->source_frame_number()) { | 787 switch (impl->active_tree()->source_frame_number()) { |
| 788 case 0: | 788 case 0: |
| 789 // Number of textures should be one for each layer | 789 // Number of textures should be one for each layer |
| 790 ASSERT_EQ(2u, context->NumTextures()); | 790 ASSERT_EQ(2, context->NumTextures()); |
| 791 // Number of textures used for commit should be one for each layer. | 791 // Number of textures used for commit should be one for each layer. |
| 792 EXPECT_EQ(2u, context->NumUsedTextures()); | 792 EXPECT_EQ(2, context->NumUsedTextures()); |
| 793 // Verify that used texture is correct. | 793 // Verify that used texture is correct. |
| 794 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 794 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 795 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 795 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 796 | 796 |
| 797 context->ResetUsedTextures(); | 797 context->ResetUsedTextures(); |
| 798 PostSetNeedsCommitToMainThread(); | 798 PostSetNeedsCommitToMainThread(); |
| 799 break; | 799 break; |
| 800 case 1: | 800 case 1: |
| 801 // Number of textures should be doubled as the first textures | 801 // Number of textures should be doubled as the first textures |
| 802 // are used by impl thread and cannot by used for update. | 802 // are used by impl thread and cannot by used for update. |
| 803 ASSERT_EQ(4u, context->NumTextures()); | 803 ASSERT_EQ(4, context->NumTextures()); |
| 804 // Number of textures used for commit should still be | 804 // Number of textures used for commit should still be |
| 805 // one for each layer. | 805 // one for each layer. |
| 806 EXPECT_EQ(2u, context->NumUsedTextures()); | 806 EXPECT_EQ(2, context->NumUsedTextures()); |
| 807 // First textures should not have been used. | 807 // First textures should not have been used. |
| 808 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 808 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| 809 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 809 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| 810 // New textures should have been used. | 810 // New textures should have been used. |
| 811 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 811 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 812 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 812 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 813 | 813 |
| 814 context->ResetUsedTextures(); | 814 context->ResetUsedTextures(); |
| 815 PostSetNeedsCommitToMainThread(); | 815 PostSetNeedsCommitToMainThread(); |
| 816 break; | 816 break; |
| 817 case 2: | 817 case 2: |
| 818 EndTest(); | 818 EndTest(); |
| 819 break; | 819 break; |
| 820 default: | 820 default: |
| 821 NOTREACHED(); | 821 NOTREACHED(); |
| 822 break; | 822 break; |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 826 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 827 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 827 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 828 impl->output_surface()->context3d()); | 828 impl->output_surface()->context3d()); |
| 829 | 829 |
| 830 // Number of textures used for draw should always be one for each layer. | 830 // Number of textures used for draw should always be one for each layer. |
| 831 EXPECT_EQ(2u, context->NumUsedTextures()); | 831 EXPECT_EQ(2, context->NumUsedTextures()); |
| 832 context->ResetUsedTextures(); | 832 context->ResetUsedTextures(); |
| 833 } | 833 } |
| 834 | 834 |
| 835 virtual void Layout() OVERRIDE { | 835 virtual void Layout() OVERRIDE { |
| 836 layer_->SetNeedsDisplay(); | 836 layer_->SetNeedsDisplay(); |
| 837 scrollbar_->SetNeedsDisplay(); | 837 scrollbar_->SetNeedsDisplay(); |
| 838 } | 838 } |
| 839 | 839 |
| 840 virtual void AfterTest() OVERRIDE {} | 840 virtual void AfterTest() OVERRIDE {} |
| 841 | 841 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 | 909 |
| 910 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 910 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 911 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); | 911 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); |
| 912 | 912 |
| 913 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 913 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 914 impl->output_surface()->context3d()); | 914 impl->output_surface()->context3d()); |
| 915 | 915 |
| 916 switch (impl->active_tree()->source_frame_number()) { | 916 switch (impl->active_tree()->source_frame_number()) { |
| 917 case 0: | 917 case 0: |
| 918 // Number of textures should be one for each layer. | 918 // Number of textures should be one for each layer. |
| 919 ASSERT_EQ(4u, context->NumTextures()); | 919 ASSERT_EQ(4, context->NumTextures()); |
| 920 // Number of textures used for commit should be one for each layer. | 920 // Number of textures used for commit should be one for each layer. |
| 921 EXPECT_EQ(4u, context->NumUsedTextures()); | 921 EXPECT_EQ(4, context->NumUsedTextures()); |
| 922 // Verify that used textures are correct. | 922 // Verify that used textures are correct. |
| 923 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 923 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 924 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 924 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 925 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 925 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 926 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 926 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 927 | 927 |
| 928 context->ResetUsedTextures(); | 928 context->ResetUsedTextures(); |
| 929 PostSetNeedsCommitToMainThread(); | 929 PostSetNeedsCommitToMainThread(); |
| 930 break; | 930 break; |
| 931 case 1: | 931 case 1: |
| 932 // Number of textures should be two for each content layer and one | 932 // Number of textures should be two for each content layer and one |
| 933 // for each scrollbar, since they always do a partial update. | 933 // for each scrollbar, since they always do a partial update. |
| 934 ASSERT_EQ(6u, context->NumTextures()); | 934 ASSERT_EQ(6, context->NumTextures()); |
| 935 // Number of textures used for commit should be one for each content | 935 // Number of textures used for commit should be one for each content |
| 936 // layer, and one for the scrollbar layer that paints. | 936 // layer, and one for the scrollbar layer that paints. |
| 937 EXPECT_EQ(3u, context->NumUsedTextures()); | 937 EXPECT_EQ(3, context->NumUsedTextures()); |
| 938 | 938 |
| 939 // First content textures should not have been used. | 939 // First content textures should not have been used. |
| 940 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 940 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| 941 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 941 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| 942 // The non-painting scrollbar's texture wasn't updated. | 942 // The non-painting scrollbar's texture wasn't updated. |
| 943 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); | 943 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| 944 // The painting scrollbar's partial update texture was used. | 944 // The painting scrollbar's partial update texture was used. |
| 945 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 945 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 946 // New textures should have been used. | 946 // New textures should have been used. |
| 947 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); | 947 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| 948 EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); | 948 EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); |
| 949 | 949 |
| 950 context->ResetUsedTextures(); | 950 context->ResetUsedTextures(); |
| 951 PostSetNeedsCommitToMainThread(); | 951 PostSetNeedsCommitToMainThread(); |
| 952 break; | 952 break; |
| 953 case 2: | 953 case 2: |
| 954 // Number of textures should be two for each content layer and one | 954 // Number of textures should be two for each content layer and one |
| 955 // for each scrollbar, since they always do a partial update. | 955 // for each scrollbar, since they always do a partial update. |
| 956 ASSERT_EQ(6u, context->NumTextures()); | 956 ASSERT_EQ(6, context->NumTextures()); |
| 957 // Number of textures used for commit should be one for each content | 957 // Number of textures used for commit should be one for each content |
| 958 // layer, and one for the scrollbar layer that paints. | 958 // layer, and one for the scrollbar layer that paints. |
| 959 EXPECT_EQ(3u, context->NumUsedTextures()); | 959 EXPECT_EQ(3, context->NumUsedTextures()); |
| 960 | 960 |
| 961 // The non-painting scrollbar's texture wasn't updated. | 961 // The non-painting scrollbar's texture wasn't updated. |
| 962 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); | 962 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| 963 // The painting scrollbar does a partial update. | 963 // The painting scrollbar does a partial update. |
| 964 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 964 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 965 // One content layer does a partial update also. | 965 // One content layer does a partial update also. |
| 966 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); | 966 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| 967 EXPECT_FALSE(context->UsedTexture(context->TextureAt(5))); | 967 EXPECT_FALSE(context->UsedTexture(context->TextureAt(5))); |
| 968 | 968 |
| 969 context->ResetUsedTextures(); | 969 context->ResetUsedTextures(); |
| 970 PostSetNeedsCommitToMainThread(); | 970 PostSetNeedsCommitToMainThread(); |
| 971 break; | 971 break; |
| 972 case 3: | 972 case 3: |
| 973 // No textures should be used for commit. | 973 // No textures should be used for commit. |
| 974 EXPECT_EQ(0u, context->NumUsedTextures()); | 974 EXPECT_EQ(0, context->NumUsedTextures()); |
| 975 | 975 |
| 976 context->ResetUsedTextures(); | 976 context->ResetUsedTextures(); |
| 977 PostSetNeedsCommitToMainThread(); | 977 PostSetNeedsCommitToMainThread(); |
| 978 break; | 978 break; |
| 979 case 4: | 979 case 4: |
| 980 // Number of textures used for commit should be two. One for the | 980 // Number of textures used for commit should be two. One for the |
| 981 // content layer, and one for the painting scrollbar. The | 981 // content layer, and one for the painting scrollbar. The |
| 982 // non-painting scrollbar doesn't update its texture. | 982 // non-painting scrollbar doesn't update its texture. |
| 983 EXPECT_EQ(2u, context->NumUsedTextures()); | 983 EXPECT_EQ(2, context->NumUsedTextures()); |
| 984 | 984 |
| 985 context->ResetUsedTextures(); | 985 context->ResetUsedTextures(); |
| 986 PostSetNeedsCommitToMainThread(); | 986 PostSetNeedsCommitToMainThread(); |
| 987 break; | 987 break; |
| 988 case 5: | 988 case 5: |
| 989 EndTest(); | 989 EndTest(); |
| 990 break; | 990 break; |
| 991 default: | 991 default: |
| 992 NOTREACHED(); | 992 NOTREACHED(); |
| 993 break; | 993 break; |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 | 996 |
| 997 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 997 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 998 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 998 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 999 impl->output_surface()->context3d()); | 999 impl->output_surface()->context3d()); |
| 1000 | 1000 |
| 1001 // Number of textures used for drawing should one per layer except for | 1001 // Number of textures used for drawing should one per layer except for |
| 1002 // frame 3 where the viewport only contains one layer. | 1002 // frame 3 where the viewport only contains one layer. |
| 1003 if (impl->active_tree()->source_frame_number() == 3) | 1003 if (impl->active_tree()->source_frame_number() == 3) |
| 1004 EXPECT_EQ(1u, context->NumUsedTextures()); | 1004 EXPECT_EQ(1, context->NumUsedTextures()); |
| 1005 else | 1005 else |
| 1006 EXPECT_EQ(4u, context->NumUsedTextures()); | 1006 EXPECT_EQ(4, context->NumUsedTextures()); |
| 1007 | 1007 |
| 1008 context->ResetUsedTextures(); | 1008 context->ResetUsedTextures(); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 virtual void Layout() OVERRIDE { | 1011 virtual void Layout() OVERRIDE { |
| 1012 switch (num_commits_++) { | 1012 switch (num_commits_++) { |
| 1013 case 0: | 1013 case 0: |
| 1014 case 1: | 1014 case 1: |
| 1015 parent_->SetNeedsDisplay(); | 1015 parent_->SetNeedsDisplay(); |
| 1016 child_->SetNeedsDisplay(); | 1016 child_->SetNeedsDisplay(); |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 child_layer2_->SetBounds(gfx::Size(100, 100)); | 1809 child_layer2_->SetBounds(gfx::Size(100, 100)); |
| 1810 root_layer_->AddChild(child_layer1_); | 1810 root_layer_->AddChild(child_layer1_); |
| 1811 root_layer_->AddChild(child_layer2_); | 1811 root_layer_->AddChild(child_layer2_); |
| 1812 layer_tree_host()->SetRootLayer(root_layer_); | 1812 layer_tree_host()->SetRootLayer(root_layer_); |
| 1813 PostSetNeedsCommitToMainThread(); | 1813 PostSetNeedsCommitToMainThread(); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, | 1816 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, |
| 1817 bool visible) OVERRIDE { | 1817 bool visible) OVERRIDE { |
| 1818 // One backing should remain unevicted. | 1818 // One backing should remain unevicted. |
| 1819 EXPECT_EQ(100u * 100u * 4u * 1u, | 1819 EXPECT_EQ(100 * 100 * 4 * 1, |
| 1820 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1820 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1821 // Make sure that contents textures are marked as having been | 1821 // Make sure that contents textures are marked as having been |
| 1822 // purged. | 1822 // purged. |
| 1823 EXPECT_TRUE(host_impl->active_tree()->ContentsTexturesPurged()); | 1823 EXPECT_TRUE(host_impl->active_tree()->ContentsTexturesPurged()); |
| 1824 // End the test in this state. | 1824 // End the test in this state. |
| 1825 EndTest(); | 1825 EndTest(); |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 1828 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 1829 ++num_commits_; | 1829 ++num_commits_; |
| 1830 switch (num_commits_) { | 1830 switch (num_commits_) { |
| 1831 case 1: | 1831 case 1: |
| 1832 // All three backings should have memory. | 1832 // All three backings should have memory. |
| 1833 EXPECT_EQ( | 1833 EXPECT_EQ( |
| 1834 100u * 100u * 4u * 3u, | 1834 100 * 100 * 4 * 3, |
| 1835 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1835 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1836 // Set a new policy that will kick out 1 of the 3 resources. | 1836 // Set a new policy that will kick out 1 of the 3 resources. |
| 1837 // Because a resource was evicted, a commit will be kicked off. | 1837 // Because a resource was evicted, a commit will be kicked off. |
| 1838 host_impl->SetManagedMemoryPolicy( | 1838 host_impl->SetManagedMemoryPolicy( |
| 1839 ManagedMemoryPolicy(100 * 100 * 4 * 2, | 1839 ManagedMemoryPolicy(100 * 100 * 4 * 2, |
| 1840 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 1840 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
| 1841 100 * 100 * 4 * 1, | 1841 100 * 100 * 4 * 1, |
| 1842 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING)); | 1842 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING)); |
| 1843 break; | 1843 break; |
| 1844 case 2: | 1844 case 2: |
| 1845 // Only two backings should have memory. | 1845 // Only two backings should have memory. |
| 1846 EXPECT_EQ( | 1846 EXPECT_EQ( |
| 1847 100u * 100u * 4u * 2u, | 1847 100 * 100 * 4 * 2, |
| 1848 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1848 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1849 // Become backgrounded, which will cause 1 more resource to be | 1849 // Become backgrounded, which will cause 1 more resource to be |
| 1850 // evicted. | 1850 // evicted. |
| 1851 PostSetVisibleToMainThread(false); | 1851 PostSetVisibleToMainThread(false); |
| 1852 break; | 1852 break; |
| 1853 default: | 1853 default: |
| 1854 // No further commits should happen because this is not visible | 1854 // No further commits should happen because this is not visible |
| 1855 // anymore. | 1855 // anymore. |
| 1856 NOTREACHED(); | 1856 NOTREACHED(); |
| 1857 break; | 1857 break; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1882 | 1882 |
| 1883 virtual void BeginTest() OVERRIDE { | 1883 virtual void BeginTest() OVERRIDE { |
| 1884 root_layer_->SetIsDrawable(true); | 1884 root_layer_->SetIsDrawable(true); |
| 1885 root_layer_->SetBounds(gfx::Size(100, 100)); | 1885 root_layer_->SetBounds(gfx::Size(100, 100)); |
| 1886 layer_tree_host()->SetRootLayer(root_layer_); | 1886 layer_tree_host()->SetRootLayer(root_layer_); |
| 1887 PostSetNeedsCommitToMainThread(); | 1887 PostSetNeedsCommitToMainThread(); |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 virtual void DidCommit() OVERRIDE { | 1890 virtual void DidCommit() OVERRIDE { |
| 1891 // We always expect two pinch-zoom scrollbar layers. | 1891 // We always expect two pinch-zoom scrollbar layers. |
| 1892 ASSERT_EQ(2u, root_layer_->children().size()); | 1892 ASSERT_EQ(2, root_layer_->children().size()); |
| 1893 | 1893 |
| 1894 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. | 1894 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. |
| 1895 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); | 1895 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); |
| 1896 ASSERT_TRUE(layer1); | 1896 ASSERT_TRUE(layer1); |
| 1897 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, | 1897 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, |
| 1898 layer1->scroll_layer_id()); | 1898 layer1->scroll_layer_id()); |
| 1899 EXPECT_EQ(0.f, layer1->opacity()); | 1899 EXPECT_EQ(0.f, layer1->opacity()); |
| 1900 EXPECT_TRUE(layer1->OpacityCanAnimateOnImplThread()); | 1900 EXPECT_TRUE(layer1->OpacityCanAnimateOnImplThread()); |
| 1901 EXPECT_TRUE(layer1->DrawsContent()); | 1901 EXPECT_TRUE(layer1->DrawsContent()); |
| 1902 | 1902 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 root_layer_->SetIsDrawable(true); | 1991 root_layer_->SetIsDrawable(true); |
| 1992 root_layer_->SetBounds(gfx::Size(100, 100)); | 1992 root_layer_->SetBounds(gfx::Size(100, 100)); |
| 1993 layer_tree_host()->SetRootLayer(root_layer_); | 1993 layer_tree_host()->SetRootLayer(root_layer_); |
| 1994 PostSetNeedsCommitToMainThread(); | 1994 PostSetNeedsCommitToMainThread(); |
| 1995 } | 1995 } |
| 1996 | 1996 |
| 1997 virtual void DidCommit() OVERRIDE { | 1997 virtual void DidCommit() OVERRIDE { |
| 1998 num_commits_++; | 1998 num_commits_++; |
| 1999 | 1999 |
| 2000 // We always expect two pinch-zoom scrollbar layers. | 2000 // We always expect two pinch-zoom scrollbar layers. |
| 2001 ASSERT_EQ(2u, root_layer_->children().size()); | 2001 ASSERT_EQ(2, root_layer_->children().size()); |
| 2002 | 2002 |
| 2003 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. | 2003 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. |
| 2004 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); | 2004 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); |
| 2005 ASSERT_TRUE(layer1); | 2005 ASSERT_TRUE(layer1); |
| 2006 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, | 2006 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, |
| 2007 layer1->scroll_layer_id()); | 2007 layer1->scroll_layer_id()); |
| 2008 EXPECT_EQ(0.f, layer1->opacity()); | 2008 EXPECT_EQ(0.f, layer1->opacity()); |
| 2009 EXPECT_TRUE(layer1->DrawsContent()); | 2009 EXPECT_TRUE(layer1->DrawsContent()); |
| 2010 | 2010 |
| 2011 ScrollbarLayer* layer2 = root_layer_->children()[1]->ToScrollbarLayer(); | 2011 ScrollbarLayer* layer2 = root_layer_->children()[1]->ToScrollbarLayer(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2172 } | 2172 } |
| 2173 | 2173 |
| 2174 private: | 2174 private: |
| 2175 base::TimeTicks frame_time_; | 2175 base::TimeTicks frame_time_; |
| 2176 }; | 2176 }; |
| 2177 | 2177 |
| 2178 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); | 2178 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); |
| 2179 | 2179 |
| 2180 } // namespace | 2180 } // namespace |
| 2181 } // namespace cc | 2181 } // namespace cc |
| OLD | NEW |