| 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 "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
| 8 #include "cc/animation/timing_function.h" | 8 #include "cc/animation/timing_function.h" |
| 9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 786 |
| 787 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 787 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 788 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); | 788 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); |
| 789 | 789 |
| 790 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 790 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 791 impl->output_surface()->context3d()); | 791 impl->output_surface()->context3d()); |
| 792 | 792 |
| 793 switch (impl->active_tree()->source_frame_number()) { | 793 switch (impl->active_tree()->source_frame_number()) { |
| 794 case 0: | 794 case 0: |
| 795 // Number of textures should be one for each layer | 795 // Number of textures should be one for each layer |
| 796 ASSERT_EQ(2, context->NumTextures()); | 796 ASSERT_EQ(2u, context->NumTextures()); |
| 797 // Number of textures used for commit should be one for each layer. | 797 // Number of textures used for commit should be one for each layer. |
| 798 EXPECT_EQ(2, context->NumUsedTextures()); | 798 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 799 // Verify that used texture is correct. | 799 // Verify that used texture is correct. |
| 800 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 800 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 801 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 801 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 802 | 802 |
| 803 context->ResetUsedTextures(); | 803 context->ResetUsedTextures(); |
| 804 PostSetNeedsCommitToMainThread(); | 804 PostSetNeedsCommitToMainThread(); |
| 805 break; | 805 break; |
| 806 case 1: | 806 case 1: |
| 807 // Number of textures should be doubled as the first textures | 807 // Number of textures should be doubled as the first textures |
| 808 // are used by impl thread and cannot by used for update. | 808 // are used by impl thread and cannot by used for update. |
| 809 ASSERT_EQ(4, context->NumTextures()); | 809 ASSERT_EQ(4u, context->NumTextures()); |
| 810 // Number of textures used for commit should still be | 810 // Number of textures used for commit should still be |
| 811 // one for each layer. | 811 // one for each layer. |
| 812 EXPECT_EQ(2, context->NumUsedTextures()); | 812 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 813 // First textures should not have been used. | 813 // First textures should not have been used. |
| 814 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 814 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| 815 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 815 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| 816 // New textures should have been used. | 816 // New textures should have been used. |
| 817 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 817 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 818 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 818 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 819 | 819 |
| 820 context->ResetUsedTextures(); | 820 context->ResetUsedTextures(); |
| 821 PostSetNeedsCommitToMainThread(); | 821 PostSetNeedsCommitToMainThread(); |
| 822 break; | 822 break; |
| 823 case 2: | 823 case 2: |
| 824 EndTest(); | 824 EndTest(); |
| 825 break; | 825 break; |
| 826 default: | 826 default: |
| 827 NOTREACHED(); | 827 NOTREACHED(); |
| 828 break; | 828 break; |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 | 831 |
| 832 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 832 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 833 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 833 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 834 impl->output_surface()->context3d()); | 834 impl->output_surface()->context3d()); |
| 835 | 835 |
| 836 // Number of textures used for draw should always be one for each layer. | 836 // Number of textures used for draw should always be one for each layer. |
| 837 EXPECT_EQ(2, context->NumUsedTextures()); | 837 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 838 context->ResetUsedTextures(); | 838 context->ResetUsedTextures(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 virtual void Layout() OVERRIDE { | 841 virtual void Layout() OVERRIDE { |
| 842 layer_->SetNeedsDisplay(); | 842 layer_->SetNeedsDisplay(); |
| 843 scrollbar_->SetNeedsDisplay(); | 843 scrollbar_->SetNeedsDisplay(); |
| 844 } | 844 } |
| 845 | 845 |
| 846 virtual void AfterTest() OVERRIDE {} | 846 virtual void AfterTest() OVERRIDE {} |
| 847 | 847 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 916 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 917 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); | 917 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); |
| 918 | 918 |
| 919 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 919 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 920 impl->output_surface()->context3d()); | 920 impl->output_surface()->context3d()); |
| 921 | 921 |
| 922 switch (impl->active_tree()->source_frame_number()) { | 922 switch (impl->active_tree()->source_frame_number()) { |
| 923 case 0: | 923 case 0: |
| 924 // Number of textures should be one for each layer. | 924 // Number of textures should be one for each layer. |
| 925 ASSERT_EQ(4, context->NumTextures()); | 925 ASSERT_EQ(4u, context->NumTextures()); |
| 926 // Number of textures used for commit should be one for each layer. | 926 // Number of textures used for commit should be one for each layer. |
| 927 EXPECT_EQ(4, context->NumUsedTextures()); | 927 EXPECT_EQ(4u, context->NumUsedTextures()); |
| 928 // Verify that used textures are correct. | 928 // Verify that used textures are correct. |
| 929 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 929 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 930 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 930 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 931 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 931 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 932 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 932 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 933 | 933 |
| 934 context->ResetUsedTextures(); | 934 context->ResetUsedTextures(); |
| 935 PostSetNeedsCommitToMainThread(); | 935 PostSetNeedsCommitToMainThread(); |
| 936 break; | 936 break; |
| 937 case 1: | 937 case 1: |
| 938 // Number of textures should be two for each content layer and one | 938 // Number of textures should be two for each content layer and one |
| 939 // for each scrollbar, since they always do a partial update. | 939 // for each scrollbar, since they always do a partial update. |
| 940 ASSERT_EQ(6, context->NumTextures()); | 940 ASSERT_EQ(6u, context->NumTextures()); |
| 941 // Number of textures used for commit should be one for each content | 941 // Number of textures used for commit should be one for each content |
| 942 // layer, and one for the scrollbar layer that paints. | 942 // layer, and one for the scrollbar layer that paints. |
| 943 EXPECT_EQ(3, context->NumUsedTextures()); | 943 EXPECT_EQ(3u, context->NumUsedTextures()); |
| 944 | 944 |
| 945 // First content textures should not have been used. | 945 // First content textures should not have been used. |
| 946 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 946 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| 947 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 947 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| 948 // The non-painting scrollbar's texture wasn't updated. | 948 // The non-painting scrollbar's texture wasn't updated. |
| 949 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); | 949 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| 950 // The painting scrollbar's partial update texture was used. | 950 // The painting scrollbar's partial update texture was used. |
| 951 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 951 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 952 // New textures should have been used. | 952 // New textures should have been used. |
| 953 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); | 953 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| 954 EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); | 954 EXPECT_TRUE(context->UsedTexture(context->TextureAt(5))); |
| 955 | 955 |
| 956 context->ResetUsedTextures(); | 956 context->ResetUsedTextures(); |
| 957 PostSetNeedsCommitToMainThread(); | 957 PostSetNeedsCommitToMainThread(); |
| 958 break; | 958 break; |
| 959 case 2: | 959 case 2: |
| 960 // Number of textures should be two for each content layer and one | 960 // Number of textures should be two for each content layer and one |
| 961 // for each scrollbar, since they always do a partial update. | 961 // for each scrollbar, since they always do a partial update. |
| 962 ASSERT_EQ(6, context->NumTextures()); | 962 ASSERT_EQ(6u, context->NumTextures()); |
| 963 // Number of textures used for commit should be one for each content | 963 // Number of textures used for commit should be one for each content |
| 964 // layer, and one for the scrollbar layer that paints. | 964 // layer, and one for the scrollbar layer that paints. |
| 965 EXPECT_EQ(3, context->NumUsedTextures()); | 965 EXPECT_EQ(3u, context->NumUsedTextures()); |
| 966 | 966 |
| 967 // The non-painting scrollbar's texture wasn't updated. | 967 // The non-painting scrollbar's texture wasn't updated. |
| 968 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); | 968 EXPECT_FALSE(context->UsedTexture(context->TextureAt(2))); |
| 969 // The painting scrollbar does a partial update. | 969 // The painting scrollbar does a partial update. |
| 970 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 970 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 971 // One content layer does a partial update also. | 971 // One content layer does a partial update also. |
| 972 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); | 972 EXPECT_TRUE(context->UsedTexture(context->TextureAt(4))); |
| 973 EXPECT_FALSE(context->UsedTexture(context->TextureAt(5))); | 973 EXPECT_FALSE(context->UsedTexture(context->TextureAt(5))); |
| 974 | 974 |
| 975 context->ResetUsedTextures(); | 975 context->ResetUsedTextures(); |
| 976 PostSetNeedsCommitToMainThread(); | 976 PostSetNeedsCommitToMainThread(); |
| 977 break; | 977 break; |
| 978 case 3: | 978 case 3: |
| 979 // No textures should be used for commit. | 979 // No textures should be used for commit. |
| 980 EXPECT_EQ(0, context->NumUsedTextures()); | 980 EXPECT_EQ(0u, context->NumUsedTextures()); |
| 981 | 981 |
| 982 context->ResetUsedTextures(); | 982 context->ResetUsedTextures(); |
| 983 PostSetNeedsCommitToMainThread(); | 983 PostSetNeedsCommitToMainThread(); |
| 984 break; | 984 break; |
| 985 case 4: | 985 case 4: |
| 986 // Number of textures used for commit should be two. One for the | 986 // Number of textures used for commit should be two. One for the |
| 987 // content layer, and one for the painting scrollbar. The | 987 // content layer, and one for the painting scrollbar. The |
| 988 // non-painting scrollbar doesn't update its texture. | 988 // non-painting scrollbar doesn't update its texture. |
| 989 EXPECT_EQ(2, context->NumUsedTextures()); | 989 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 990 | 990 |
| 991 context->ResetUsedTextures(); | 991 context->ResetUsedTextures(); |
| 992 PostSetNeedsCommitToMainThread(); | 992 PostSetNeedsCommitToMainThread(); |
| 993 break; | 993 break; |
| 994 case 5: | 994 case 5: |
| 995 EndTest(); | 995 EndTest(); |
| 996 break; | 996 break; |
| 997 default: | 997 default: |
| 998 NOTREACHED(); | 998 NOTREACHED(); |
| 999 break; | 999 break; |
| 1000 } | 1000 } |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1003 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 1004 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( | 1004 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( |
| 1005 impl->output_surface()->context3d()); | 1005 impl->output_surface()->context3d()); |
| 1006 | 1006 |
| 1007 // Number of textures used for drawing should one per layer except for | 1007 // Number of textures used for drawing should one per layer except for |
| 1008 // frame 3 where the viewport only contains one layer. | 1008 // frame 3 where the viewport only contains one layer. |
| 1009 if (impl->active_tree()->source_frame_number() == 3) | 1009 if (impl->active_tree()->source_frame_number() == 3) |
| 1010 EXPECT_EQ(1, context->NumUsedTextures()); | 1010 EXPECT_EQ(1u, context->NumUsedTextures()); |
| 1011 else | 1011 else |
| 1012 EXPECT_EQ(4, context->NumUsedTextures()); | 1012 EXPECT_EQ(4u, context->NumUsedTextures()); |
| 1013 | 1013 |
| 1014 context->ResetUsedTextures(); | 1014 context->ResetUsedTextures(); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 virtual void Layout() OVERRIDE { | 1017 virtual void Layout() OVERRIDE { |
| 1018 switch (num_commits_++) { | 1018 switch (num_commits_++) { |
| 1019 case 0: | 1019 case 0: |
| 1020 case 1: | 1020 case 1: |
| 1021 parent_->SetNeedsDisplay(); | 1021 parent_->SetNeedsDisplay(); |
| 1022 child_->SetNeedsDisplay(); | 1022 child_->SetNeedsDisplay(); |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 child_layer2_->SetBounds(gfx::Size(100, 100)); | 1825 child_layer2_->SetBounds(gfx::Size(100, 100)); |
| 1826 root_layer_->AddChild(child_layer1_); | 1826 root_layer_->AddChild(child_layer1_); |
| 1827 root_layer_->AddChild(child_layer2_); | 1827 root_layer_->AddChild(child_layer2_); |
| 1828 layer_tree_host()->SetRootLayer(root_layer_); | 1828 layer_tree_host()->SetRootLayer(root_layer_); |
| 1829 PostSetNeedsCommitToMainThread(); | 1829 PostSetNeedsCommitToMainThread(); |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, | 1832 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, |
| 1833 bool visible) OVERRIDE { | 1833 bool visible) OVERRIDE { |
| 1834 // One backing should remain unevicted. | 1834 // One backing should remain unevicted. |
| 1835 EXPECT_EQ(100 * 100 * 4 * 1, | 1835 EXPECT_EQ(100u * 100u * 4u * 1u, |
| 1836 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1836 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1837 // Make sure that contents textures are marked as having been | 1837 // Make sure that contents textures are marked as having been |
| 1838 // purged. | 1838 // purged. |
| 1839 EXPECT_TRUE(host_impl->active_tree()->ContentsTexturesPurged()); | 1839 EXPECT_TRUE(host_impl->active_tree()->ContentsTexturesPurged()); |
| 1840 // End the test in this state. | 1840 // End the test in this state. |
| 1841 EndTest(); | 1841 EndTest(); |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 1844 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 1845 ++num_commits_; | 1845 ++num_commits_; |
| 1846 switch (num_commits_) { | 1846 switch (num_commits_) { |
| 1847 case 1: | 1847 case 1: |
| 1848 // All three backings should have memory. | 1848 // All three backings should have memory. |
| 1849 EXPECT_EQ( | 1849 EXPECT_EQ( |
| 1850 100 * 100 * 4 * 3, | 1850 100u * 100u * 4u * 3u, |
| 1851 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1851 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1852 // Set a new policy that will kick out 1 of the 3 resources. | 1852 // Set a new policy that will kick out 1 of the 3 resources. |
| 1853 // Because a resource was evicted, a commit will be kicked off. | 1853 // Because a resource was evicted, a commit will be kicked off. |
| 1854 host_impl->SetManagedMemoryPolicy( | 1854 host_impl->SetManagedMemoryPolicy( |
| 1855 ManagedMemoryPolicy(100 * 100 * 4 * 2, | 1855 ManagedMemoryPolicy(100 * 100 * 4 * 2, |
| 1856 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 1856 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
| 1857 100 * 100 * 4 * 1, | 1857 100 * 100 * 4 * 1, |
| 1858 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING)); | 1858 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING)); |
| 1859 break; | 1859 break; |
| 1860 case 2: | 1860 case 2: |
| 1861 // Only two backings should have memory. | 1861 // Only two backings should have memory. |
| 1862 EXPECT_EQ( | 1862 EXPECT_EQ( |
| 1863 100 * 100 * 4 * 2, | 1863 100u * 100u * 4u * 2u, |
| 1864 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); | 1864 layer_tree_host()->contents_texture_manager()->MemoryUseBytes()); |
| 1865 // Become backgrounded, which will cause 1 more resource to be | 1865 // Become backgrounded, which will cause 1 more resource to be |
| 1866 // evicted. | 1866 // evicted. |
| 1867 PostSetVisibleToMainThread(false); | 1867 PostSetVisibleToMainThread(false); |
| 1868 break; | 1868 break; |
| 1869 default: | 1869 default: |
| 1870 // No further commits should happen because this is not visible | 1870 // No further commits should happen because this is not visible |
| 1871 // anymore. | 1871 // anymore. |
| 1872 NOTREACHED(); | 1872 NOTREACHED(); |
| 1873 break; | 1873 break; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1898 | 1898 |
| 1899 virtual void BeginTest() OVERRIDE { | 1899 virtual void BeginTest() OVERRIDE { |
| 1900 root_layer_->SetIsDrawable(true); | 1900 root_layer_->SetIsDrawable(true); |
| 1901 root_layer_->SetBounds(gfx::Size(100, 100)); | 1901 root_layer_->SetBounds(gfx::Size(100, 100)); |
| 1902 layer_tree_host()->SetRootLayer(root_layer_); | 1902 layer_tree_host()->SetRootLayer(root_layer_); |
| 1903 PostSetNeedsCommitToMainThread(); | 1903 PostSetNeedsCommitToMainThread(); |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 virtual void DidCommit() OVERRIDE { | 1906 virtual void DidCommit() OVERRIDE { |
| 1907 // We always expect two pinch-zoom scrollbar layers. | 1907 // We always expect two pinch-zoom scrollbar layers. |
| 1908 ASSERT_EQ(2, root_layer_->children().size()); | 1908 ASSERT_EQ(2u, root_layer_->children().size()); |
| 1909 | 1909 |
| 1910 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. | 1910 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. |
| 1911 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); | 1911 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); |
| 1912 ASSERT_TRUE(layer1); | 1912 ASSERT_TRUE(layer1); |
| 1913 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, | 1913 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, |
| 1914 layer1->scroll_layer_id()); | 1914 layer1->scroll_layer_id()); |
| 1915 EXPECT_EQ(0.f, layer1->opacity()); | 1915 EXPECT_EQ(0.f, layer1->opacity()); |
| 1916 EXPECT_TRUE(layer1->OpacityCanAnimateOnImplThread()); | 1916 EXPECT_TRUE(layer1->OpacityCanAnimateOnImplThread()); |
| 1917 EXPECT_TRUE(layer1->DrawsContent()); | 1917 EXPECT_TRUE(layer1->DrawsContent()); |
| 1918 | 1918 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 root_layer_->SetIsDrawable(true); | 2007 root_layer_->SetIsDrawable(true); |
| 2008 root_layer_->SetBounds(gfx::Size(100, 100)); | 2008 root_layer_->SetBounds(gfx::Size(100, 100)); |
| 2009 layer_tree_host()->SetRootLayer(root_layer_); | 2009 layer_tree_host()->SetRootLayer(root_layer_); |
| 2010 PostSetNeedsCommitToMainThread(); | 2010 PostSetNeedsCommitToMainThread(); |
| 2011 } | 2011 } |
| 2012 | 2012 |
| 2013 virtual void DidCommit() OVERRIDE { | 2013 virtual void DidCommit() OVERRIDE { |
| 2014 num_commits_++; | 2014 num_commits_++; |
| 2015 | 2015 |
| 2016 // We always expect two pinch-zoom scrollbar layers. | 2016 // We always expect two pinch-zoom scrollbar layers. |
| 2017 ASSERT_EQ(2, root_layer_->children().size()); | 2017 ASSERT_EQ(2u, root_layer_->children().size()); |
| 2018 | 2018 |
| 2019 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. | 2019 // Pinch-zoom scrollbar layers always have invalid scrollLayerIds. |
| 2020 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); | 2020 ScrollbarLayer* layer1 = root_layer_->children()[0]->ToScrollbarLayer(); |
| 2021 ASSERT_TRUE(layer1); | 2021 ASSERT_TRUE(layer1); |
| 2022 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, | 2022 EXPECT_EQ(Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID, |
| 2023 layer1->scroll_layer_id()); | 2023 layer1->scroll_layer_id()); |
| 2024 EXPECT_EQ(0.f, layer1->opacity()); | 2024 EXPECT_EQ(0.f, layer1->opacity()); |
| 2025 EXPECT_TRUE(layer1->DrawsContent()); | 2025 EXPECT_TRUE(layer1->DrawsContent()); |
| 2026 | 2026 |
| 2027 ScrollbarLayer* layer2 = root_layer_->children()[1]->ToScrollbarLayer(); | 2027 ScrollbarLayer* layer2 = root_layer_->children()[1]->ToScrollbarLayer(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 private: | 2190 private: |
| 2191 base::TimeTicks frame_time_; | 2191 base::TimeTicks frame_time_; |
| 2192 }; | 2192 }; |
| 2193 | 2193 |
| 2194 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); | 2194 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); |
| 2195 | 2195 |
| 2196 } // namespace | 2196 } // namespace |
| 2197 } // namespace cc | 2197 } // namespace cc |
| OLD | NEW |