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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1578 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() | 1578 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() |
1579 : layer_(nullptr), | 1579 : layer_(nullptr), |
1580 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), | 1580 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), |
1581 current_category_(PictureLayerTiling::EVENTUALLY), | 1581 current_category_(PictureLayerTiling::EVENTUALLY), |
1582 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1582 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1583 current_tiling_(0u) { | 1583 current_tiling_(0u) { |
1584 } | 1584 } |
1585 | 1585 |
1586 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1586 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
1587 PictureLayerImpl* layer, | 1587 PictureLayerImpl* layer, |
1588 const PictureLayerImpl* twin_layer, | |
vmpstr
2014/10/31 15:35:49
layer itself has access to the twin, let's just ge
USE eero AT chromium.org
2014/11/04 17:47:57
Done.
| |
1588 TreePriority tree_priority) | 1589 TreePriority tree_priority) |
1589 : layer_(layer), | 1590 : layer_(layer), |
1590 tree_priority_(tree_priority), | 1591 tree_priority_(tree_priority), |
1592 use_tile_priority_rects_(layer->HasValidTilePriorities()), | |
1593 use_twin_tile_priority_rects_(twin_layer && | |
1594 twin_layer->HasValidTilePriorities()), | |
1591 current_category_(PictureLayerTiling::EVENTUALLY), | 1595 current_category_(PictureLayerTiling::EVENTUALLY), |
1592 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1596 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1593 current_tiling_(CurrentTilingRange().start - 1u) { | 1597 current_tiling_(CurrentTilingRange().start - 1u) { |
1594 // TODO(vmpstr): Once tile priorities are determined by the iterators, ensure | 1598 // TODO(vmpstr): Once tile priorities are determined by the iterators, ensure |
1595 // that layers that don't have valid tile priorities have lowest priorities so | 1599 // that layers that don't have valid tile priorities have lowest priorities so |
1596 // they evict their tiles first (crbug.com/381704) | 1600 // they evict their tiles first (crbug.com/381704) |
1597 DCHECK(layer_->tilings_); | 1601 DCHECK(layer_->tilings_); |
1598 do { | 1602 do { |
1599 if (!AdvanceToNextTiling()) | 1603 if (!AdvanceToNextTiling()) |
1600 break; | 1604 break; |
1601 | 1605 |
1602 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1606 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1603 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1607 layer_->tilings_->tiling_at(CurrentTilingIndex()), |
1604 tree_priority, | 1608 tree_priority, |
1605 current_category_); | 1609 current_category_, |
1610 use_tile_priority_rects_, | |
1611 use_twin_tile_priority_rects_); | |
1606 } while (!current_iterator_); | 1612 } while (!current_iterator_); |
1607 } | 1613 } |
1608 | 1614 |
1609 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { | 1615 PictureLayerImpl::LayerEvictionTileIterator::~LayerEvictionTileIterator() { |
1610 } | 1616 } |
1611 | 1617 |
1612 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { | 1618 Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() { |
1613 DCHECK(*this); | 1619 DCHECK(*this); |
1614 return *current_iterator_; | 1620 return *current_iterator_; |
1615 } | 1621 } |
1616 | 1622 |
1617 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { | 1623 const Tile* PictureLayerImpl::LayerEvictionTileIterator::operator*() const { |
1618 DCHECK(*this); | 1624 DCHECK(*this); |
1619 return *current_iterator_; | 1625 return *current_iterator_; |
1620 } | 1626 } |
1621 | 1627 |
1622 PictureLayerImpl::LayerEvictionTileIterator& | 1628 PictureLayerImpl::LayerEvictionTileIterator& |
1623 PictureLayerImpl::LayerEvictionTileIterator:: | 1629 PictureLayerImpl::LayerEvictionTileIterator:: |
1624 operator++() { | 1630 operator++() { |
1625 DCHECK(*this); | 1631 DCHECK(*this); |
1626 ++current_iterator_; | 1632 ++current_iterator_; |
1627 while (!current_iterator_) { | 1633 while (!current_iterator_) { |
1628 if (!AdvanceToNextTiling()) | 1634 if (!AdvanceToNextTiling()) |
1629 break; | 1635 break; |
1630 | 1636 |
1631 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1637 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
1632 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1638 layer_->tilings_->tiling_at(CurrentTilingIndex()), |
1633 tree_priority_, | 1639 tree_priority_, |
1634 current_category_); | 1640 current_category_, |
1641 use_tile_priority_rects_, | |
1642 use_twin_tile_priority_rects_); | |
1635 } | 1643 } |
1636 return *this; | 1644 return *this; |
1637 } | 1645 } |
1638 | 1646 |
1639 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { | 1647 PictureLayerImpl::LayerEvictionTileIterator::operator bool() const { |
1640 return !!current_iterator_; | 1648 return !!current_iterator_; |
1641 } | 1649 } |
1642 | 1650 |
1643 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { | 1651 bool PictureLayerImpl::LayerEvictionTileIterator::AdvanceToNextCategory() { |
1644 switch (current_category_) { | 1652 switch (current_category_) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1722 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1730 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1723 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1731 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1724 return tiling_range.end - 1 - current_tiling_range_offset; | 1732 return tiling_range.end - 1 - current_tiling_range_offset; |
1725 } | 1733 } |
1726 } | 1734 } |
1727 NOTREACHED(); | 1735 NOTREACHED(); |
1728 return 0; | 1736 return 0; |
1729 } | 1737 } |
1730 | 1738 |
1731 } // namespace cc | 1739 } // namespace cc |
OLD | NEW |