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

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: Rebase fix 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
« no previous file with comments | « cc/resources/tiling_set_eviction_queue.h ('k') | cc/resources/tiling_set_raster_queue_all.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 // EvictionRectIterator 183 // EvictionRectIterator
184 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator() 184 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator()
185 : tilings_(nullptr), tree_(ACTIVE_TREE), tiling_index_(0) { 185 : tilings_(nullptr), tree_(ACTIVE_TREE), tiling_index_(0) {
186 } 186 }
187 187
188 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator( 188 TilingSetEvictionQueue::EvictionRectIterator::EvictionRectIterator(
189 std::vector<PictureLayerTiling*>* tilings, 189 std::vector<PictureLayerTiling*>* tilings,
190 WhichTree tree, 190 WhichTree tree,
191 bool skip_pending_visible_rect) 191 PictureLayerTiling::PriorityRectType priority_rect_type)
192 : tilings_(tilings), 192 : tilings_(tilings),
193 tree_(tree), 193 tree_(tree),
194 skip_pending_visible_rect_(skip_pending_visible_rect), 194 priority_rect_type_(priority_rect_type),
195 tiling_index_(0) { 195 tiling_index_(0) {
196 } 196 }
197 197
198 template <typename TilingIteratorType> 198 template <typename TilingIteratorType>
199 bool TilingSetEvictionQueue::EvictionRectIterator::AdvanceToNextTile( 199 bool TilingSetEvictionQueue::EvictionRectIterator::AdvanceToNextTile(
200 TilingIteratorType* iterator) { 200 TilingIteratorType* iterator) {
201 bool found_tile = false; 201 bool found_tile = false;
202 while (!found_tile) { 202 while (!found_tile) {
203 ++(*iterator); 203 ++(*iterator);
204 if (!(*iterator)) { 204 if (!(*iterator)) {
205 prioritized_tile_ = PrioritizedTile(); 205 prioritized_tile_ = PrioritizedTile();
206 break; 206 break;
207 } 207 }
208 found_tile = GetFirstTileAndCheckIfValid(iterator); 208 found_tile = GetFirstTileAndCheckIfValid(iterator);
209 } 209 }
210 return found_tile; 210 return found_tile;
211 } 211 }
212 212
213 template <typename TilingIteratorType> 213 template <typename TilingIteratorType>
214 bool TilingSetEvictionQueue::EvictionRectIterator::GetFirstTileAndCheckIfValid( 214 bool TilingSetEvictionQueue::EvictionRectIterator::GetFirstTileAndCheckIfValid(
215 TilingIteratorType* iterator) { 215 TilingIteratorType* iterator) {
216 PictureLayerTiling* tiling = (*tilings_)[tiling_index_]; 216 PictureLayerTiling* tiling = (*tilings_)[tiling_index_];
217 Tile* tile = tiling->TileAt(iterator->index_x(), iterator->index_y()); 217 Tile* tile = tiling->TileAt(iterator->index_x(), iterator->index_y());
218 prioritized_tile_ = PrioritizedTile(); 218 prioritized_tile_ = PrioritizedTile();
219 // If there's nothing to evict, return false. 219 // If there's nothing to evict, return false.
220 if (!tile || !tile->HasResource()) 220 if (!tile || !tile->HasResource())
221 return false; 221 return false;
222 if (skip_pending_visible_rect_ && 222 // After the pending visible rect has been processed, we must return false
223 // for pending visible rect tiles as tiling iterators do not ignore those
224 // tiles.
225 if (priority_rect_type_ > PictureLayerTiling::PENDING_VISIBLE_RECT &&
223 tiling->pending_visible_rect().Intersects(tile->content_rect())) { 226 tiling->pending_visible_rect().Intersects(tile->content_rect())) {
224 return false; 227 return false;
225 } 228 }
226 (*tilings_)[tiling_index_]->UpdateRequiredStatesOnTile(tile); 229 (*tilings_)[tiling_index_]->UpdateRequiredStatesOnTile(tile);
227 prioritized_tile_ = (*tilings_)[tiling_index_]->MakePrioritizedTile(tile); 230 prioritized_tile_ = (*tilings_)[tiling_index_]->MakePrioritizedTile(
231 tile, priority_rect_type_);
228 // In other cases, the tile we got is a viable candidate, return true. 232 // In other cases, the tile we got is a viable candidate, return true.
229 return true; 233 return true;
230 } 234 }
231 235
232 // EventuallyTilingIterator 236 // EventuallyTilingIterator
233 TilingSetEvictionQueue::EventuallyTilingIterator::EventuallyTilingIterator( 237 TilingSetEvictionQueue::EventuallyTilingIterator::EventuallyTilingIterator(
234 std::vector<PictureLayerTiling*>* tilings, 238 std::vector<PictureLayerTiling*>* tilings,
235 WhichTree tree) 239 WhichTree tree)
236 : EvictionRectIterator(tilings, 240 : EvictionRectIterator(tilings, tree, PictureLayerTiling::EVENTUALLY_RECT) {
237 tree,
238 true /* skip_pending_visible_rect */) {
239 // Find the first tiling with a tile. 241 // Find the first tiling with a tile.
240 while (tiling_index_ < tilings_->size()) { 242 while (tiling_index_ < tilings_->size()) {
241 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) { 243 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) {
242 ++tiling_index_; 244 ++tiling_index_;
243 continue; 245 continue;
244 } 246 }
245 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 247 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
246 (*tilings_)[tiling_index_]->tiling_data(), 248 (*tilings_)[tiling_index_]->tiling_data(),
247 (*tilings_)[tiling_index_]->current_eventually_rect(), 249 (*tilings_)[tiling_index_]->current_eventually_rect(),
248 (*tilings_)[tiling_index_]->current_skewport_rect(), 250 (*tilings_)[tiling_index_]->current_skewport_rect(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 282 }
281 return *this; 283 return *this;
282 } 284 }
283 285
284 // SoonBorderTilingIterator 286 // SoonBorderTilingIterator
285 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator( 287 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator(
286 std::vector<PictureLayerTiling*>* tilings, 288 std::vector<PictureLayerTiling*>* tilings,
287 WhichTree tree) 289 WhichTree tree)
288 : EvictionRectIterator(tilings, 290 : EvictionRectIterator(tilings,
289 tree, 291 tree,
290 true /* skip_pending_visible_rect */) { 292 PictureLayerTiling::SOON_BORDER_RECT) {
291 // Find the first tiling with a tile. 293 // Find the first tiling with a tile.
292 while (tiling_index_ < tilings_->size()) { 294 while (tiling_index_ < tilings_->size()) {
293 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) { 295 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) {
294 ++tiling_index_; 296 ++tiling_index_;
295 continue; 297 continue;
296 } 298 }
297 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 299 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
298 (*tilings_)[tiling_index_]->tiling_data(), 300 (*tilings_)[tiling_index_]->tiling_data(),
299 (*tilings_)[tiling_index_]->current_soon_border_rect(), 301 (*tilings_)[tiling_index_]->current_soon_border_rect(),
300 (*tilings_)[tiling_index_]->current_skewport_rect(), 302 (*tilings_)[tiling_index_]->current_skewport_rect(),
(...skipping 29 matching lines...) Expand all
330 if (!found_tile) 332 if (!found_tile)
331 found_tile = AdvanceToNextTile(&iterator_); 333 found_tile = AdvanceToNextTile(&iterator_);
332 } 334 }
333 return *this; 335 return *this;
334 } 336 }
335 337
336 // SkewportTilingIterator 338 // SkewportTilingIterator
337 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator( 339 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator(
338 std::vector<PictureLayerTiling*>* tilings, 340 std::vector<PictureLayerTiling*>* tilings,
339 WhichTree tree) 341 WhichTree tree)
340 : EvictionRectIterator(tilings, 342 : EvictionRectIterator(tilings, tree, PictureLayerTiling::SKEWPORT_RECT) {
341 tree,
342 true /* skip_pending_visible_rect */) {
343 // Find the first tiling with a tile. 343 // Find the first tiling with a tile.
344 while (tiling_index_ < tilings_->size()) { 344 while (tiling_index_ < tilings_->size()) {
345 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) { 345 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) {
346 ++tiling_index_; 346 ++tiling_index_;
347 continue; 347 continue;
348 } 348 }
349 iterator_ = TilingData::ReverseSpiralDifferenceIterator( 349 iterator_ = TilingData::ReverseSpiralDifferenceIterator(
350 (*tilings_)[tiling_index_]->tiling_data(), 350 (*tilings_)[tiling_index_]->tiling_data(),
351 (*tilings_)[tiling_index_]->current_skewport_rect(), 351 (*tilings_)[tiling_index_]->current_skewport_rect(),
352 (*tilings_)[tiling_index_]->current_visible_rect(), 352 (*tilings_)[tiling_index_]->current_visible_rect(),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return *this; 385 return *this;
386 } 386 }
387 387
388 // PendingVisibleIterator 388 // PendingVisibleIterator
389 TilingSetEvictionQueue::PendingVisibleTilingIterator:: 389 TilingSetEvictionQueue::PendingVisibleTilingIterator::
390 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings, 390 PendingVisibleTilingIterator(std::vector<PictureLayerTiling*>* tilings,
391 WhichTree tree, 391 WhichTree tree,
392 bool return_required_for_activation_tiles) 392 bool return_required_for_activation_tiles)
393 : EvictionRectIterator(tilings, 393 : EvictionRectIterator(tilings,
394 tree, 394 tree,
395 false /* skip_pending_visible_rect */), 395 PictureLayerTiling::PENDING_VISIBLE_RECT),
396 return_required_for_activation_tiles_( 396 return_required_for_activation_tiles_(
397 return_required_for_activation_tiles) { 397 return_required_for_activation_tiles) {
398 // Find the first tiling with a tile. 398 // Find the first tiling with a tile.
399 while (tiling_index_ < tilings_->size()) { 399 while (tiling_index_ < tilings_->size()) {
400 iterator_ = TilingData::DifferenceIterator( 400 iterator_ = TilingData::DifferenceIterator(
401 (*tilings_)[tiling_index_]->tiling_data(), 401 (*tilings_)[tiling_index_]->tiling_data(),
402 (*tilings_)[tiling_index_]->pending_visible_rect(), 402 (*tilings_)[tiling_index_]->pending_visible_rect(),
403 (*tilings_)[tiling_index_]->current_visible_rect()); 403 (*tilings_)[tiling_index_]->current_visible_rect());
404 if (!iterator_) { 404 if (!iterator_) {
405 ++tiling_index_; 405 ++tiling_index_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return_required_for_activation_tiles_; 449 return_required_for_activation_tiles_;
450 return activation_flag_matches; 450 return activation_flag_matches;
451 } 451 }
452 452
453 // VisibleTilingIterator 453 // VisibleTilingIterator
454 TilingSetEvictionQueue::VisibleTilingIterator::VisibleTilingIterator( 454 TilingSetEvictionQueue::VisibleTilingIterator::VisibleTilingIterator(
455 std::vector<PictureLayerTiling*>* tilings, 455 std::vector<PictureLayerTiling*>* tilings,
456 WhichTree tree, 456 WhichTree tree,
457 bool return_occluded_tiles, 457 bool return_occluded_tiles,
458 bool return_required_for_activation_tiles) 458 bool return_required_for_activation_tiles)
459 : EvictionRectIterator(tilings, 459 : EvictionRectIterator(tilings, tree, PictureLayerTiling::VISIBLE_RECT),
460 tree,
461 false /* skip_pending_visible_rect */),
462 return_occluded_tiles_(return_occluded_tiles), 460 return_occluded_tiles_(return_occluded_tiles),
463 return_required_for_activation_tiles_( 461 return_required_for_activation_tiles_(
464 return_required_for_activation_tiles) { 462 return_required_for_activation_tiles) {
465 // Find the first tiling with a tile. 463 // Find the first tiling with a tile.
466 while (tiling_index_ < tilings_->size()) { 464 while (tiling_index_ < tilings_->size()) {
467 if (!(*tilings_)[tiling_index_]->has_visible_rect_tiles()) { 465 if (!(*tilings_)[tiling_index_]->has_visible_rect_tiles()) {
468 ++tiling_index_; 466 ++tiling_index_;
469 continue; 467 continue;
470 } 468 }
471 iterator_ = TilingData::Iterator( 469 iterator_ = TilingData::Iterator(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 514
517 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags( 515 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags(
518 const PrioritizedTile& tile) const { 516 const PrioritizedTile& tile) const {
519 bool activation_flag_matches = tile.tile()->required_for_activation() == 517 bool activation_flag_matches = tile.tile()->required_for_activation() ==
520 return_required_for_activation_tiles_; 518 return_required_for_activation_tiles_;
521 bool occluded_flag_matches = tile.is_occluded() == return_occluded_tiles_; 519 bool occluded_flag_matches = tile.is_occluded() == return_occluded_tiles_;
522 return activation_flag_matches && occluded_flag_matches; 520 return activation_flag_matches && occluded_flag_matches;
523 } 521 }
524 522
525 } // namespace cc 523 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tiling_set_eviction_queue.h ('k') | cc/resources/tiling_set_raster_queue_all.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698