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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 330003003: cc: Pass ideal contents scale to PictureLayerTiling UpdateTilePriorities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 6 years, 6 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/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 f6fc3ef2f21fcc3d4db33789c22f41f13d97d1a2..2053c9d7368b22b6023c42c64bd07ecd004ad1fc 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);
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698