| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/callback.h" |
| 8 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "cc/playback/raster_source.h" | 13 #include "cc/playback/raster_source.h" |
| 12 #include "cc/playback/recording_source.h" | 14 #include "cc/playback/recording_source.h" |
| 13 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
| 14 #include "cc/raster/synchronous_task_graph_runner.h" | 16 #include "cc/raster/synchronous_task_graph_runner.h" |
| 15 #include "cc/resources/resource_pool.h" | 17 #include "cc/resources/resource_pool.h" |
| 16 #include "cc/test/begin_frame_args_test.h" | 18 #include "cc/test/begin_frame_args_test.h" |
| 17 #include "cc/test/fake_compositor_frame_sink.h" | 19 #include "cc/test/fake_compositor_frame_sink.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 #include "cc/tiles/raster_tile_priority_queue.h" | 34 #include "cc/tiles/raster_tile_priority_queue.h" |
| 33 #include "cc/tiles/tile.h" | 35 #include "cc/tiles/tile.h" |
| 34 #include "cc/tiles/tile_priority.h" | 36 #include "cc/tiles/tile_priority.h" |
| 35 #include "cc/tiles/tiling_set_raster_queue_all.h" | 37 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 36 #include "cc/trees/layer_tree_impl.h" | 38 #include "cc/trees/layer_tree_impl.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "third_party/skia/include/core/SkRefCnt.h" | 41 #include "third_party/skia/include/core/SkRefCnt.h" |
| 40 #include "third_party/skia/include/core/SkSurface.h" | 42 #include "third_party/skia/include/core/SkSurface.h" |
| 41 | 43 |
| 44 using testing::_; |
| 45 using testing::Invoke; |
| 46 using testing::Return; |
| 47 using testing::StrictMock; |
| 48 |
| 42 namespace cc { | 49 namespace cc { |
| 43 namespace { | 50 namespace { |
| 44 | 51 |
| 45 class TileManagerTilePriorityQueueTest : public TestLayerTreeHostBase { | 52 class TileManagerTilePriorityQueueTest : public TestLayerTreeHostBase { |
| 46 public: | 53 public: |
| 47 LayerTreeSettings CreateSettings() override { | 54 LayerTreeSettings CreateSettings() override { |
| 48 LayerTreeSettingsForTesting settings; | 55 LayerTreeSettingsForTesting settings; |
| 49 settings.create_low_res_tiling = true; | 56 settings.create_low_res_tiling = true; |
| 50 settings.renderer_settings.buffer_to_texture_target_map = | 57 settings.renderer_settings.buffer_to_texture_target_map = |
| 51 DefaultBufferToTextureTargetMapForTesting(); | 58 DefaultBufferToTextureTargetMapForTesting(); |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 | 1489 |
| 1483 MOCK_METHOD0(NotifyReadyToActivate, void()); | 1490 MOCK_METHOD0(NotifyReadyToActivate, void()); |
| 1484 MOCK_METHOD0(NotifyReadyToDraw, void()); | 1491 MOCK_METHOD0(NotifyReadyToDraw, void()); |
| 1485 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); | 1492 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); |
| 1486 }; | 1493 }; |
| 1487 | 1494 |
| 1488 std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( | 1495 std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( |
| 1489 const LayerTreeSettings& settings, | 1496 const LayerTreeSettings& settings, |
| 1490 TaskRunnerProvider* task_runner_provider, | 1497 TaskRunnerProvider* task_runner_provider, |
| 1491 TaskGraphRunner* task_graph_runner) override { | 1498 TaskGraphRunner* task_graph_runner) override { |
| 1492 return base::MakeUnique<MockLayerTreeHostImpl>( | 1499 return base::MakeUnique<testing::NiceMock<MockLayerTreeHostImpl>>( |
| 1493 settings, task_runner_provider, task_graph_runner); | 1500 settings, task_runner_provider, task_graph_runner); |
| 1494 } | 1501 } |
| 1495 | 1502 |
| 1496 // By default use software compositing (no context provider). | 1503 // By default use software compositing (no context provider). |
| 1497 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { | 1504 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { |
| 1498 return FakeCompositorFrameSink::CreateSoftware(); | 1505 return FakeCompositorFrameSink::CreateSoftware(); |
| 1499 } | 1506 } |
| 1500 | 1507 |
| 1501 MockLayerTreeHostImpl& MockHostImpl() { | 1508 MockLayerTreeHostImpl& MockHostImpl() { |
| 1502 return *static_cast<MockLayerTreeHostImpl*>(host_impl()); | 1509 return *static_cast<MockLayerTreeHostImpl*>(host_impl()); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 TEST_F(PartialRasterTileManagerTest, PartialRasterSuccessfullyEnabled) { | 1925 TEST_F(PartialRasterTileManagerTest, PartialRasterSuccessfullyEnabled) { |
| 1919 RunPartialRasterCheck(TakeHostImpl(), true /* partial_raster_enabled */); | 1926 RunPartialRasterCheck(TakeHostImpl(), true /* partial_raster_enabled */); |
| 1920 } | 1927 } |
| 1921 | 1928 |
| 1922 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1929 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 1923 // raster is disabled. | 1930 // raster is disabled. |
| 1924 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1931 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 1925 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); | 1932 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); |
| 1926 } | 1933 } |
| 1927 | 1934 |
| 1935 // FakeRasterBufferProviderImpl that allows us to mock ready to draw |
| 1936 // functionality. |
| 1937 class MockReadyToDrawRasterBufferProviderImpl |
| 1938 : public FakeRasterBufferProviderImpl { |
| 1939 public: |
| 1940 MOCK_CONST_METHOD1(IsResourceReadyToDraw, bool(ResourceId resource_id)); |
| 1941 MOCK_CONST_METHOD3( |
| 1942 SetReadyToDrawCallback, |
| 1943 uint64_t(const ResourceProvider::ResourceIdArray& resource_ids, |
| 1944 const base::Closure& callback, |
| 1945 uint64_t pending_callback_id)); |
| 1946 |
| 1947 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 1948 const Resource* resource, |
| 1949 uint64_t resource_content_id, |
| 1950 uint64_t previous_content_id) override { |
| 1951 return base::MakeUnique<FakeRasterBuffer>(); |
| 1952 } |
| 1953 |
| 1954 private: |
| 1955 class FakeRasterBuffer : public RasterBuffer { |
| 1956 public: |
| 1957 void Playback( |
| 1958 const RasterSource* raster_source, |
| 1959 const gfx::Rect& raster_full_rect, |
| 1960 const gfx::Rect& raster_dirty_rect, |
| 1961 uint64_t new_content_id, |
| 1962 float scale, |
| 1963 const RasterSource::PlaybackSettings& playback_settings) override {} |
| 1964 }; |
| 1965 }; |
| 1966 |
| 1967 class TileManagerReadyToDrawTest : public TileManagerTest { |
| 1968 public: |
| 1969 ~TileManagerReadyToDrawTest() override { |
| 1970 // Ensure that the host impl doesn't outlive |raster_buffer_provider_|. |
| 1971 TakeHostImpl(); |
| 1972 } |
| 1973 |
| 1974 void SetUp() override { |
| 1975 TileManagerTest::SetUp(); |
| 1976 host_impl()->tile_manager()->SetRasterBufferProviderForTesting( |
| 1977 &mock_raster_buffer_provider_); |
| 1978 |
| 1979 const gfx::Size layer_bounds(1000, 1000); |
| 1980 |
| 1981 solid_color_recording_source_ = |
| 1982 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
| 1983 |
| 1984 SkPaint solid_paint; |
| 1985 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
| 1986 solid_paint.setColor(solid_color); |
| 1987 solid_color_recording_source_->add_draw_rect_with_paint( |
| 1988 gfx::Rect(layer_bounds), solid_paint); |
| 1989 |
| 1990 solid_color_recording_source_->Rerecord(); |
| 1991 |
| 1992 recording_source_ = |
| 1993 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
| 1994 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
| 1995 SkPaint non_solid_paint; |
| 1996 non_solid_paint.setColor(non_solid_color); |
| 1997 |
| 1998 for (int i = 0; i < 100; ++i) { |
| 1999 for (int j = 0; j < 100; ++j) { |
| 2000 recording_source_->add_draw_rect_with_paint( |
| 2001 gfx::Rect(10 * i, 10 * j, 5, 5), non_solid_paint); |
| 2002 } |
| 2003 } |
| 2004 recording_source_->Rerecord(); |
| 2005 } |
| 2006 |
| 2007 LayerTreeSettings CreateSettings() override { |
| 2008 LayerTreeSettingsForTesting settings; |
| 2009 settings.renderer_settings.buffer_to_texture_target_map = |
| 2010 DefaultBufferToTextureTargetMapForTesting(); |
| 2011 return settings; |
| 2012 } |
| 2013 |
| 2014 void SetupTreesWithActiveTreeTiles() { |
| 2015 scoped_refptr<RasterSource> active_tree_raster_source = |
| 2016 RasterSource::CreateFromRecordingSource(recording_source_.get(), false); |
| 2017 scoped_refptr<RasterSource> pending_tree_raster_source = |
| 2018 RasterSource::CreateFromRecordingSource( |
| 2019 solid_color_recording_source_.get(), false); |
| 2020 |
| 2021 SetupTrees(pending_tree_raster_source, active_tree_raster_source); |
| 2022 } |
| 2023 |
| 2024 void SetupTreesWithPendingTreeTiles() { |
| 2025 scoped_refptr<RasterSource> active_tree_raster_source = |
| 2026 RasterSource::CreateFromRecordingSource( |
| 2027 solid_color_recording_source_.get(), false); |
| 2028 scoped_refptr<RasterSource> pending_tree_raster_source = |
| 2029 RasterSource::CreateFromRecordingSource(recording_source_.get(), false); |
| 2030 |
| 2031 SetupTrees(pending_tree_raster_source, active_tree_raster_source); |
| 2032 } |
| 2033 |
| 2034 TileManager* tile_manager() { return host_impl()->tile_manager(); } |
| 2035 MockReadyToDrawRasterBufferProviderImpl* mock_raster_buffer_provider() { |
| 2036 return &mock_raster_buffer_provider_; |
| 2037 } |
| 2038 |
| 2039 private: |
| 2040 StrictMock<MockReadyToDrawRasterBufferProviderImpl> |
| 2041 mock_raster_buffer_provider_; |
| 2042 std::unique_ptr<FakeRecordingSource> recording_source_; |
| 2043 std::unique_ptr<FakeRecordingSource> solid_color_recording_source_; |
| 2044 }; |
| 2045 |
| 2046 TEST_F(TileManagerReadyToDrawTest, SmoothActivationWaitsOnCallback) { |
| 2047 host_impl()->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); |
| 2048 SetupTreesWithPendingTreeTiles(); |
| 2049 |
| 2050 base::Closure callback; |
| 2051 { |
| 2052 base::RunLoop run_loop; |
| 2053 |
| 2054 // Until we activate our ready to draw callback, treat all resources as not |
| 2055 // ready to draw. |
| 2056 EXPECT_CALL(*mock_raster_buffer_provider(), |
| 2057 IsResourceReadyToDraw(testing::_)) |
| 2058 .WillRepeatedly(Return(false)); |
| 2059 |
| 2060 EXPECT_CALL(*mock_raster_buffer_provider(), SetReadyToDrawCallback(_, _, 0)) |
| 2061 .WillOnce(testing::Invoke([&run_loop, &callback]( |
| 2062 const ResourceProvider::ResourceIdArray& resource_ids, |
| 2063 const base::Closure& callback_in, uint64_t pending_callback_id) { |
| 2064 callback = callback_in; |
| 2065 run_loop.Quit(); |
| 2066 return 1; |
| 2067 })); |
| 2068 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2069 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2070 run_loop.Run(); |
| 2071 } |
| 2072 |
| 2073 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2074 EXPECT_FALSE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2075 |
| 2076 { |
| 2077 base::RunLoop run_loop; |
| 2078 EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate()) |
| 2079 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2080 EXPECT_CALL(*mock_raster_buffer_provider(), |
| 2081 IsResourceReadyToDraw(testing::_)) |
| 2082 .WillRepeatedly(Return(true)); |
| 2083 callback.Run(); |
| 2084 run_loop.Run(); |
| 2085 } |
| 2086 |
| 2087 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2088 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2089 } |
| 2090 |
| 2091 TEST_F(TileManagerReadyToDrawTest, NonSmoothActivationDoesNotWaitOnCallback) { |
| 2092 SetupTreesWithPendingTreeTiles(); |
| 2093 |
| 2094 // We're using a StrictMock on the RasterBufferProvider, so any function call |
| 2095 // will cause a test failure. |
| 2096 base::RunLoop run_loop; |
| 2097 |
| 2098 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2099 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2100 EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate()) |
| 2101 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2102 run_loop.Run(); |
| 2103 |
| 2104 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2105 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2106 } |
| 2107 |
| 2108 TEST_F(TileManagerReadyToDrawTest, SmoothDrawWaitsOnCallback) { |
| 2109 host_impl()->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); |
| 2110 SetupTreesWithActiveTreeTiles(); |
| 2111 |
| 2112 base::Closure callback; |
| 2113 { |
| 2114 base::RunLoop run_loop; |
| 2115 |
| 2116 // Until we activate our ready to draw callback, treat all resources as not |
| 2117 // ready to draw. |
| 2118 EXPECT_CALL(*mock_raster_buffer_provider(), |
| 2119 IsResourceReadyToDraw(testing::_)) |
| 2120 .WillRepeatedly(Return(false)); |
| 2121 |
| 2122 EXPECT_CALL(*mock_raster_buffer_provider(), SetReadyToDrawCallback(_, _, 0)) |
| 2123 .WillOnce(Invoke([&run_loop, &callback]( |
| 2124 const ResourceProvider::ResourceIdArray& resource_ids, |
| 2125 const base::Closure& callback_in, uint64_t pending_callback_id) { |
| 2126 callback = callback_in; |
| 2127 run_loop.Quit(); |
| 2128 return 1; |
| 2129 })); |
| 2130 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2131 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2132 run_loop.Run(); |
| 2133 } |
| 2134 |
| 2135 EXPECT_FALSE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2136 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2137 |
| 2138 { |
| 2139 base::RunLoop run_loop; |
| 2140 EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw()) |
| 2141 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2142 EXPECT_CALL(*mock_raster_buffer_provider(), |
| 2143 IsResourceReadyToDraw(testing::_)) |
| 2144 .WillRepeatedly(Return(true)); |
| 2145 callback.Run(); |
| 2146 run_loop.Run(); |
| 2147 } |
| 2148 |
| 2149 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2150 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2151 } |
| 2152 |
| 2153 TEST_F(TileManagerReadyToDrawTest, NonSmoothDrawDoesNotWaitOnCallback) { |
| 2154 SetupTreesWithActiveTreeTiles(); |
| 2155 |
| 2156 // We're using a StrictMock on the RasterBufferProvider, so any function call |
| 2157 // will cause a test failure. |
| 2158 base::RunLoop run_loop; |
| 2159 |
| 2160 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2161 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2162 EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw()) |
| 2163 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2164 run_loop.Run(); |
| 2165 |
| 2166 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2167 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2168 } |
| 2169 |
| 2170 TEST_F(TileManagerReadyToDrawTest, NoCallbackWhenAlreadyReadyToDraw) { |
| 2171 host_impl()->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); |
| 2172 SetupTreesWithPendingTreeTiles(); |
| 2173 |
| 2174 base::RunLoop run_loop; |
| 2175 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2176 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2177 EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate()) |
| 2178 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2179 EXPECT_CALL(*mock_raster_buffer_provider(), IsResourceReadyToDraw(_)) |
| 2180 .WillRepeatedly(Return(true)); |
| 2181 run_loop.Run(); |
| 2182 |
| 2183 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2184 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2185 } |
| 2186 |
| 2187 void UpdateVisibleRect(FakePictureLayerImpl* layer, |
| 2188 const gfx::Rect visible_rect) { |
| 2189 PictureLayerTilingSet* tiling_set = layer->tilings(); |
| 2190 for (size_t j = 0; j < tiling_set->num_tilings(); ++j) { |
| 2191 PictureLayerTiling* tiling = tiling_set->tiling_at(j); |
| 2192 tiling->SetTilePriorityRectsForTesting( |
| 2193 visible_rect, // Visible rect. |
| 2194 visible_rect, // Skewport rect. |
| 2195 visible_rect, // Soon rect. |
| 2196 gfx::Rect(0, 0, 1000, 1000)); // Eventually rect. |
| 2197 } |
| 2198 } |
| 2199 |
| 2200 TEST_F(TileManagerReadyToDrawTest, ReadyToDrawRespectsRequirementChange) { |
| 2201 host_impl()->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); |
| 2202 SetupTreesWithPendingTreeTiles(); |
| 2203 |
| 2204 // Initially create a tiling with a visible rect of (0, 0, 100, 100) and |
| 2205 // a soon rect of the rest of the layer. |
| 2206 UpdateVisibleRect(pending_layer(), gfx::Rect(0, 0, 100, 100)); |
| 2207 |
| 2208 // Mark all these tiles as ready to draw. |
| 2209 base::RunLoop run_loop; |
| 2210 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2211 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2212 EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate()) |
| 2213 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2214 EXPECT_CALL(*mock_raster_buffer_provider(), IsResourceReadyToDraw(_)) |
| 2215 .WillRepeatedly(Return(true)); |
| 2216 run_loop.Run(); |
| 2217 |
| 2218 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2219 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2220 |
| 2221 // Move the viewport to (900, 900, 100, 100), so that we need a different set |
| 2222 // of tilings. |
| 2223 UpdateVisibleRect(pending_layer(), gfx::Rect(900, 900, 100, 100)); |
| 2224 |
| 2225 EXPECT_CALL(*mock_raster_buffer_provider(), IsResourceReadyToDraw(testing::_)) |
| 2226 .WillRepeatedly(Return(false)); |
| 2227 |
| 2228 base::Closure callback; |
| 2229 { |
| 2230 base::RunLoop run_loop; |
| 2231 |
| 2232 EXPECT_CALL(*mock_raster_buffer_provider(), SetReadyToDrawCallback(_, _, 0)) |
| 2233 .WillOnce(testing::Invoke([&run_loop, &callback]( |
| 2234 const ResourceProvider::ResourceIdArray& resource_ids, |
| 2235 const base::Closure& callback_in, uint64_t pending_callback_id) { |
| 2236 callback = callback_in; |
| 2237 run_loop.Quit(); |
| 2238 return 1; |
| 2239 })); |
| 2240 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2241 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2242 run_loop.Run(); |
| 2243 } |
| 2244 |
| 2245 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2246 EXPECT_FALSE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2247 |
| 2248 // Now switch back to our original tiling. We should be immediately able to |
| 2249 // activate, as we still have the original tile, and no longer need the |
| 2250 // tiles from the previous callback. |
| 2251 UpdateVisibleRect(pending_layer(), gfx::Rect(0, 0, 100, 100)); |
| 2252 |
| 2253 { |
| 2254 base::RunLoop run_loop; |
| 2255 host_impl()->tile_manager()->DidModifyTilePriorities(); |
| 2256 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2257 EXPECT_CALL(MockHostImpl(), NotifyReadyToActivate()) |
| 2258 .WillOnce(Invoke([&run_loop]() { run_loop.Quit(); })); |
| 2259 run_loop.Run(); |
| 2260 } |
| 2261 |
| 2262 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 2263 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 2264 } |
| 2265 |
| 1928 } // namespace | 2266 } // namespace |
| 1929 } // namespace cc | 2267 } // namespace cc |
| OLD | NEW |