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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 | 1560 |
1561 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1561 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
1562 break; | 1562 break; |
1563 ++current_stage_; | 1563 ++current_stage_; |
1564 } | 1564 } |
1565 } | 1565 } |
1566 | 1566 |
1567 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() | 1567 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() |
1568 : layer_(nullptr), | 1568 : layer_(nullptr), |
1569 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), | 1569 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), |
| 1570 layer_has_twin_layer_(false), |
1570 current_category_(PictureLayerTiling::EVENTUALLY), | 1571 current_category_(PictureLayerTiling::EVENTUALLY), |
1571 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1572 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1572 current_tiling_(0u) { | 1573 current_tiling_(0u) { |
1573 } | 1574 } |
1574 | 1575 |
1575 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1576 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
1576 PictureLayerImpl* layer, | 1577 PictureLayerImpl* layer, |
1577 TreePriority tree_priority) | 1578 TreePriority tree_priority) |
1578 : layer_(layer), | 1579 : layer_(layer), |
1579 tree_priority_(tree_priority), | 1580 tree_priority_(tree_priority), |
| 1581 layer_has_twin_layer_(!!layer->GetPendingOrActiveTwinLayer()), |
1580 current_category_(PictureLayerTiling::EVENTUALLY), | 1582 current_category_(PictureLayerTiling::EVENTUALLY), |
1581 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1583 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1582 current_tiling_(0u) { | 1584 current_tiling_(0u) { |
1583 // Early out if the layer has no tilings. | 1585 // Early out if the layer has no tilings. |
1584 if (!layer_->tilings_ || !layer_->tilings_->num_tilings()) | 1586 if (!layer_->tilings_ || !layer_->tilings_->num_tilings()) |
1585 return; | 1587 return; |
1586 | 1588 |
1587 current_tiling_ = CurrentTilingRange().start - 1u; | 1589 current_tiling_ = CurrentTilingRange().start - 1u; |
1588 do { | 1590 do { |
1589 if (!AdvanceToNextTiling()) | 1591 if (!AdvanceToNextTiling()) |
1590 break; | 1592 break; |
1591 | 1593 |
1592 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1594 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1593 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1595 layer_->tilings_->tiling_at(CurrentTilingIndex()), tree_priority, |
1594 tree_priority, | 1596 current_category_, layer_has_twin_layer_); |
1595 current_category_); | |
1596 } while (!current_iterator_); | 1597 } while (!current_iterator_); |
1597 } | 1598 } |
1598 | 1599 |
1599 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { | 1600 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { |
1600 } | 1601 } |
1601 | 1602 |
1602 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { | 1603 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { |
1603 DCHECK(*this); | 1604 DCHECK(*this); |
1604 return *current_iterator_; | 1605 return *current_iterator_; |
1605 } | 1606 } |
1606 | 1607 |
1607 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { | 1608 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { |
1608 DCHECK(*this); | 1609 DCHECK(*this); |
1609 return *current_iterator_; | 1610 return *current_iterator_; |
1610 } | 1611 } |
1611 | 1612 |
1612 PictureLayerImpl::LayerEvictionTileIterator& | 1613 PictureLayerImpl::LayerEvictionTileIterator& |
1613 PictureLayerImpl::LayerEvictionTileIterator:: | 1614 PictureLayerImpl::LayerEvictionTileIterator:: |
1614 operator++() { | 1615 operator++() { |
1615 DCHECK(*this); | 1616 DCHECK(*this); |
1616 ++current_iterator_; | 1617 ++current_iterator_; |
1617 while (!current_iterator_) { | 1618 while (!current_iterator_) { |
1618 if (!AdvanceToNextTiling()) | 1619 if (!AdvanceToNextTiling()) |
1619 break; | 1620 break; |
1620 | 1621 |
1621 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1622 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1622 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1623 layer_->tilings_->tiling_at(CurrentTilingIndex()), tree_priority_, |
1623 tree_priority_, | 1624 current_category_, layer_has_twin_layer_); |
1624 current_category_); | |
1625 } | 1625 } |
1626 return *this; | 1626 return *this; |
1627 } | 1627 } |
1628 | 1628 |
1629 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { | 1629 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { |
1630 return !!current_iterator_; | 1630 return !!current_iterator_; |
1631 } | 1631 } |
1632 | 1632 |
1633 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { | 1633 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { |
1634 switch (current_category_) { | 1634 switch (current_category_) { |
1635 case PictureLayerTiling::EVENTUALLY: | 1635 case PictureLayerTiling::EVENTUALLY: |
| 1636 if (!layer_->HasValidTilePriorities() && |
| 1637 layer_->GetTree() == PENDING_TREE) |
| 1638 return false; |
1636 current_category_ = | 1639 current_category_ = |
1637 PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION; | 1640 PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION; |
1638 return true; | 1641 return true; |
1639 case PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION: | 1642 case PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION: |
| 1643 if (!layer_->HasValidTilePriorities()) |
| 1644 return false; |
1640 current_category_ = PictureLayerTiling::SOON; | 1645 current_category_ = PictureLayerTiling::SOON; |
1641 return true; | 1646 return true; |
1642 case PictureLayerTiling::SOON: | 1647 case PictureLayerTiling::SOON: |
1643 current_category_ = PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION; | 1648 current_category_ = PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION; |
1644 return true; | 1649 return true; |
1645 case PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION: | 1650 case PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION: |
1646 current_category_ = PictureLayerTiling::NOW; | 1651 current_category_ = PictureLayerTiling::NOW; |
1647 return true; | 1652 return true; |
1648 case PictureLayerTiling::NOW: | 1653 case PictureLayerTiling::NOW: |
1649 current_category_ = PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION; | 1654 current_category_ = PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1717 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1713 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1718 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1714 return tiling_range.end - 1 - current_tiling_range_offset; | 1719 return tiling_range.end - 1 - current_tiling_range_offset; |
1715 } | 1720 } |
1716 } | 1721 } |
1717 NOTREACHED(); | 1722 NOTREACHED(); |
1718 return 0; | 1723 return 0; |
1719 } | 1724 } |
1720 | 1725 |
1721 } // namespace cc | 1726 } // namespace cc |
OLD | NEW |