summaryrefslogtreecommitdiffstats
path: root/cc/layers/picture_layer_impl_unittest.cc
diff options
context:
space:
mode:
authorsohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-27 20:58:14 +0000
committersohan.jyoti@samsung.com <sohan.jyoti@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-27 20:58:14 +0000
commit578de9c1e4e17bb58a01ed04014489260c7f064a (patch)
tree16be8632c5c8baeb1dd86802cf5cae20c702a91c /cc/layers/picture_layer_impl_unittest.cc
parent77788ca2d687875f60c4abd814040cbb32eeb0cf (diff)
downloadchromium_src-578de9c1e4e17bb58a01ed04014489260c7f064a.zip
chromium_src-578de9c1e4e17bb58a01ed04014489260c7f064a.tar.gz
chromium_src-578de9c1e4e17bb58a01ed04014489260c7f064a.tar.bz2
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
Diffstat (limited to 'cc/layers/picture_layer_impl_unittest.cc')
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc38
1 files changed, 22 insertions, 16 deletions
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<Tile*> all_tiles_set(all_tiles.begin(), all_tiles.end());
bool mark_required = false;
- for (std::vector<Tile*>::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<float>::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);