| 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 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1560 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1561 | 1561 |
| 1562 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1562 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
| 1563 break; | 1563 break; |
| 1564 ++current_stage_; | 1564 ++current_stage_; |
| 1565 } | 1565 } |
| 1566 } | 1566 } |
| 1567 | 1567 |
| 1568 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() | 1568 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() |
| 1569 : layer_(nullptr), | 1569 : layer_(nullptr), |
| 1570 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), | |
| 1571 current_category_(PictureLayerTiling::EVENTUALLY), | 1570 current_category_(PictureLayerTiling::EVENTUALLY), |
| 1572 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1571 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
| 1573 current_tiling_(0u) { | 1572 current_tiling_(0u) { |
| 1574 } | 1573 } |
| 1575 | 1574 |
| 1576 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1575 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
| 1577 PictureLayerImpl* layer, | 1576 PictureLayerImpl* layer) |
| 1578 TreePriority tree_priority) | |
| 1579 : layer_(layer), | 1577 : layer_(layer), |
| 1580 tree_priority_(tree_priority), | |
| 1581 current_category_(PictureLayerTiling::EVENTUALLY), | 1578 current_category_(PictureLayerTiling::EVENTUALLY), |
| 1582 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1579 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
| 1583 current_tiling_(CurrentTilingRange().start - 1u) { | 1580 current_tiling_(CurrentTilingRange().start - 1u) { |
| 1584 // TODO(vmpstr): Once tile priorities are determined by the iterators, ensure | 1581 // TODO(vmpstr): Once tile priorities are determined by the iterators, ensure |
| 1585 // that layers that don't have valid tile priorities have lowest priorities so | 1582 // that layers that don't have valid tile priorities have lowest priorities so |
| 1586 // they evict their tiles first (crbug.com/381704) | 1583 // they evict their tiles first (crbug.com/381704) |
| 1587 DCHECK(layer_->tilings_); | 1584 DCHECK(layer_->tilings_); |
| 1588 do { | 1585 do { |
| 1589 if (!AdvanceToNextTiling()) | 1586 if (!AdvanceToNextTiling()) |
| 1590 break; | 1587 break; |
| 1591 | 1588 |
| 1592 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1589 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
| 1593 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1590 layer_->tilings_->tiling_at(CurrentTilingIndex()), |
| 1594 tree_priority, | |
| 1595 current_category_); | 1591 current_category_); |
| 1596 } while (!current_iterator_); | 1592 } while (!current_iterator_); |
| 1597 } | 1593 } |
| 1598 | 1594 |
| 1599 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { | 1595 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { |
| 1600 } | 1596 } |
| 1601 | 1597 |
| 1602 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { | 1598 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { |
| 1603 DCHECK(*this); | 1599 DCHECK(*this); |
| 1604 return *current_iterator_; | 1600 return *current_iterator_; |
| 1605 } | 1601 } |
| 1606 | 1602 |
| 1607 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { | 1603 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { |
| 1608 DCHECK(*this); | 1604 DCHECK(*this); |
| 1609 return *current_iterator_; | 1605 return *current_iterator_; |
| 1610 } | 1606 } |
| 1611 | 1607 |
| 1612 PictureLayerImpl::LayerEvictionTileIterator& | 1608 PictureLayerImpl::LayerEvictionTileIterator& |
| 1613 PictureLayerImpl::LayerEvictionTileIterator:: | 1609 PictureLayerImpl::LayerEvictionTileIterator:: |
| 1614 operator++() { | 1610 operator++() { |
| 1615 DCHECK(*this); | 1611 DCHECK(*this); |
| 1616 ++current_iterator_; | 1612 ++current_iterator_; |
| 1617 while (!current_iterator_) { | 1613 while (!current_iterator_) { |
| 1618 if (!AdvanceToNextTiling()) | 1614 if (!AdvanceToNextTiling()) |
| 1619 break; | 1615 break; |
| 1620 | 1616 |
| 1621 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1617 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
| 1622 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1618 layer_->tilings_->tiling_at(CurrentTilingIndex()), |
| 1623 tree_priority_, | |
| 1624 current_category_); | 1619 current_category_); |
| 1625 } | 1620 } |
| 1626 return *this; | 1621 return *this; |
| 1627 } | 1622 } |
| 1628 | 1623 |
| 1629 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { | 1624 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { |
| 1630 return !!current_iterator_; | 1625 return !!current_iterator_; |
| 1631 } | 1626 } |
| 1632 | 1627 |
| 1633 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { | 1628 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { |
| 1634 switch (current_category_) { | 1629 switch (current_category_) { |
| 1635 case PictureLayerTiling::EVENTUALLY: | 1630 case PictureLayerTiling::EVENTUALLY: |
| 1636 current_category_ = | |
| 1637 PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION; | |
| 1638 return true; | |
| 1639 case PictureLayerTiling::EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION: | |
| 1640 current_category_ = PictureLayerTiling::SOON; | 1631 current_category_ = PictureLayerTiling::SOON; |
| 1641 return true; | 1632 return true; |
| 1642 case PictureLayerTiling::SOON: | 1633 case PictureLayerTiling::SOON: |
| 1643 current_category_ = PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION; | |
| 1644 return true; | |
| 1645 case PictureLayerTiling::SOON_AND_REQUIRED_FOR_ACTIVATION: | |
| 1646 current_category_ = PictureLayerTiling::NOW; | 1634 current_category_ = PictureLayerTiling::NOW; |
| 1647 return true; | 1635 return true; |
| 1648 case PictureLayerTiling::NOW: | 1636 case PictureLayerTiling::NOW: |
| 1649 current_category_ = PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION; | 1637 current_category_ = PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION; |
| 1650 return true; | 1638 return true; |
| 1651 case PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION: | 1639 case PictureLayerTiling::NOW_AND_REQUIRED_FOR_ACTIVATION: |
| 1652 return false; | 1640 return false; |
| 1653 } | 1641 } |
| 1654 NOTREACHED(); | 1642 NOTREACHED(); |
| 1655 return false; | 1643 return false; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1700 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1713 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1701 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1714 return tiling_range.end - 1 - current_tiling_range_offset; | 1702 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1715 } | 1703 } |
| 1716 } | 1704 } |
| 1717 NOTREACHED(); | 1705 NOTREACHED(); |
| 1718 return 0; | 1706 return 0; |
| 1719 } | 1707 } |
| 1720 | 1708 |
| 1721 } // namespace cc | 1709 } // namespace cc |
| OLD | NEW |