From 578de9c1e4e17bb58a01ed04014489260c7f064a Mon Sep 17 00:00:00 2001 From: "sohan.jyoti@samsung.com" Date: Fri, 27 Jun 2014 20:58:14 +0000 Subject: cc: Pass ideal contents scale to PictureLayerTiling UpdateTilePriorities. Avoid passing MaximumContentsScale and pass ideal contents scale while updating tile priorities from PictureLayerImpl, and fix related test. BUG= Review URL: https://codereview.chromium.org/330003003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280409 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/layers/picture_layer_impl_unittest.cc | 38 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to '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 f6fc3ef..2053c9d 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -1983,18 +1983,31 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { std::set all_tiles_set(all_tiles.begin(), all_tiles.end()); bool mark_required = false; - for (std::vector::iterator it = all_tiles.begin(); - it != all_tiles.end(); - ++it) { - Tile* tile = *it; - if (mark_required) - tile->MarkRequiredForActivation(); - mark_required = !mark_required; + size_t number_of_marked_tiles = 0u; + size_t number_of_unmarked_tiles = 0u; + for (size_t i = 0; i < tilings.size(); ++i) { + PictureLayerTiling* tiling = tilings.at(i); + for (PictureLayerTiling::CoverageIterator iter( + tiling, + pending_layer_->contents_scale_x(), + pending_layer_->visible_content_rect()); + iter; + ++iter) { + if (mark_required) { + number_of_marked_tiles++; + iter->MarkRequiredForActivation(); + } else { + number_of_unmarked_tiles++; + } + mark_required = !mark_required; + } } // Sanity checks. EXPECT_EQ(91u, all_tiles.size()); EXPECT_EQ(91u, all_tiles_set.size()); + EXPECT_GT(number_of_marked_tiles, 1u); + EXPECT_GT(number_of_unmarked_tiles, 1u); // Empty iterator. PictureLayerImpl::LayerEvictionTileIterator it; @@ -2011,7 +2024,6 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { float expected_scales[] = {2.0f, 0.3f, 0.7f, low_res_factor, 1.0f}; size_t scale_index = 0; bool reached_visible = false; - bool reached_required = false; Tile* last_tile = NULL; for (it = PictureLayerImpl::LayerEvictionTileIterator( pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); @@ -2031,12 +2043,7 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { break; } - if (reached_required) { - EXPECT_TRUE(tile->required_for_activation()); - } else if (tile->required_for_activation()) { - reached_required = true; - scale_index = 0; - } + EXPECT_FALSE(tile->required_for_activation()); while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > std::numeric_limits::epsilon()) { @@ -2063,11 +2070,10 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { } EXPECT_TRUE(reached_visible); - EXPECT_TRUE(reached_required); EXPECT_EQ(65u, unique_tiles.size()); scale_index = 0; - reached_required = false; + bool reached_required = false; for (; it; ++it) { Tile* tile = *it; EXPECT_TRUE(tile); -- cgit v1.1