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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1872 EXPECT_TRUE(root->did_draw_called()); | 1872 EXPECT_TRUE(root->did_draw_called()); |
1873 EXPECT_TRUE(layer1->did_draw_called()); | 1873 EXPECT_TRUE(layer1->did_draw_called()); |
1874 EXPECT_TRUE(layer2->did_draw_called()); | 1874 EXPECT_TRUE(layer2->did_draw_called()); |
1875 | 1875 |
1876 EXPECT_NE(root->render_surface(), layer1->render_surface()); | 1876 EXPECT_NE(root->render_surface(), layer1->render_surface()); |
1877 EXPECT_TRUE(!!layer1->render_surface()); | 1877 EXPECT_TRUE(!!layer1->render_surface()); |
1878 } | 1878 } |
1879 | 1879 |
1880 class MissingTextureAnimatingLayer : public DidDrawCheckLayer { | 1880 class MissingTextureAnimatingLayer : public DidDrawCheckLayer { |
1881 public: | 1881 public: |
1882 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, | 1882 static scoped_ptr<LayerImpl> Create( |
1883 int id, | 1883 LayerTreeImpl* tree_impl, |
1884 bool tile_missing, | 1884 int id, |
1885 bool had_incomplete_tile, | 1885 bool tile_missing, |
1886 bool animating, | 1886 bool tile_missing_outside_activation_rect, |
1887 ResourceProvider* resource_provider) { | 1887 bool had_incomplete_tile, |
1888 return scoped_ptr<LayerImpl>( | 1888 bool had_incomplete_tile_outside_activation_rect, |
1889 new MissingTextureAnimatingLayer(tree_impl, | 1889 bool animating, |
1890 id, | 1890 ResourceProvider* resource_provider) { |
1891 tile_missing, | 1891 return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer( |
1892 had_incomplete_tile, | 1892 tree_impl, |
1893 animating, | 1893 id, |
1894 resource_provider)); | 1894 tile_missing, |
1895 tile_missing_outside_activation_rect, | |
1896 had_incomplete_tile, | |
1897 had_incomplete_tile_outside_activation_rect, | |
1898 animating, | |
1899 resource_provider)); | |
1895 } | 1900 } |
1896 | 1901 |
1897 virtual void AppendQuads(RenderPass* render_pass, | 1902 virtual void AppendQuads(RenderPass* render_pass, |
1898 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 1903 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
1899 AppendQuadsData* append_quads_data) OVERRIDE { | 1904 AppendQuadsData* append_quads_data) OVERRIDE { |
1900 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); | 1905 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); |
1901 if (had_incomplete_tile_) | 1906 if (had_incomplete_tile_) { |
1902 append_quads_data->num_incomplete_tiles++; | 1907 append_quads_data->num_incomplete_tiles++; |
1903 if (tile_missing_) | 1908 append_quads_data->num_incomplete_tiles_inside_activation_rect++; |
1909 } | |
1910 if (had_incomplete_tile_outside_activation_rect_) { | |
1911 append_quads_data->num_incomplete_tiles++; | |
1912 } | |
1913 if (tile_missing_) { | |
1904 append_quads_data->num_missing_tiles++; | 1914 append_quads_data->num_missing_tiles++; |
1915 append_quads_data->num_missing_tiles_inside_activation_rect++; | |
1916 } | |
1917 if (tile_missing_outside_activation_rect_) { | |
1918 append_quads_data->num_missing_tiles++; | |
1919 } | |
1905 } | 1920 } |
1906 | 1921 |
1907 private: | 1922 private: |
1908 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, | 1923 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
1909 int id, | 1924 int id, |
1910 bool tile_missing, | 1925 bool tile_missing, |
1926 bool tile_missing_outside_activation_rect, | |
1911 bool had_incomplete_tile, | 1927 bool had_incomplete_tile, |
1928 bool had_incomplete_tile_outside_activation_rect, | |
1912 bool animating, | 1929 bool animating, |
1913 ResourceProvider* resource_provider) | 1930 ResourceProvider* resource_provider) |
1914 : DidDrawCheckLayer(tree_impl, id), | 1931 : DidDrawCheckLayer(tree_impl, id), |
1915 tile_missing_(tile_missing), | 1932 tile_missing_(tile_missing), |
1916 had_incomplete_tile_(had_incomplete_tile) { | 1933 tile_missing_outside_activation_rect_( |
1934 tile_missing_outside_activation_rect), | |
1935 had_incomplete_tile_(had_incomplete_tile), | |
1936 had_incomplete_tile_outside_activation_rect_( | |
1937 had_incomplete_tile_outside_activation_rect) { | |
1917 if (animating) | 1938 if (animating) |
1918 AddAnimatedTransformToLayer(this, 10.0, 3, 0); | 1939 AddAnimatedTransformToLayer(this, 10.0, 3, 0); |
1919 } | 1940 } |
1920 | 1941 |
1921 bool tile_missing_; | 1942 bool tile_missing_; |
1943 bool tile_missing_outside_activation_rect_; | |
1922 bool had_incomplete_tile_; | 1944 bool had_incomplete_tile_; |
1945 bool had_incomplete_tile_outside_activation_rect_; | |
1923 }; | 1946 }; |
1924 | 1947 |
1925 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) { | 1948 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) { |
1926 host_impl_->active_tree()->SetRootLayer( | 1949 host_impl_->active_tree()->SetRootLayer( |
1927 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 1950 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
1928 DidDrawCheckLayer* root = | 1951 DidDrawCheckLayer* root = |
1929 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1952 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1930 | 1953 |
1931 bool tile_missing = false; | 1954 bool tile_missing = false; |
1955 bool tile_missing_outside_activation_rect = false; | |
1932 bool had_incomplete_tile = false; | 1956 bool had_incomplete_tile = false; |
1957 bool had_incomplete_tile_outside_activation_rect = false; | |
1933 bool is_animating = false; | 1958 bool is_animating = false; |
1934 root->AddChild( | 1959 root->AddChild(MissingTextureAnimatingLayer::Create( |
1935 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1960 host_impl_->active_tree(), |
1936 2, | 1961 2, |
1937 tile_missing, | 1962 tile_missing, |
1938 had_incomplete_tile, | 1963 tile_missing_outside_activation_rect, |
1939 is_animating, | 1964 had_incomplete_tile, |
1940 host_impl_->resource_provider())); | 1965 had_incomplete_tile_outside_activation_rect, |
1966 is_animating, | |
1967 host_impl_->resource_provider())); | |
1941 | 1968 |
1942 LayerTreeHostImpl::FrameData frame; | 1969 LayerTreeHostImpl::FrameData frame; |
1943 | 1970 |
1944 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 1971 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
1945 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 1972 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1946 host_impl_->DidDrawAllLayers(frame); | 1973 host_impl_->DidDrawAllLayers(frame); |
1947 } | 1974 } |
1948 | 1975 |
1949 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) { | 1976 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) { |
1950 host_impl_->active_tree()->SetRootLayer( | 1977 host_impl_->active_tree()->SetRootLayer( |
1951 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 1978 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
1952 DidDrawCheckLayer* root = | 1979 DidDrawCheckLayer* root = |
1953 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 1980 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1954 bool tile_missing = false; | 1981 bool tile_missing = false; |
1982 bool tile_missing_outside_activation_rect = false; | |
1955 bool had_incomplete_tile = false; | 1983 bool had_incomplete_tile = false; |
1984 bool had_incomplete_tile_outside_activation_rect = false; | |
1956 bool is_animating = true; | 1985 bool is_animating = true; |
1957 root->AddChild( | 1986 root->AddChild(MissingTextureAnimatingLayer::Create( |
1958 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 1987 host_impl_->active_tree(), |
1959 2, | 1988 2, |
1960 tile_missing, | 1989 tile_missing, |
1961 had_incomplete_tile, | 1990 tile_missing_outside_activation_rect, |
1962 is_animating, | 1991 had_incomplete_tile, |
1963 host_impl_->resource_provider())); | 1992 had_incomplete_tile_outside_activation_rect, |
1993 is_animating, | |
1994 host_impl_->resource_provider())); | |
1964 | 1995 |
1965 LayerTreeHostImpl::FrameData frame; | 1996 LayerTreeHostImpl::FrameData frame; |
1966 | 1997 |
1967 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 1998 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
1968 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 1999 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1969 host_impl_->DidDrawAllLayers(frame); | 2000 host_impl_->DidDrawAllLayers(frame); |
1970 } | 2001 } |
1971 | 2002 |
1972 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { | 2003 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { |
1973 host_impl_->active_tree()->SetRootLayer( | 2004 host_impl_->active_tree()->SetRootLayer( |
1974 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 2005 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
1975 DidDrawCheckLayer* root = | 2006 DidDrawCheckLayer* root = |
1976 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2007 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1977 | 2008 |
1978 bool tile_missing = true; | 2009 bool tile_missing = true; |
2010 bool tile_missing_outside_activation_rect = false; | |
1979 bool had_incomplete_tile = false; | 2011 bool had_incomplete_tile = false; |
2012 bool had_incomplete_tile_outside_activation_rect = false; | |
1980 bool is_animating = false; | 2013 bool is_animating = false; |
1981 root->AddChild( | 2014 root->AddChild(MissingTextureAnimatingLayer::Create( |
1982 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2015 host_impl_->active_tree(), |
1983 4, | 2016 4, |
1984 tile_missing, | 2017 tile_missing, |
1985 had_incomplete_tile, | 2018 tile_missing_outside_activation_rect, |
1986 is_animating, | 2019 had_incomplete_tile, |
1987 host_impl_->resource_provider())); | 2020 had_incomplete_tile_outside_activation_rect, |
2021 is_animating, | |
2022 host_impl_->resource_provider())); | |
1988 LayerTreeHostImpl::FrameData frame; | 2023 LayerTreeHostImpl::FrameData frame; |
1989 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2024 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
1990 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2025 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
1991 host_impl_->DidDrawAllLayers(frame); | 2026 host_impl_->DidDrawAllLayers(frame); |
1992 } | 2027 } |
1993 | 2028 |
1994 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { | 2029 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { |
1995 host_impl_->active_tree()->SetRootLayer( | 2030 host_impl_->active_tree()->SetRootLayer( |
1996 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 2031 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
1997 DidDrawCheckLayer* root = | 2032 DidDrawCheckLayer* root = |
1998 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2033 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
1999 | 2034 |
2000 bool tile_missing = false; | 2035 bool tile_missing = false; |
2036 bool tile_missing_outside_activation_rect = false; | |
2001 bool had_incomplete_tile = true; | 2037 bool had_incomplete_tile = true; |
2038 bool had_incomplete_tile_outside_activation_rect = false; | |
2002 bool is_animating = false; | 2039 bool is_animating = false; |
2003 root->AddChild( | 2040 root->AddChild(MissingTextureAnimatingLayer::Create( |
2004 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2041 host_impl_->active_tree(), |
2005 4, | 2042 4, |
2006 tile_missing, | 2043 tile_missing, |
2007 had_incomplete_tile, | 2044 tile_missing_outside_activation_rect, |
2008 is_animating, | 2045 had_incomplete_tile, |
2009 host_impl_->resource_provider())); | 2046 had_incomplete_tile_outside_activation_rect, |
2047 is_animating, | |
2048 host_impl_->resource_provider())); | |
2010 LayerTreeHostImpl::FrameData frame; | 2049 LayerTreeHostImpl::FrameData frame; |
2011 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2050 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
2012 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2051 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2052 host_impl_->DidDrawAllLayers(frame); | |
2053 } | |
2054 | |
2055 TEST_F(LayerTreeHostImplTest, | |
2056 PrepareToDrawSucceedsWithIncompleteTileOutsideActivationRect) { | |
2057 host_impl_->active_tree()->SetRootLayer( | |
2058 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | |
2059 DidDrawCheckLayer* root = | |
2060 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | |
2061 | |
2062 bool tile_missing = false; | |
2063 bool tile_missing_outside_activation_rect = false; | |
2064 bool had_incomplete_tile = true; | |
2065 bool had_incomplete_tile_outside_activation_rect = true; | |
2066 bool is_animating = false; | |
2067 root->AddChild(MissingTextureAnimatingLayer::Create( | |
2068 host_impl_->active_tree(), | |
2069 4, | |
2070 tile_missing, | |
2071 tile_missing_outside_activation_rect, | |
2072 had_incomplete_tile, | |
2073 had_incomplete_tile_outside_activation_rect, | |
2074 is_animating, | |
2075 host_impl_->resource_provider())); | |
2076 LayerTreeHostImpl::FrameData frame; | |
2077 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2078 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2079 host_impl_->DidDrawAllLayers(frame); | |
2080 } | |
2081 | |
2082 TEST_F(LayerTreeHostImplTest, | |
2083 PrepareToDrawSucceedsWithMissingTileOutsideActivationRect) { | |
2084 host_impl_->active_tree()->SetRootLayer( | |
2085 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | |
2086 DidDrawCheckLayer* root = | |
2087 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | |
2088 | |
2089 bool tile_missing = false; | |
hush (inactive)
2014/08/18 20:48:16
should this be true?
tile_missing_outside_activati
boliu
2014/08/18 21:32:57
Not as written. But I can see why this is confusin
| |
2090 bool tile_missing_outside_activation_rect = true; | |
2091 bool had_incomplete_tile = true; | |
2092 bool had_incomplete_tile_outside_activation_rect = false; | |
hush (inactive)
2014/08/18 20:48:16
above 2 lines means there are incomplete tiles ins
boliu
2014/08/18 21:32:57
Done. Good catch.
| |
2093 bool is_animating = false; | |
2094 root->AddChild(MissingTextureAnimatingLayer::Create( | |
2095 host_impl_->active_tree(), | |
2096 4, | |
2097 tile_missing, | |
2098 tile_missing_outside_activation_rect, | |
2099 had_incomplete_tile, | |
2100 had_incomplete_tile_outside_activation_rect, | |
2101 is_animating, | |
2102 host_impl_->resource_provider())); | |
2103 LayerTreeHostImpl::FrameData frame; | |
2104 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | |
2105 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | |
2013 host_impl_->DidDrawAllLayers(frame); | 2106 host_impl_->DidDrawAllLayers(frame); |
2014 } | 2107 } |
2015 | 2108 |
2016 TEST_F(LayerTreeHostImplTest, | 2109 TEST_F(LayerTreeHostImplTest, |
2017 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { | 2110 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { |
2018 host_impl_->active_tree()->SetRootLayer( | 2111 host_impl_->active_tree()->SetRootLayer( |
2019 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); | 2112 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
2020 DidDrawCheckLayer* root = | 2113 DidDrawCheckLayer* root = |
2021 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2114 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2022 bool tile_missing = true; | 2115 bool tile_missing = true; |
2116 bool tile_missing_outside_activation_rect = false; | |
2023 bool had_incomplete_tile = false; | 2117 bool had_incomplete_tile = false; |
2118 bool had_incomplete_tile_outside_activation_rect = false; | |
2024 bool is_animating = true; | 2119 bool is_animating = true; |
2025 root->AddChild( | 2120 root->AddChild(MissingTextureAnimatingLayer::Create( |
2026 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2121 host_impl_->active_tree(), |
2027 6, | 2122 6, |
2028 tile_missing, | 2123 tile_missing, |
2029 had_incomplete_tile, | 2124 tile_missing_outside_activation_rect, |
2030 is_animating, | 2125 had_incomplete_tile, |
2031 host_impl_->resource_provider())); | 2126 had_incomplete_tile_outside_activation_rect, |
2127 is_animating, | |
2128 host_impl_->resource_provider())); | |
2032 LayerTreeHostImpl::FrameData frame; | 2129 LayerTreeHostImpl::FrameData frame; |
2033 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, | 2130 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, |
2034 host_impl_->PrepareToDraw(&frame)); | 2131 host_impl_->PrepareToDraw(&frame)); |
2035 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2132 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2036 host_impl_->DidDrawAllLayers(frame); | 2133 host_impl_->DidDrawAllLayers(frame); |
2037 } | 2134 } |
2038 | 2135 |
2039 TEST_F(LayerTreeHostImplTest, | 2136 TEST_F(LayerTreeHostImplTest, |
2040 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) { | 2137 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) { |
2041 host_impl_->active_tree()->SetRootLayer( | 2138 host_impl_->active_tree()->SetRootLayer( |
2042 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); | 2139 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); |
2043 DidDrawCheckLayer* root = | 2140 DidDrawCheckLayer* root = |
2044 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2141 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2045 bool tile_missing = false; | 2142 bool tile_missing = false; |
2143 bool tile_missing_outside_activation_rect = false; | |
2046 bool had_incomplete_tile = true; | 2144 bool had_incomplete_tile = true; |
2145 bool had_incomplete_tile_outside_activation_rect = false; | |
2047 bool is_animating = true; | 2146 bool is_animating = true; |
2048 root->AddChild( | 2147 root->AddChild(MissingTextureAnimatingLayer::Create( |
2049 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2148 host_impl_->active_tree(), |
2050 6, | 2149 6, |
2051 tile_missing, | 2150 tile_missing, |
2052 had_incomplete_tile, | 2151 tile_missing_outside_activation_rect, |
2053 is_animating, | 2152 had_incomplete_tile, |
2054 host_impl_->resource_provider())); | 2153 had_incomplete_tile_outside_activation_rect, |
2154 is_animating, | |
2155 host_impl_->resource_provider())); | |
2055 LayerTreeHostImpl::FrameData frame; | 2156 LayerTreeHostImpl::FrameData frame; |
2056 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2157 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
2057 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2158 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2058 host_impl_->DidDrawAllLayers(frame); | 2159 host_impl_->DidDrawAllLayers(frame); |
2059 } | 2160 } |
2060 | 2161 |
2061 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { | 2162 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { |
2062 host_impl_->active_tree()->SetRootLayer( | 2163 host_impl_->active_tree()->SetRootLayer( |
2063 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2164 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2064 DidDrawCheckLayer* root = | 2165 DidDrawCheckLayer* root = |
2065 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2166 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2066 bool tile_missing = false; | 2167 bool tile_missing = false; |
2168 bool tile_missing_outside_activation_rect = false; | |
2067 bool had_incomplete_tile = false; | 2169 bool had_incomplete_tile = false; |
2170 bool had_incomplete_tile_outside_activation_rect = false; | |
2068 bool is_animating = false; | 2171 bool is_animating = false; |
2069 root->AddChild( | 2172 root->AddChild(MissingTextureAnimatingLayer::Create( |
2070 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2173 host_impl_->active_tree(), |
2071 8, | 2174 8, |
2072 tile_missing, | 2175 tile_missing, |
2073 had_incomplete_tile, | 2176 tile_missing_outside_activation_rect, |
2074 is_animating, | 2177 had_incomplete_tile, |
2075 host_impl_->resource_provider())); | 2178 had_incomplete_tile_outside_activation_rect, |
2179 is_animating, | |
2180 host_impl_->resource_provider())); | |
2076 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2181 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2077 LayerTreeHostImpl::FrameData frame; | 2182 LayerTreeHostImpl::FrameData frame; |
2078 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2183 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
2079 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2184 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2080 host_impl_->DidDrawAllLayers(frame); | 2185 host_impl_->DidDrawAllLayers(frame); |
2081 } | 2186 } |
2082 | 2187 |
2083 TEST_F(LayerTreeHostImplTest, | 2188 TEST_F(LayerTreeHostImplTest, |
2084 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) { | 2189 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) { |
2085 host_impl_->active_tree()->SetRootLayer( | 2190 host_impl_->active_tree()->SetRootLayer( |
2086 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2191 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2087 DidDrawCheckLayer* root = | 2192 DidDrawCheckLayer* root = |
2088 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2193 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2089 bool tile_missing = false; | 2194 bool tile_missing = false; |
2195 bool tile_missing_outside_activation_rect = false; | |
2090 bool had_incomplete_tile = true; | 2196 bool had_incomplete_tile = true; |
2197 bool had_incomplete_tile_outside_activation_rect = false; | |
2091 bool is_animating = false; | 2198 bool is_animating = false; |
2092 root->AddChild( | 2199 root->AddChild(MissingTextureAnimatingLayer::Create( |
2093 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2200 host_impl_->active_tree(), |
2094 8, | 2201 8, |
2095 tile_missing, | 2202 tile_missing, |
2096 had_incomplete_tile, | 2203 tile_missing_outside_activation_rect, |
2097 is_animating, | 2204 had_incomplete_tile, |
2098 host_impl_->resource_provider())); | 2205 had_incomplete_tile_outside_activation_rect, |
2206 is_animating, | |
2207 host_impl_->resource_provider())); | |
2099 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2208 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2100 LayerTreeHostImpl::FrameData frame; | 2209 LayerTreeHostImpl::FrameData frame; |
2101 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, | 2210 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
2102 host_impl_->PrepareToDraw(&frame)); | 2211 host_impl_->PrepareToDraw(&frame)); |
2103 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2212 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2104 host_impl_->DidDrawAllLayers(frame); | 2213 host_impl_->DidDrawAllLayers(frame); |
2105 } | 2214 } |
2106 | 2215 |
2107 TEST_F(LayerTreeHostImplTest, | 2216 TEST_F(LayerTreeHostImplTest, |
2108 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { | 2217 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { |
2109 host_impl_->active_tree()->SetRootLayer( | 2218 host_impl_->active_tree()->SetRootLayer( |
2110 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2219 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
2111 DidDrawCheckLayer* root = | 2220 DidDrawCheckLayer* root = |
2112 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2221 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
2113 bool tile_missing = true; | 2222 bool tile_missing = true; |
2223 bool tile_missing_outside_activation_rect = false; | |
2114 bool had_incomplete_tile = false; | 2224 bool had_incomplete_tile = false; |
2225 bool had_incomplete_tile_outside_activation_rect = false; | |
2115 bool is_animating = false; | 2226 bool is_animating = false; |
2116 root->AddChild( | 2227 root->AddChild(MissingTextureAnimatingLayer::Create( |
2117 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2228 host_impl_->active_tree(), |
2118 8, | 2229 8, |
2119 tile_missing, | 2230 tile_missing, |
2120 had_incomplete_tile, | 2231 tile_missing_outside_activation_rect, |
2121 is_animating, | 2232 had_incomplete_tile, |
2122 host_impl_->resource_provider())); | 2233 had_incomplete_tile_outside_activation_rect, |
2234 is_animating, | |
2235 host_impl_->resource_provider())); | |
2123 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2236 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
2124 LayerTreeHostImpl::FrameData frame; | 2237 LayerTreeHostImpl::FrameData frame; |
2125 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, | 2238 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
2126 host_impl_->PrepareToDraw(&frame)); | 2239 host_impl_->PrepareToDraw(&frame)); |
2127 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 2240 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
2128 host_impl_->DidDrawAllLayers(frame); | 2241 host_impl_->DidDrawAllLayers(frame); |
2129 } | 2242 } |
2130 | 2243 |
2131 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { | 2244 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { |
2132 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 2245 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7024 host_impl_->DidLoseOutputSurface(); | 7137 host_impl_->DidLoseOutputSurface(); |
7025 EXPECT_TRUE(host_impl_->IsContextLost()); | 7138 EXPECT_TRUE(host_impl_->IsContextLost()); |
7026 EXPECT_EQ(1, num_lost_surfaces_); | 7139 EXPECT_EQ(1, num_lost_surfaces_); |
7027 host_impl_->DidLoseOutputSurface(); | 7140 host_impl_->DidLoseOutputSurface(); |
7028 EXPECT_TRUE(host_impl_->IsContextLost()); | 7141 EXPECT_TRUE(host_impl_->IsContextLost()); |
7029 EXPECT_EQ(1, num_lost_surfaces_); | 7142 EXPECT_EQ(1, num_lost_surfaces_); |
7030 } | 7143 } |
7031 | 7144 |
7032 } // namespace | 7145 } // namespace |
7033 } // namespace cc | 7146 } // namespace cc |
OLD | NEW |