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