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

Side by Side Diff: cc/resources/tile_manager_unittest.cc

Issue 651503004: cc: Bump up pending tree now tiles order for smoothness mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format fix Created 6 years, 2 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 unified diff | Download patch
« cc/resources/tile_manager.cc ('K') | « cc/resources/tile_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/eviction_tile_priority_queue.h" 5 #include "cc/resources/eviction_tile_priority_queue.h"
6 #include "cc/resources/raster_tile_priority_queue.h" 6 #include "cc/resources/raster_tile_priority_queue.h"
7 #include "cc/resources/tile.h" 7 #include "cc/resources/tile.h"
8 #include "cc/resources/tile_priority.h" 8 #include "cc/resources/tile_priority.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 all_tiles.insert(active_high_res_tiles[i]); 214 all_tiles.insert(active_high_res_tiles[i]);
215 215
216 std::vector<Tile*> active_low_res_tiles = 216 std::vector<Tile*> active_low_res_tiles =
217 active_layer_->LowResTiling()->AllTilesForTesting(); 217 active_layer_->LowResTiling()->AllTilesForTesting();
218 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) 218 for (size_t i = 0; i < active_low_res_tiles.size(); ++i)
219 all_tiles.insert(active_low_res_tiles[i]); 219 all_tiles.insert(active_low_res_tiles[i]);
220 220
221 Tile* last_tile = NULL; 221 Tile* last_tile = NULL;
222 smoothness_tiles.clear(); 222 smoothness_tiles.clear();
223 tile_count = 0; 223 tile_count = 0;
224 size_t increasing_distance_tiles = 0u; 224 size_t correct_order_tiles = 0u;
225 // Here we expect to get increasing ACTIVE_TREE priority_bin. 225 // Here we expect to get increasing ACTIVE_TREE priority_bin.
226 queue.Reset(); 226 queue.Reset();
227 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); 227 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
228 while (!queue.IsEmpty()) { 228 while (!queue.IsEmpty()) {
229 Tile* tile = queue.Top(); 229 Tile* tile = queue.Top();
230 EXPECT_TRUE(tile); 230 EXPECT_TRUE(tile);
231 231
232 if (!last_tile) 232 if (!last_tile)
233 last_tile = tile; 233 last_tile = tile;
234 234
235 EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, 235 EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin,
236 tile->priority(ACTIVE_TREE).priority_bin); 236 tile->priority(ACTIVE_TREE).priority_bin);
237 bool skip_updating_last_tile = false;
237 if (last_tile->priority(ACTIVE_TREE).priority_bin == 238 if (last_tile->priority(ACTIVE_TREE).priority_bin ==
238 tile->priority(ACTIVE_TREE).priority_bin) { 239 tile->priority(ACTIVE_TREE).priority_bin) {
239 increasing_distance_tiles += 240 correct_order_tiles +=
240 last_tile->priority(ACTIVE_TREE).distance_to_visible <= 241 last_tile->priority(ACTIVE_TREE).distance_to_visible <=
241 tile->priority(ACTIVE_TREE).distance_to_visible; 242 tile->priority(ACTIVE_TREE).distance_to_visible;
243 } else if (tile->priority(ACTIVE_TREE).priority_bin ==
244 TilePriority::EVENTUALLY &&
245 tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW) {
246 // Since we'd return pending tree now tiles before the eventually tiles on
247 // the active tree, update the value.
248 ++correct_order_tiles;
249 skip_updating_last_tile = true;
242 } 250 }
243 251
244 if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW && 252 if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW &&
245 last_tile->priority(ACTIVE_TREE).resolution != 253 last_tile->priority(ACTIVE_TREE).resolution !=
246 tile->priority(ACTIVE_TREE).resolution) { 254 tile->priority(ACTIVE_TREE).resolution) {
247 // Low resolution should come first. 255 // Low resolution should come first.
248 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); 256 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution);
249 } 257 }
250 258
251 last_tile = tile; 259 if (!skip_updating_last_tile)
260 last_tile = tile;
252 ++tile_count; 261 ++tile_count;
253 smoothness_tiles.insert(tile); 262 smoothness_tiles.insert(tile);
254 queue.Pop(); 263 queue.Pop();
255 } 264 }
256 265
257 EXPECT_EQ(tile_count, smoothness_tiles.size()); 266 EXPECT_EQ(tile_count, smoothness_tiles.size());
258 EXPECT_EQ(all_tiles, smoothness_tiles); 267 EXPECT_EQ(all_tiles, smoothness_tiles);
259 // Since we don't guarantee increasing distance due to spiral iterator, we 268 // Since we don't guarantee increasing distance due to spiral iterator, we
260 // should check that we're _mostly_ right. 269 // should check that we're _mostly_ right.
261 EXPECT_GT(increasing_distance_tiles, 3 * tile_count / 4); 270 EXPECT_GT(correct_order_tiles, 3 * tile_count / 4);
262 271
263 std::set<Tile*> new_content_tiles; 272 std::set<Tile*> new_content_tiles;
264 last_tile = NULL; 273 last_tile = NULL;
265 increasing_distance_tiles = 0u; 274 size_t increasing_distance_tiles = 0u;
266 // Here we expect to get increasing PENDING_TREE priority_bin. 275 // Here we expect to get increasing PENDING_TREE priority_bin.
267 queue.Reset(); 276 queue.Reset();
268 host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); 277 host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY);
269 while (!queue.IsEmpty()) { 278 while (!queue.IsEmpty()) {
270 Tile* tile = queue.Top(); 279 Tile* tile = queue.Top();
271 EXPECT_TRUE(tile); 280 EXPECT_TRUE(tile);
272 281
273 if (!last_tile) 282 if (!last_tile)
274 last_tile = tile; 283 last_tile = tile;
275 284
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 all_tiles.insert(queue.Top()); 680 all_tiles.insert(queue.Top());
672 ++tile_count; 681 ++tile_count;
673 queue.Pop(); 682 queue.Pop();
674 } 683 }
675 EXPECT_EQ(tile_count, all_tiles.size()); 684 EXPECT_EQ(tile_count, all_tiles.size());
676 EXPECT_EQ(17u, tile_count); 685 EXPECT_EQ(17u, tile_count);
677 } 686 }
678 687
679 } // namespace 688 } // namespace
680 } // namespace cc 689 } // namespace cc
OLDNEW
« cc/resources/tile_manager.cc ('K') | « cc/resources/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698