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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 555183002: cc: Fix layer raster tile iterator not to skip a tile erroneously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« cc/layers/picture_layer_impl.cc ('K') | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index bd6a8f7f479f7fd466a466cfadcbf30597a07103..f72abfbe7f1296ddab3d348b3587065b4da2177f 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2498,6 +2498,11 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) {
}
TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
+ base::TimeTicks time_ticks;
+ time_ticks += base::TimeDelta::FromMilliseconds(1);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
+
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(1000, 1000);
@@ -2563,6 +2568,74 @@ TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count,
unique_tiles.size());
+ time_ticks += base::TimeDelta::FromMilliseconds(200);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
+
+ gfx::Rect viewport = gfx::Rect(1100, 1100, 500, 500);
+ gfx::Transform transform;
+ bool resourceless_software_draw = false;
+ host_impl_.SetExternalDrawConstraints(transform,
vmpstr 2014/09/09 17:37:35 nit: Does host_impl_.SetViewportSize work here ins
USE eero AT chromium.org 2014/09/10 07:48:19 I don't see how as it is not about size but positi
+ viewport,
+ viewport,
+ viewport,
+ transform,
+ resourceless_software_draw);
+ pending_layer_->draw_properties().visible_content_rect = viewport;
+ pending_layer_->draw_properties().screen_space_transform = transform;
vmpstr 2014/09/09 17:37:35 I don't think you need this?
USE eero AT chromium.org 2014/09/10 07:48:19 I'll check.
+ pending_layer_->UpdateTiles(NULL);
+
+ unique_tiles.clear();
+ reached_prepaint = false;
+ non_ideal_tile_count = 0u;
+ low_res_tile_count = 0u;
+ high_res_tile_count = 0u;
+ for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false);
+ it;
+ ++it) {
+ Tile* tile = *it;
+ TilePriority priority = tile->priority(PENDING_TREE);
+
+ EXPECT_TRUE(tile);
+
+ // Non-high res tiles only get visible tiles. Also, prepaint should only
+ // come at the end of the iteration.
+ if (priority.resolution != HIGH_RESOLUTION)
+ EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
+ else if (reached_prepaint)
+ EXPECT_NE(TilePriority::NOW, priority.priority_bin);
+ else
+ reached_prepaint = priority.priority_bin != TilePriority::NOW;
+
+ non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION;
+ low_res_tile_count += priority.resolution == LOW_RESOLUTION;
+ high_res_tile_count += priority.resolution == HIGH_RESOLUTION;
+
+ unique_tiles.insert(tile);
+ }
+
+ EXPECT_TRUE(reached_prepaint);
+ EXPECT_EQ(0u, non_ideal_tile_count);
+ EXPECT_EQ(0u, low_res_tile_count);
+ EXPECT_EQ(16u, high_res_tile_count);
USE eero AT chromium.org 2014/09/09 17:13:45 Without the fix, the iterator returns only 15 high
vmpstr 2014/09/09 17:37:35 These are non-now ones, right?
USE eero AT chromium.org 2014/09/10 07:48:19 Yes, correct.
+ EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count,
+ unique_tiles.size());
+
+ time_ticks += base::TimeDelta::FromMilliseconds(200);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
+
+ viewport = gfx::Rect(0, 0, 500, 500);
+ host_impl_.SetExternalDrawConstraints(transform,
vmpstr 2014/09/09 17:37:35 Same comments here as above
USE eero AT chromium.org 2014/09/10 07:48:19 And the same reply.
+ viewport,
+ viewport,
+ viewport,
+ transform,
+ resourceless_software_draw);
+ pending_layer_->draw_properties().visible_content_rect = viewport;
+ pending_layer_->draw_properties().screen_space_transform = transform;
+ pending_layer_->UpdateTiles(NULL);
+
std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting();
for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin();
tile_it != high_res_tiles.end();
« cc/layers/picture_layer_impl.cc ('K') | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698