OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/tiles/tiling_set_eviction_queue.h" | 9 #include "cc/tiles/tiling_set_eviction_queue.h" |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Find the first tiling with a tile. | 246 // Find the first tiling with a tile. |
247 while (tiling_index_ < tilings_->size()) { | 247 while (tiling_index_ < tilings_->size()) { |
248 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) { | 248 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) { |
249 ++tiling_index_; | 249 ++tiling_index_; |
250 continue; | 250 continue; |
251 } | 251 } |
252 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 252 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
253 (*tilings_)[tiling_index_]->tiling_data(), | 253 (*tilings_)[tiling_index_]->tiling_data(), |
254 (*tilings_)[tiling_index_]->current_eventually_rect(), | 254 (*tilings_)[tiling_index_]->current_eventually_rect(), |
255 (*tilings_)[tiling_index_]->current_skewport_rect(), | 255 (*tilings_)[tiling_index_]->current_skewport_rect(), |
256 (*tilings_)[tiling_index_]->current_soon_border_rect()); | 256 (*tilings_)[tiling_index_]->current_soon_border_rect(), |
| 257 TilingData::IsPyramidSequenceEnabled()); |
257 if (!iterator_) { | 258 if (!iterator_) { |
258 ++tiling_index_; | 259 ++tiling_index_; |
259 continue; | 260 continue; |
260 } | 261 } |
261 break; | 262 break; |
262 } | 263 } |
263 if (tiling_index_ >= tilings_->size()) | 264 if (tiling_index_ >= tilings_->size()) |
264 return; | 265 return; |
265 if (!GetFirstTileAndCheckIfValid(&iterator_)) | 266 if (!GetFirstTileAndCheckIfValid(&iterator_)) |
266 ++(*this); | 267 ++(*this); |
267 } | 268 } |
268 | 269 |
269 TilingSetEvictionQueue::EventuallyTilingIterator& | 270 TilingSetEvictionQueue::EventuallyTilingIterator& |
270 TilingSetEvictionQueue::EventuallyTilingIterator:: | 271 TilingSetEvictionQueue::EventuallyTilingIterator:: |
271 operator++() { | 272 operator++() { |
272 bool found_tile = AdvanceToNextTile(&iterator_); | 273 bool found_tile = AdvanceToNextTile(&iterator_); |
273 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { | 274 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { |
274 ++tiling_index_; | 275 ++tiling_index_; |
275 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) | 276 if (!(*tilings_)[tiling_index_]->has_eventually_rect_tiles()) |
276 continue; | 277 continue; |
277 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 278 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
278 (*tilings_)[tiling_index_]->tiling_data(), | 279 (*tilings_)[tiling_index_]->tiling_data(), |
279 (*tilings_)[tiling_index_]->current_eventually_rect(), | 280 (*tilings_)[tiling_index_]->current_eventually_rect(), |
280 (*tilings_)[tiling_index_]->current_skewport_rect(), | 281 (*tilings_)[tiling_index_]->current_skewport_rect(), |
281 (*tilings_)[tiling_index_]->current_soon_border_rect()); | 282 (*tilings_)[tiling_index_]->current_soon_border_rect(), |
| 283 TilingData::IsPyramidSequenceEnabled()); |
282 if (!iterator_) | 284 if (!iterator_) |
283 continue; | 285 continue; |
284 found_tile = GetFirstTileAndCheckIfValid(&iterator_); | 286 found_tile = GetFirstTileAndCheckIfValid(&iterator_); |
285 if (!found_tile) | 287 if (!found_tile) |
286 found_tile = AdvanceToNextTile(&iterator_); | 288 found_tile = AdvanceToNextTile(&iterator_); |
287 } | 289 } |
288 return *this; | 290 return *this; |
289 } | 291 } |
290 | 292 |
291 // SoonBorderTilingIterator | 293 // SoonBorderTilingIterator |
292 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator( | 294 TilingSetEvictionQueue::SoonBorderTilingIterator::SoonBorderTilingIterator( |
293 std::vector<PictureLayerTiling*>* tilings, | 295 std::vector<PictureLayerTiling*>* tilings, |
294 WhichTree tree) | 296 WhichTree tree) |
295 : EvictionRectIterator(tilings, | 297 : EvictionRectIterator(tilings, |
296 tree, | 298 tree, |
297 PictureLayerTiling::SOON_BORDER_RECT) { | 299 PictureLayerTiling::SOON_BORDER_RECT) { |
298 // Find the first tiling with a tile. | 300 // Find the first tiling with a tile. |
299 while (tiling_index_ < tilings_->size()) { | 301 while (tiling_index_ < tilings_->size()) { |
300 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) { | 302 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) { |
301 ++tiling_index_; | 303 ++tiling_index_; |
302 continue; | 304 continue; |
303 } | 305 } |
304 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 306 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
305 (*tilings_)[tiling_index_]->tiling_data(), | 307 (*tilings_)[tiling_index_]->tiling_data(), |
306 (*tilings_)[tiling_index_]->current_soon_border_rect(), | 308 (*tilings_)[tiling_index_]->current_soon_border_rect(), |
307 (*tilings_)[tiling_index_]->current_skewport_rect(), | 309 (*tilings_)[tiling_index_]->current_skewport_rect(), |
308 (*tilings_)[tiling_index_]->current_visible_rect()); | 310 (*tilings_)[tiling_index_]->current_visible_rect(), |
| 311 TilingData::IsPyramidSequenceEnabled()); |
309 if (!iterator_) { | 312 if (!iterator_) { |
310 ++tiling_index_; | 313 ++tiling_index_; |
311 continue; | 314 continue; |
312 } | 315 } |
313 break; | 316 break; |
314 } | 317 } |
315 if (tiling_index_ >= tilings_->size()) | 318 if (tiling_index_ >= tilings_->size()) |
316 return; | 319 return; |
317 if (!GetFirstTileAndCheckIfValid(&iterator_)) | 320 if (!GetFirstTileAndCheckIfValid(&iterator_)) |
318 ++(*this); | 321 ++(*this); |
319 } | 322 } |
320 | 323 |
321 TilingSetEvictionQueue::SoonBorderTilingIterator& | 324 TilingSetEvictionQueue::SoonBorderTilingIterator& |
322 TilingSetEvictionQueue::SoonBorderTilingIterator:: | 325 TilingSetEvictionQueue::SoonBorderTilingIterator:: |
323 operator++() { | 326 operator++() { |
324 bool found_tile = AdvanceToNextTile(&iterator_); | 327 bool found_tile = AdvanceToNextTile(&iterator_); |
325 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { | 328 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { |
326 ++tiling_index_; | 329 ++tiling_index_; |
327 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) | 330 if (!(*tilings_)[tiling_index_]->has_soon_border_rect_tiles()) |
328 continue; | 331 continue; |
329 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 332 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
330 (*tilings_)[tiling_index_]->tiling_data(), | 333 (*tilings_)[tiling_index_]->tiling_data(), |
331 (*tilings_)[tiling_index_]->current_soon_border_rect(), | 334 (*tilings_)[tiling_index_]->current_soon_border_rect(), |
332 (*tilings_)[tiling_index_]->current_skewport_rect(), | 335 (*tilings_)[tiling_index_]->current_skewport_rect(), |
333 (*tilings_)[tiling_index_]->current_visible_rect()); | 336 (*tilings_)[tiling_index_]->current_visible_rect(), |
| 337 TilingData::IsPyramidSequenceEnabled()); |
334 if (!iterator_) | 338 if (!iterator_) |
335 continue; | 339 continue; |
336 found_tile = GetFirstTileAndCheckIfValid(&iterator_); | 340 found_tile = GetFirstTileAndCheckIfValid(&iterator_); |
337 if (!found_tile) | 341 if (!found_tile) |
338 found_tile = AdvanceToNextTile(&iterator_); | 342 found_tile = AdvanceToNextTile(&iterator_); |
339 } | 343 } |
340 return *this; | 344 return *this; |
341 } | 345 } |
342 | 346 |
343 // SkewportTilingIterator | 347 // SkewportTilingIterator |
344 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator( | 348 TilingSetEvictionQueue::SkewportTilingIterator::SkewportTilingIterator( |
345 std::vector<PictureLayerTiling*>* tilings, | 349 std::vector<PictureLayerTiling*>* tilings, |
346 WhichTree tree) | 350 WhichTree tree) |
347 : EvictionRectIterator(tilings, tree, PictureLayerTiling::SKEWPORT_RECT) { | 351 : EvictionRectIterator(tilings, tree, PictureLayerTiling::SKEWPORT_RECT) { |
348 // Find the first tiling with a tile. | 352 // Find the first tiling with a tile. |
349 while (tiling_index_ < tilings_->size()) { | 353 while (tiling_index_ < tilings_->size()) { |
350 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) { | 354 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) { |
351 ++tiling_index_; | 355 ++tiling_index_; |
352 continue; | 356 continue; |
353 } | 357 } |
354 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 358 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
355 (*tilings_)[tiling_index_]->tiling_data(), | 359 (*tilings_)[tiling_index_]->tiling_data(), |
356 (*tilings_)[tiling_index_]->current_skewport_rect(), | 360 (*tilings_)[tiling_index_]->current_skewport_rect(), |
357 (*tilings_)[tiling_index_]->current_visible_rect(), | 361 (*tilings_)[tiling_index_]->current_visible_rect(), |
358 (*tilings_)[tiling_index_]->current_visible_rect()); | 362 (*tilings_)[tiling_index_]->current_visible_rect(), |
| 363 TilingData::IsPyramidSequenceEnabled()); |
359 if (!iterator_) { | 364 if (!iterator_) { |
360 ++tiling_index_; | 365 ++tiling_index_; |
361 continue; | 366 continue; |
362 } | 367 } |
363 break; | 368 break; |
364 } | 369 } |
365 if (tiling_index_ >= tilings_->size()) | 370 if (tiling_index_ >= tilings_->size()) |
366 return; | 371 return; |
367 if (!GetFirstTileAndCheckIfValid(&iterator_)) | 372 if (!GetFirstTileAndCheckIfValid(&iterator_)) |
368 ++(*this); | 373 ++(*this); |
369 } | 374 } |
370 | 375 |
371 TilingSetEvictionQueue::SkewportTilingIterator& | 376 TilingSetEvictionQueue::SkewportTilingIterator& |
372 TilingSetEvictionQueue::SkewportTilingIterator:: | 377 TilingSetEvictionQueue::SkewportTilingIterator:: |
373 operator++() { | 378 operator++() { |
374 bool found_tile = AdvanceToNextTile(&iterator_); | 379 bool found_tile = AdvanceToNextTile(&iterator_); |
375 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { | 380 while (!found_tile && (tiling_index_ + 1) < tilings_->size()) { |
376 ++tiling_index_; | 381 ++tiling_index_; |
377 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) | 382 if (!(*tilings_)[tiling_index_]->has_skewport_rect_tiles()) |
378 continue; | 383 continue; |
379 iterator_ = TilingData::ReverseSpiralDifferenceIterator( | 384 iterator_ = TilingData::ReverseSpiralDifferenceIterator( |
380 (*tilings_)[tiling_index_]->tiling_data(), | 385 (*tilings_)[tiling_index_]->tiling_data(), |
381 (*tilings_)[tiling_index_]->current_skewport_rect(), | 386 (*tilings_)[tiling_index_]->current_skewport_rect(), |
382 (*tilings_)[tiling_index_]->current_visible_rect(), | 387 (*tilings_)[tiling_index_]->current_visible_rect(), |
383 (*tilings_)[tiling_index_]->current_visible_rect()); | 388 (*tilings_)[tiling_index_]->current_visible_rect(), |
| 389 TilingData::IsPyramidSequenceEnabled()); |
384 if (!iterator_) | 390 if (!iterator_) |
385 continue; | 391 continue; |
386 found_tile = GetFirstTileAndCheckIfValid(&iterator_); | 392 found_tile = GetFirstTileAndCheckIfValid(&iterator_); |
387 if (!found_tile) | 393 if (!found_tile) |
388 found_tile = AdvanceToNextTile(&iterator_); | 394 found_tile = AdvanceToNextTile(&iterator_); |
389 } | 395 } |
390 return *this; | 396 return *this; |
391 } | 397 } |
392 | 398 |
393 // PendingVisibleIterator | 399 // PendingVisibleIterator |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 525 |
520 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags( | 526 bool TilingSetEvictionQueue::VisibleTilingIterator::TileMatchesRequiredFlags( |
521 const PrioritizedTile& tile) const { | 527 const PrioritizedTile& tile) const { |
522 bool activation_flag_matches = tile.tile()->required_for_activation() == | 528 bool activation_flag_matches = tile.tile()->required_for_activation() == |
523 return_required_for_activation_tiles_; | 529 return_required_for_activation_tiles_; |
524 bool occluded_flag_matches = tile.is_occluded() == return_occluded_tiles_; | 530 bool occluded_flag_matches = tile.is_occluded() == return_occluded_tiles_; |
525 return activation_flag_matches && occluded_flag_matches; | 531 return activation_flag_matches && occluded_flag_matches; |
526 } | 532 } |
527 | 533 |
528 } // namespace cc | 534 } // namespace cc |
OLD | NEW |