summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-08-10 12:23:28 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-10 19:24:31 +0000
commit34fb122ba7915d0d189267e00a5d84d85aca5c98 (patch)
tree83ca0d1ce26fd7b4ee2c87089a3f969f46669af4 /cc
parenta09b9be79387f1107ba29c5f7b0051168193d958 (diff)
downloadchromium_src-34fb122ba7915d0d189267e00a5d84d85aca5c98.zip
chromium_src-34fb122ba7915d0d189267e00a5d84d85aca5c98.tar.gz
chromium_src-34fb122ba7915d0d189267e00a5d84d85aca5c98.tar.bz2
cc: Declare high res tilings to not have low res content.
When a was-low-res tiling is made high res, we reset all the tiles, so we can also reset the flag saying it has low res content in it. That way we don't continually reset all the tiles in it. R=enne, vmpstr BUG=516500 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1274693004 Cr-Commit-Position: refs/heads/master@{#342670}
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer_impl.cc5
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc19
-rw-r--r--cc/tiles/picture_layer_tiling.cc2
-rw-r--r--cc/tiles/picture_layer_tiling.h11
4 files changed, 28 insertions, 9 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 353e670..53a6a0a 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -813,10 +813,13 @@ void PictureLayerImpl::AddTilingsForRasterScale() {
if (!high_res) {
// We always need a high res tiling, so create one if it doesn't exist.
high_res = AddTiling(raster_contents_scale_);
- } else if (high_res->was_ever_low_resolution()) {
+ } else if (high_res->may_contain_low_resolution_tiles()) {
// If the tiling we find here was LOW_RESOLUTION previously, it may not be
// fully rastered, so destroy the old tiles.
high_res->Reset();
+ // Reset the flag now that we'll make it high res, it will have fully
+ // rastered content.
+ high_res->reset_may_contain_low_resolution_tiles();
}
high_res->set_resolution(HIGH_RESOLUTION);
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 15e13a7..73a495c 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -5043,6 +5043,11 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
active_layer_->tilings()->tiling_at(1);
Tile* old_low_res_tile = active_layer_->tilings()->tiling_at(1)->TileAt(0, 0);
+ // The tiling knows it has low res content.
+ EXPECT_TRUE(active_layer_->tilings()
+ ->tiling_at(1)
+ ->may_contain_low_resolution_tiles());
+
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
// Zoom in to exactly the low res factor so that the previous low res
@@ -5052,6 +5057,7 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
// 3 tilings. The old high res, the new high res (old low res) and the new low
// res.
EXPECT_EQ(3u, active_layer_->num_tilings());
+
PictureLayerTilingSet* tilings = active_layer_->tilings();
EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale());
EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale());
@@ -5061,14 +5067,19 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution());
EXPECT_EQ(LOW_RESOLUTION, tilings->tiling_at(2)->resolution());
- EXPECT_FALSE(tilings->tiling_at(0)->was_ever_low_resolution());
- EXPECT_TRUE(tilings->tiling_at(1)->was_ever_low_resolution());
- EXPECT_TRUE(tilings->tiling_at(2)->was_ever_low_resolution());
-
// The old low res tile was destroyed and replaced.
EXPECT_EQ(old_low_res_tiling, tilings->tiling_at(1));
EXPECT_NE(old_low_res_tile, tilings->tiling_at(1)->TileAt(0, 0));
EXPECT_TRUE(tilings->tiling_at(1)->TileAt(0, 0));
+
+ // New high res tiling.
+ EXPECT_FALSE(tilings->tiling_at(0)->may_contain_low_resolution_tiles());
+ // New low res tiling.
+ EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles());
+
+ // This tiling will be high res now, it won't contain low res content since it
+ // was all destroyed.
+ EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles());
}
} // namespace
diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc
index a5809dc..1104cd8 100644
--- a/cc/tiles/picture_layer_tiling.cc
+++ b/cc/tiles/picture_layer_tiling.cc
@@ -64,7 +64,7 @@ PictureLayerTiling::PictureLayerTiling(
tree_(tree),
raster_source_(raster_source),
resolution_(NON_IDEAL_RESOLUTION),
- was_ever_low_resolution_(false),
+ may_contain_low_resolution_tiles_(false),
tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
can_require_tiles_for_activation_(false),
current_content_to_screen_scale_(0.f),
diff --git a/cc/tiles/picture_layer_tiling.h b/cc/tiles/picture_layer_tiling.h
index a4e67d19..a0693d2 100644
--- a/cc/tiles/picture_layer_tiling.h
+++ b/cc/tiles/picture_layer_tiling.h
@@ -113,10 +113,15 @@ class CC_EXPORT PictureLayerTiling {
void set_resolution(TileResolution resolution) {
resolution_ = resolution;
- was_ever_low_resolution_ |= resolution == LOW_RESOLUTION;
+ may_contain_low_resolution_tiles_ |= resolution == LOW_RESOLUTION;
}
TileResolution resolution() const { return resolution_; }
- bool was_ever_low_resolution() const { return was_ever_low_resolution_; }
+ bool may_contain_low_resolution_tiles() const {
+ return may_contain_low_resolution_tiles_;
+ }
+ void reset_may_contain_low_resolution_tiles() {
+ may_contain_low_resolution_tiles_ = false;
+ }
void set_can_require_tiles_for_activation(bool can_require_tiles) {
can_require_tiles_for_activation_ = can_require_tiles;
}
@@ -373,7 +378,7 @@ class CC_EXPORT PictureLayerTiling {
const WhichTree tree_;
scoped_refptr<RasterSource> raster_source_;
TileResolution resolution_;
- bool was_ever_low_resolution_;
+ bool may_contain_low_resolution_tiles_;
// Internal data.
TilingData tiling_data_;