| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "third_party/skia/include/core/SkRefCnt.h" | 39 #include "third_party/skia/include/core/SkRefCnt.h" |
| 40 #include "third_party/skia/include/core/SkSurface.h" | 40 #include "third_party/skia/include/core/SkSurface.h" |
| 41 | 41 |
| 42 namespace cc { | 42 namespace cc { |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class LowResTilingsSettings : public LayerTreeSettings { | 45 class LowResTilingsSettings : public LayerTreeSettings { |
| 46 public: | 46 public: |
| 47 LowResTilingsSettings() { | 47 LowResTilingsSettings() { |
| 48 create_low_res_tiling = true; | 48 create_low_res_tiling = true; |
| 49 verify_clip_tree_calculations = true; |
| 49 } | 50 } |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 class TileManagerTilePriorityQueueTest : public testing::Test { | 53 class TileManagerTilePriorityQueueTest : public testing::Test { |
| 53 public: | 54 public: |
| 54 TileManagerTilePriorityQueueTest() | 55 TileManagerTilePriorityQueueTest() |
| 55 : memory_limit_policy_(ALLOW_ANYTHING), | 56 : memory_limit_policy_(ALLOW_ANYTHING), |
| 56 max_tiles_(10000), | 57 max_tiles_(10000), |
| 57 ready_to_activate_(false), | 58 ready_to_activate_(false), |
| 58 id_(7), | 59 id_(7), |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 | 1196 |
| 1196 gfx::Rect viewport(50, 50, 500, 500); | 1197 gfx::Rect viewport(50, 50, 500, 500); |
| 1197 gfx::Size layer_bounds(1600, 1600); | 1198 gfx::Size layer_bounds(1600, 1600); |
| 1198 | 1199 |
| 1199 const int soon_border_outset = 312; | 1200 const int soon_border_outset = 312; |
| 1200 gfx::Rect soon_rect = viewport; | 1201 gfx::Rect soon_rect = viewport; |
| 1201 soon_rect.Inset(-soon_border_outset, -soon_border_outset); | 1202 soon_rect.Inset(-soon_border_outset, -soon_border_outset); |
| 1202 | 1203 |
| 1203 client.SetTileSize(gfx::Size(30, 30)); | 1204 client.SetTileSize(gfx::Size(30, 30)); |
| 1204 LayerTreeSettings settings; | 1205 LayerTreeSettings settings; |
| 1206 settings.verify_clip_tree_calculations = true; |
| 1205 | 1207 |
| 1206 std::unique_ptr<PictureLayerTilingSet> tiling_set = | 1208 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
| 1207 PictureLayerTilingSet::Create( | 1209 PictureLayerTilingSet::Create( |
| 1208 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1210 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
| 1209 settings.skewport_target_time_in_seconds, | 1211 settings.skewport_target_time_in_seconds, |
| 1210 settings.skewport_extrapolation_limit_in_screen_pixels); | 1212 settings.skewport_extrapolation_limit_in_screen_pixels); |
| 1211 | 1213 |
| 1212 scoped_refptr<FakeRasterSource> raster_source = | 1214 scoped_refptr<FakeRasterSource> raster_source = |
| 1213 FakeRasterSource::CreateFilled(layer_bounds); | 1215 FakeRasterSource::CreateFilled(layer_bounds); |
| 1214 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1216 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 TEST_F(TileManagerTilePriorityQueueTest, | 1307 TEST_F(TileManagerTilePriorityQueueTest, |
| 1306 RasterTilePriorityQueueMovingViewport) { | 1308 RasterTilePriorityQueueMovingViewport) { |
| 1307 FakePictureLayerTilingClient client; | 1309 FakePictureLayerTilingClient client; |
| 1308 | 1310 |
| 1309 gfx::Rect viewport(50, 0, 100, 100); | 1311 gfx::Rect viewport(50, 0, 100, 100); |
| 1310 gfx::Rect moved_viewport(50, 0, 100, 500); | 1312 gfx::Rect moved_viewport(50, 0, 100, 500); |
| 1311 gfx::Size layer_bounds(1000, 1000); | 1313 gfx::Size layer_bounds(1000, 1000); |
| 1312 | 1314 |
| 1313 client.SetTileSize(gfx::Size(30, 30)); | 1315 client.SetTileSize(gfx::Size(30, 30)); |
| 1314 LayerTreeSettings settings; | 1316 LayerTreeSettings settings; |
| 1317 settings.verify_clip_tree_calculations = true; |
| 1315 | 1318 |
| 1316 std::unique_ptr<PictureLayerTilingSet> tiling_set = | 1319 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
| 1317 PictureLayerTilingSet::Create( | 1320 PictureLayerTilingSet::Create( |
| 1318 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1321 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
| 1319 settings.skewport_target_time_in_seconds, | 1322 settings.skewport_target_time_in_seconds, |
| 1320 settings.skewport_extrapolation_limit_in_screen_pixels); | 1323 settings.skewport_extrapolation_limit_in_screen_pixels); |
| 1321 | 1324 |
| 1322 scoped_refptr<FakeRasterSource> raster_source = | 1325 scoped_refptr<FakeRasterSource> raster_source = |
| 1323 FakeRasterSource::CreateFilled(layer_bounds); | 1326 FakeRasterSource::CreateFilled(layer_bounds); |
| 1324 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1327 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); | 1580 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); |
| 1578 } | 1581 } |
| 1579 } | 1582 } |
| 1580 } | 1583 } |
| 1581 | 1584 |
| 1582 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. | 1585 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. |
| 1583 class TileManagerTest : public testing::Test { | 1586 class TileManagerTest : public testing::Test { |
| 1584 public: | 1587 public: |
| 1585 void SetUp() override { | 1588 void SetUp() override { |
| 1586 LayerTreeSettings settings; | 1589 LayerTreeSettings settings; |
| 1590 settings.verify_clip_tree_calculations = true; |
| 1591 |
| 1587 CustomizeSettings(&settings); | 1592 CustomizeSettings(&settings); |
| 1588 output_surface_ = GetOutputSurface(); | 1593 output_surface_ = GetOutputSurface(); |
| 1589 task_graph_runner_ = GetTaskGraphRunner(); | 1594 task_graph_runner_ = GetTaskGraphRunner(); |
| 1590 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, | 1595 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, |
| 1591 &shared_bitmap_manager_, | 1596 &shared_bitmap_manager_, |
| 1592 task_graph_runner_.get())); | 1597 task_graph_runner_.get())); |
| 1593 host_impl_->SetVisible(true); | 1598 host_impl_->SetVisible(true); |
| 1594 host_impl_->InitializeRenderer(output_surface_.get()); | 1599 host_impl_->InitializeRenderer(output_surface_.get()); |
| 1595 } | 1600 } |
| 1596 | 1601 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 | 2094 |
| 2090 // Ensures that the tile manager does not attempt to reuse tiles when partial | 2095 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 2091 // raster is disabled. | 2096 // raster is disabled. |
| 2092 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 2097 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 2093 RunPartialRasterCheck(std::move(host_impl_), | 2098 RunPartialRasterCheck(std::move(host_impl_), |
| 2094 false /* partial_raster_enabled */); | 2099 false /* partial_raster_enabled */); |
| 2095 } | 2100 } |
| 2096 | 2101 |
| 2097 } // namespace | 2102 } // namespace |
| 2098 } // namespace cc | 2103 } // namespace cc |
| OLD | NEW |