| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 contents_scale, | 886 contents_scale, |
| 887 rect); | 887 rect); |
| 888 iter; | 888 iter; |
| 889 ++iter) { | 889 ++iter) { |
| 890 Tile* tile = *iter; | 890 Tile* tile = *iter; |
| 891 // A null tile (i.e. missing recording) can just be skipped. | 891 // A null tile (i.e. missing recording) can just be skipped. |
| 892 if (!tile) | 892 if (!tile) |
| 893 continue; | 893 continue; |
| 894 | 894 |
| 895 // If the tile is occluded, don't mark it as required for activation. | 895 // If the tile is occluded, don't mark it as required for activation. |
| 896 if (tile->is_occluded()) | 896 WhichTree tree = |
| 897 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 898 if (tile->priority(tree).is_occluded) |
| 897 continue; | 899 continue; |
| 898 | 900 |
| 899 // If the missing region doesn't cover it, this tile is fully | 901 // If the missing region doesn't cover it, this tile is fully |
| 900 // covered by acceptable tiles at other scales. | 902 // covered by acceptable tiles at other scales. |
| 901 if (!missing_region.Intersects(iter.geometry_rect())) | 903 if (!missing_region.Intersects(iter.geometry_rect())) |
| 902 continue; | 904 continue; |
| 903 | 905 |
| 904 // If the twin tile doesn't exist (i.e. missing recording or so far away | 906 // If the twin tile doesn't exist (i.e. missing recording or so far away |
| 905 // that it is outside the visible tile rect) or this tile is shared between | 907 // that it is outside the visible tile rect) or this tile is shared between |
| 906 // with the twin, then this tile isn't required to prevent flashing. | 908 // with the twin, then this tile isn't required to prevent flashing. |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 | 1466 |
| 1465 stages_[2].iterator_type = HIGH_RES; | 1467 stages_[2].iterator_type = HIGH_RES; |
| 1466 stages_[2].tile_type = TilePriority::SOON; | 1468 stages_[2].tile_type = TilePriority::SOON; |
| 1467 | 1469 |
| 1468 stages_[3].iterator_type = HIGH_RES; | 1470 stages_[3].iterator_type = HIGH_RES; |
| 1469 stages_[3].tile_type = TilePriority::EVENTUALLY; | 1471 stages_[3].tile_type = TilePriority::EVENTUALLY; |
| 1470 | 1472 |
| 1471 IteratorType index = stages_[current_stage_].iterator_type; | 1473 IteratorType index = stages_[current_stage_].iterator_type; |
| 1472 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1474 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1473 if (!iterators_[index] || iterators_[index].get_type() != tile_type || | 1475 if (!iterators_[index] || iterators_[index].get_type() != tile_type || |
| 1474 (*iterators_[index])->is_occluded()) | 1476 (*iterators_[index])->priority(tree).is_occluded) |
| 1475 ++(*this); | 1477 ++(*this); |
| 1476 } | 1478 } |
| 1477 | 1479 |
| 1478 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} | 1480 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} |
| 1479 | 1481 |
| 1480 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { | 1482 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { |
| 1481 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_); | 1483 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_); |
| 1482 } | 1484 } |
| 1483 | 1485 |
| 1484 PictureLayerImpl::LayerRasterTileIterator& | 1486 PictureLayerImpl::LayerRasterTileIterator& |
| 1485 PictureLayerImpl::LayerRasterTileIterator:: | 1487 PictureLayerImpl::LayerRasterTileIterator:: |
| 1486 operator++() { | 1488 operator++() { |
| 1489 WhichTree tree = |
| 1490 layer_->layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 1491 |
| 1487 IteratorType index = stages_[current_stage_].iterator_type; | 1492 IteratorType index = stages_[current_stage_].iterator_type; |
| 1488 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1493 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1489 | 1494 |
| 1490 // First advance the iterator. | 1495 // First advance the iterator. |
| 1491 if (iterators_[index]) | 1496 if (iterators_[index]) |
| 1492 ++iterators_[index]; | 1497 ++iterators_[index]; |
| 1493 | 1498 |
| 1494 while (iterators_[index] && iterators_[index].get_type() == tile_type && | 1499 while (iterators_[index] && iterators_[index].get_type() == tile_type && |
| 1495 (*iterators_[index])->is_occluded()) | 1500 (*iterators_[index])->priority(tree).is_occluded) |
| 1496 ++iterators_[index]; | 1501 ++iterators_[index]; |
| 1497 | 1502 |
| 1498 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1503 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
| 1499 return *this; | 1504 return *this; |
| 1500 | 1505 |
| 1501 // Next, advance the stage. | 1506 // Next, advance the stage. |
| 1502 int stage_count = arraysize(stages_); | 1507 int stage_count = arraysize(stages_); |
| 1503 ++current_stage_; | 1508 ++current_stage_; |
| 1504 while (current_stage_ < stage_count) { | 1509 while (current_stage_ < stage_count) { |
| 1505 index = stages_[current_stage_].iterator_type; | 1510 index = stages_[current_stage_].iterator_type; |
| 1506 tile_type = stages_[current_stage_].tile_type; | 1511 tile_type = stages_[current_stage_].tile_type; |
| 1507 | 1512 |
| 1508 if (iterators_[index] && iterators_[index].get_type() == tile_type && | 1513 if (iterators_[index] && iterators_[index].get_type() == tile_type && |
| 1509 !(*iterators_[index])->is_occluded()) | 1514 !(*iterators_[index])->priority(tree).is_occluded) |
| 1510 break; | 1515 break; |
| 1511 ++current_stage_; | 1516 ++current_stage_; |
| 1512 } | 1517 } |
| 1513 return *this; | 1518 return *this; |
| 1514 } | 1519 } |
| 1515 | 1520 |
| 1516 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { | 1521 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { |
| 1517 DCHECK(*this); | 1522 DCHECK(*this); |
| 1518 | 1523 |
| 1519 IteratorType index = stages_[current_stage_].iterator_type; | 1524 IteratorType index = stages_[current_stage_].iterator_type; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 return iterator_index_ < iterators_.size(); | 1649 return iterator_index_ < iterators_.size(); |
| 1645 } | 1650 } |
| 1646 | 1651 |
| 1647 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1652 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1648 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1653 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1649 return it->get_type() == iteration_stage_ && | 1654 return it->get_type() == iteration_stage_ && |
| 1650 (**it)->required_for_activation() == required_for_activation_; | 1655 (**it)->required_for_activation() == required_for_activation_; |
| 1651 } | 1656 } |
| 1652 | 1657 |
| 1653 } // namespace cc | 1658 } // namespace cc |
| OLD | NEW |