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 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 | 1556 |
1557 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1557 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
1558 break; | 1558 break; |
1559 ++current_stage_; | 1559 ++current_stage_; |
1560 } | 1560 } |
1561 } | 1561 } |
1562 | 1562 |
1563 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() | 1563 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() |
1564 : layer_(nullptr), | 1564 : layer_(nullptr), |
1565 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), | 1565 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), |
| 1566 layer_has_twin_layer_(false), |
1566 current_category_(PictureLayerTiling::EVENTUALLY), | 1567 current_category_(PictureLayerTiling::EVENTUALLY), |
1567 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1568 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1568 current_tiling_(0u) { | 1569 current_tiling_(0u) { |
1569 } | 1570 } |
1570 | 1571 |
1571 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1572 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
1572 PictureLayerImpl* layer, | 1573 PictureLayerImpl* layer, |
1573 TreePriority tree_priority) | 1574 TreePriority tree_priority) |
1574 : layer_(layer), | 1575 : layer_(layer), |
1575 tree_priority_(tree_priority), | 1576 tree_priority_(tree_priority), |
| 1577 layer_has_twin_layer_(!!layer->GetPendingOrActiveTwinLayer()), |
1576 current_category_(PictureLayerTiling::EVENTUALLY), | 1578 current_category_(PictureLayerTiling::EVENTUALLY), |
1577 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1579 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1578 current_tiling_(0u) { | 1580 current_tiling_(0u) { |
1579 // Early out if the layer has no tilings. | 1581 // Early out if the layer has no tilings. |
1580 if (!layer_->tilings_ || !layer_->tilings_->num_tilings()) | 1582 if (!layer_->tilings_ || !layer_->tilings_->num_tilings()) |
1581 return; | 1583 return; |
1582 | 1584 |
1583 current_tiling_ = CurrentTilingRange().start - 1u; | 1585 current_tiling_ = CurrentTilingRange().start - 1u; |
1584 do { | 1586 do { |
1585 if (!AdvanceToNextTiling()) | 1587 if (!AdvanceToNextTiling()) |
1586 break; | 1588 break; |
1587 | 1589 |
1588 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1590 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1589 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1591 layer_->tilings_->tiling_at(CurrentTilingIndex()), tree_priority, |
1590 tree_priority, | 1592 current_category_, layer_has_twin_layer_); |
1591 current_category_); | |
1592 } while (!current_iterator_); | 1593 } while (!current_iterator_); |
1593 } | 1594 } |
1594 | 1595 |
1595 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { | 1596 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { |
1596 } | 1597 } |
1597 | 1598 |
1598 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { | 1599 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { |
1599 DCHECK(*this); | 1600 DCHECK(*this); |
1600 return *current_iterator_; | 1601 return *current_iterator_; |
1601 } | 1602 } |
1602 | 1603 |
1603 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { | 1604 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { |
1604 DCHECK(*this); | 1605 DCHECK(*this); |
1605 return *current_iterator_; | 1606 return *current_iterator_; |
1606 } | 1607 } |
1607 | 1608 |
1608 PictureLayerImpl::LayerEvictionTileIterator& | 1609 PictureLayerImpl::LayerEvictionTileIterator& |
1609 PictureLayerImpl::LayerEvictionTileIterator:: | 1610 PictureLayerImpl::LayerEvictionTileIterator:: |
1610 operator++() { | 1611 operator++() { |
1611 DCHECK(*this); | 1612 DCHECK(*this); |
1612 ++current_iterator_; | 1613 ++current_iterator_; |
1613 while (!current_iterator_) { | 1614 while (!current_iterator_) { |
1614 if (!AdvanceToNextTiling()) | 1615 if (!AdvanceToNextTiling()) |
1615 break; | 1616 break; |
1616 | 1617 |
1617 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1618 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1618 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1619 layer_->tilings_->tiling_at(CurrentTilingIndex()), tree_priority_, |
1619 tree_priority_, | 1620 current_category_, layer_has_twin_layer_); |
1620 current_category_); | |
1621 } | 1621 } |
1622 return *this; | 1622 return *this; |
1623 } | 1623 } |
1624 | 1624 |
1625 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { | 1625 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { |
1626 return !!current_iterator_; | 1626 return !!current_iterator_; |
1627 } | 1627 } |
1628 | 1628 |
1629 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { | 1629 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { |
1630 switch (current_category_) { | 1630 switch (current_category_) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1708 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1709 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1709 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1710 return tiling_range.end - 1 - current_tiling_range_offset; | 1710 return tiling_range.end - 1 - current_tiling_range_offset; |
1711 } | 1711 } |
1712 } | 1712 } |
1713 NOTREACHED(); | 1713 NOTREACHED(); |
1714 return 0; | 1714 return 0; |
1715 } | 1715 } |
1716 | 1716 |
1717 } // namespace cc | 1717 } // namespace cc |
OLD | NEW |