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

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

Issue 1126813002: cc: Pass priority rect information from iterators to tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <utility> 5 #include <utility>
6 6
7 #include "cc/resources/tiling_set_eviction_queue.h" 7 #include "cc/resources/tiling_set_eviction_queue.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator() 191 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator()
192 : tile_(nullptr), 192 : tile_(nullptr),
193 tilings_(nullptr), 193 tilings_(nullptr),
194 tree_(ACTIVE_TREE), 194 tree_(ACTIVE_TREE),
195 tiling_index_(0) { 195 tiling_index_(0) {
196 } 196 }
197 197
198 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator( 198 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator(
199 std::vector<PictureLayerTiling*>* tilings, 199 std::vector<PictureLayerTiling*>* tilings,
200 WhichTree tree, 200 WhichTree tree,
201 bool skip_pending_visible_rect) 201 PictureLayerTiling::PriorityRect priority_rect)
202 : tile_(nullptr), 202 : tile_(nullptr),
203 tilings_(tilings), 203 tilings_(tilings),
204 tree_(tree), 204 tree_(tree),
205 skip_pending_visible_rect_(skip_pending_visible_rect), 205 priority_rect_(priority_rect),
206 tiling_index_(0) { 206 tiling_index_(0) {
207 } 207 }
208 208
209 template <typename TilingIteratorType> 209 template <typename TilingIteratorType>
210 bool TilingSetEvictionQueue::EvictionRectIterator::AdvanceToNextTile( 210 bool TilingSetEvictionQueue::EvictionRectIterator::AdvanceToNextTile(
211 TilingIteratorType* iterator) { 211 TilingIteratorType* iterator) {
212 bool found_tile = false; 212 bool found_tile = false;
213 while (!found_tile) { 213 while (!found_tile) {
214 ++(*iterator); 214 ++(*iterator);
215 if (!(*iterator)) { 215 if (!(*iterator)) {
216 tile_ = nullptr; 216 tile_ = nullptr;
217 break; 217 break;
218 } 218 }
219 found_tile = GetFirstTileAndCheckIfValid(iterator); 219 found_tile = GetFirstTileAndCheckIfValid(iterator);
220 } 220 }
221 return found_tile; 221 return found_tile;
222 } 222 }
223 223
224 template <typename TilingIteratorType> 224 template <typename TilingIteratorType>
225 bool TilingSetEvictionQueue::EvictionRectIterator::GetFirstTileAndCheckIfValid( 225 bool TilingSetEvictionQueue::EvictionRectIterator::GetFirstTileAndCheckIfValid(
226 TilingIteratorType* iterator) { 226 TilingIteratorType* iterator) {
227 PictureLayerTiling* tiling = (*tilings_)[tiling_index_]; 227 PictureLayerTiling* tiling = (*tilings_)[tiling_index_];
228 tile_ = tiling->TileAt(iterator->index_x(), iterator->index_y()); 228 tile_ = tiling->TileAt(iterator->index_x(), iterator->index_y());
229 // If there's nothing to evict, return false. 229 // If there's nothing to evict, return false.
230 if (!tile_ || !tile_->HasResource()) 230 if (!tile_ || !tile_->HasResource())
231 return false; 231 return false;
232 if (skip_pending_visible_rect_ && 232 if (priority_rect_ > PictureLayerTiling::PriorityRect::PENDING_VISIBLE_RECT &&
vmpstr 2015/05/05 18:04:02 Can you leave a comment here, just something expla
USE eero AT chromium.org 2015/05/06 12:05:20 Done.
233 tiling->pending_visible_rect().Intersects(tile_->content_rect())) { 233 tiling->pending_visible_rect().Intersects(tile_->content_rect())) {
234 return false; 234 return false;
235 } 235 }
236 (*tilings_)[tiling_index_]->UpdateTilePriority(tile_); 236 (*tilings_)[tiling_index_]->UpdateTilePriority(tile_, priority_rect_);
237 // In other cases, the tile we got is a viable candidate, return true. 237 // In other cases, the tile we got is a viable candidate, return true.
238 return true; 238 return true;
239 } 239 }
240 240
241 // EventuallyTilingIterator 241 // EventuallyTilingIterator
242 TilingSetEvictionQueue::EventuallyTilingIterator::EventuallyTilingIterator( 242 TilingSetEvictionQueue::EventuallyTilingIterator::EventuallyTilingIterator(
243 std::vector<PictureLayerTiling*>* tilings, 243 std::vector<PictureLayerTiling*>* tilings,
244 WhichTree tree) 244 WhichTree tree)
245 : EvictionRectIterator(tilings, 245 : EvictionRectIterator(tilings,
246 tree, 246 tree,
247 true /* skip_pending_visible_rect */) { 247 PictureLayerTiling::PriorityRect::EVENTUALLY_RECT) {
248 // Find the first tiling with a tile. 248 // Find the first tiling with a tile.
249 while (tiling_index_ < tilings_->size()) { 249 while (tiling_index_ < tilings_->size()) {
250 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) { 250 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) {
251 ++tiling_index_; 251 ++tiling_index_;
252 continue; 252 continue;
253 } 253 }
254 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 254 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
255 (*tilings_)[tiling_index_]->tiling_data(), 255 (*tilings_)[tiling_index_]->tiling_data(),
256 (*tilings_)[tiling_index_]->current_eventually_rect(), 256 (*tilings_)[tiling_index_]->current_eventually_rect(),
257 (*tilings_)[tiling_index_]->current_skewport_rect(), 257 (*tilings_)[tiling_index_]->current_skewport_rect(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 return *this; 290 return *this;
291 } 291 }
292 292
293 // SoonBorderTilingIterator 293 // SoonBorderTilingIterator
294 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator( 294 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator(
295 std::vector<PictureLayerTiling*>* tilings, 295 std::vector<PictureLayerTiling*>* tilings,
296 WhichTree tree) 296 WhichTree tree)
297 : EvictionRectIterator(tilings, 297 : EvictionRectIterator(tilings,
298 tree, 298 tree,
299 true /* skip_pending_visible_rect */) { 299 PictureLayerTiling::PriorityRect::SOON_BORDER_RECT) {
vmpstr 2015/05/05 18:04:01 The PriorityRect:: part is not needed here, unless
USE eero AT chromium.org 2015/05/06 12:05:20 I do not want to make it an enum. But I thought th
300 // Find the first tiling with a tile. 300 // Find the first tiling with a tile.
301 while (tiling_index_ < tilings_->size()) { 301 while (tiling_index_ < tilings_->size()) {
302 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) { 302 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) {
303 ++tiling_index_; 303 ++tiling_index_;
304 continue; 304 continue;
305 } 305 }
306 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 306 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
307 (*tilings_)[tiling_index_]->tiling_data(), 307 (*tilings_)[tiling_index_]->tiling_data(),
308 (*tilings_)[tiling_index_]->current_soon_border_rect(), 308 (*tilings_)[tiling_index_]->current_soon_border_rect(),
309 (*tilings_)[tiling_index_]->current_skewport_rect(), 309 (*tilings_)[tiling_index_]->current_skewport_rect(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 return *this; 342 return *this;
343 } 343 }
344 344
345 // SkewportTilingIterator 345 // SkewportTilingIterator
346 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator( 346 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator(
347 std::vector<PictureLayerTiling*>* tilings, 347 std::vector<PictureLayerTiling*>* tilings,
348 WhichTree tree) 348 WhichTree tree)
349 : EvictionRectIterator(tilings, 349 : EvictionRectIterator(tilings,
350 tree, 350 tree,
351 true /* skip_pending_visible_rect */) { 351 PictureLayerTiling::PriorityRect::SKEWPORT_RECT) {
352 // Find the first tiling with a tile. 352 // Find the first tiling with a tile.
353 while (tiling_index_ < tilings_->size()) { 353 while (tiling_index_ < tilings_->size()) {
354 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) { 354 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) {
355 ++tiling_index_; 355 ++tiling_index_;
356 continue; 356 continue;
357 } 357 }
358 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 358 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
359 (*tilings_)[tiling_index_]->tiling_data(), 359 (*tilings_)[tiling_index_]->tiling_data(),
360 (*tilings_)[tiling_index_]->current_skewport_rect(), 360 (*tilings_)[tiling_index_]->current_skewport_rect(),
361 (*tilings_)[tiling_index_]->current_visible_rect(), 361 (*tilings_)[tiling_index_]->current_visible_rect(),
(...skipping 30 matching lines...) Expand all
392 found_tile = AdvanceToNextTile(&iterator_); 392 found_tile = AdvanceToNextTile(&iterator_);
393 } 393 }
394 return *this; 394 return *this;
395 } 395 }
396 396
397 // PendingVisibleIterator 397 // PendingVisibleIterator
398 TilingSetEvictionQueue::PendingVisibleTilingIterator:: 398 TilingSetEvictionQueue::PendingVisibleTilingIterator::
399 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, 399 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings,
400 WhichTree tree, 400 WhichTree tree,
401 bool return_required_for_activation_tiles) 401 bool return_required_for_activation_tiles)
402 : EvictionRectIterator(tilings, 402 : EvictionRectIterator(
403 tree, 403 tilings,
404 false /* skip_pending_visible_rect */), 404 tree,
405 PictureLayerTiling::PriorityRect::PENDING_VISIBLE_RECT),
405 return_required_for_activation_tiles_( 406 return_required_for_activation_tiles_(
406 return_required_for_activation_tiles) { 407 return_required_for_activation_tiles) {
407 // Find the first tiling with a tile. 408 // Find the first tiling with a tile.
408 while (tiling_index_ < tilings_->size()) { 409 while (tiling_index_ < tilings_->size()) {
409 iterator_ = TilingData::DifferenceIterator( 410 iterator_ = TilingData::DifferenceIterator(
410 (*tilings_)[tiling_index_]->tiling_data(), 411 (*tilings_)[tiling_index_]->tiling_data(),
411 (*tilings_)[tiling_index_]->pending_visible_rect(), 412 (*tilings_)[tiling_index_]->pending_visible_rect(),
412 (*tilings_)[tiling_index_]->current_visible_rect()); 413 (*tilings_)[tiling_index_]->current_visible_rect());
413 if (!iterator_) { 414 if (!iterator_) {
414 ++tiling_index_; 415 ++tiling_index_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 461 }
461 462
462 // VisibleTilingIterator 463 // VisibleTilingIterator
463 TilingSetEvictionQueue::VisibleTilingIterator::VisibleTilingIterator( 464 TilingSetEvictionQueue::VisibleTilingIterator::VisibleTilingIterator(
464 std::vector<PictureLayerTiling*>* tilings, 465 std::vector<PictureLayerTiling*>* tilings,
465 WhichTree tree, 466 WhichTree tree,
466 bool return_occluded_tiles, 467 bool return_occluded_tiles,
467 bool return_required_for_activation_tiles) 468 bool return_required_for_activation_tiles)
468 : EvictionRectIterator(tilings, 469 : EvictionRectIterator(tilings,
469 tree, 470 tree,
470 false /* skip_pending_visible_rect */), 471 PictureLayerTiling::PriorityRect::VISIBLE_RECT),
471 return_occluded_tiles_(return_occluded_tiles), 472 return_occluded_tiles_(return_occluded_tiles),
472 return_required_for_activation_tiles_( 473 return_required_for_activation_tiles_(
473 return_required_for_activation_tiles) { 474 return_required_for_activation_tiles) {
474 // Find the first tiling with a tile. 475 // Find the first tiling with a tile.
475 while (tiling_index_ < tilings_->size()) { 476 while (tiling_index_ < tilings_->size()) {
476 if (!(*tilings_)[tiling_index_]->has_visible_rect_tiles()) { 477 if (!(*tilings_)[tiling_index_]->has_visible_rect_tiles()) {
477 ++tiling_index_; 478 ++tiling_index_;
478 continue; 479 continue;
479 } 480 }
480 iterator_ = TilingData::Iterator( 481 iterator_ = TilingData::Iterator(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 526
526 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags( 527 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags(
527 const Tile* tile) const { 528 const Tile* tile) const {
528 bool activation_flag_matches = 529 bool activation_flag_matches =
529 tile->required_for_activation() == return_required_for_activation_tiles_; 530 tile->required_for_activation() == return_required_for_activation_tiles_;
530 bool occluded_flag_matches = tile->is_occluded() == return_occluded_tiles_; 531 bool occluded_flag_matches = tile->is_occluded() == return_occluded_tiles_;
531 return activation_flag_matches && occluded_flag_matches; 532 return activation_flag_matches && occluded_flag_matches;
532 } 533 }
533 534
534 } // namespace cc 535 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698