Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 2711573002: cc: Fix tile priority inversion in picture layer tiling. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | cc/tiles/tiling_set_eviction_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/picture_layer_tiling_unittest.cc
diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc
index 147f836a5974171a3951cb7ebbde6dea00928981..fdafb2dea3c340444b320cd173ee95cf1c5bbfb9 100644
--- a/cc/tiles/picture_layer_tiling_unittest.cc
+++ b/cc/tiles/picture_layer_tiling_unittest.cc
@@ -61,9 +61,13 @@ class TestablePictureLayerTiling : public PictureLayerTiling {
}
gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
+ PriorityRectType visible_rect_type() const {
+ return PriorityRectType::VISIBLE_RECT;
+ }
using PictureLayerTiling::RemoveTileAt;
using PictureLayerTiling::RemoveTilesInRegion;
+ using PictureLayerTiling::ComputePriorityRectTypeForTile;
protected:
TestablePictureLayerTiling(WhichTree tree,
@@ -955,6 +959,49 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
}
+TEST(PictureLayerTilingTest, EdgeCaseTileNowAndRequired) {
+ FakePictureLayerTilingClient pending_client;
+ pending_client.SetTileSize(gfx::Size(100, 100));
+
+ scoped_refptr<FakeRasterSource> raster_source =
+ FakeRasterSource::CreateFilled(gfx::Size(500, 500));
+ std::unique_ptr<TestablePictureLayerTiling> pending_tiling =
+ TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source,
+ &pending_client, LayerTreeSettings());
+ pending_tiling->set_resolution(HIGH_RESOLUTION);
+ pending_tiling->set_can_require_tiles_for_activation(true);
+
+ // The tile at (1, 0) should be touching the visible rect, but not
+ // intersecting it.
+ gfx::Rect visible_rect = gfx::Rect(0, 0, 99, 99);
+ gfx::Rect eventually_rect = gfx::Rect(0, 0, 500, 500);
+ pending_tiling->ComputeTilePriorityRects(visible_rect, visible_rect,
+ visible_rect, eventually_rect, 1.f,
+ Occlusion());
+
+ Tile* tile = pending_tiling->TileAt(1, 0);
+ EXPECT_NE(pending_tiling->visible_rect_type(),
+ pending_tiling->ComputePriorityRectTypeForTile(tile));
+ EXPECT_FALSE(pending_tiling->IsTileRequiredForActivation(tile));
+ EXPECT_TRUE(tile->content_rect().Intersects(visible_rect));
+ EXPECT_FALSE(pending_tiling->tiling_data()
+ ->TileBounds(tile->tiling_i_index(), tile->tiling_j_index())
+ .Intersects(visible_rect));
+
+ // Now the tile at (1, 0) should be intersecting the visible rect.
+ visible_rect = gfx::Rect(0, 0, 100, 100);
+ pending_tiling->ComputeTilePriorityRects(visible_rect, visible_rect,
+ visible_rect, eventually_rect, 1.f,
+ Occlusion());
+ EXPECT_EQ(pending_tiling->visible_rect_type(),
+ pending_tiling->ComputePriorityRectTypeForTile(tile));
+ EXPECT_TRUE(pending_tiling->IsTileRequiredForActivation(tile));
+ EXPECT_TRUE(tile->content_rect().Intersects(visible_rect));
+ EXPECT_TRUE(pending_tiling->tiling_data()
+ ->TileBounds(tile->tiling_i_index(), tile->tiling_j_index())
+ .Intersects(visible_rect));
+}
+
TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
// The tiling has four rows and three columns.
Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150));
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | cc/tiles/tiling_set_eviction_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698