| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 657 } |
| 658 | 658 |
| 659 PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling( | 659 PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling( |
| 660 const PictureLayerTiling* tiling) { | 660 const PictureLayerTiling* tiling) { |
| 661 PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); | 661 PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); |
| 662 if (!recycled_twin || !recycled_twin->tilings_) | 662 if (!recycled_twin || !recycled_twin->tilings_) |
| 663 return nullptr; | 663 return nullptr; |
| 664 return recycled_twin->tilings_->TilingAtScale(tiling->contents_scale()); | 664 return recycled_twin->tilings_->TilingAtScale(tiling->contents_scale()); |
| 665 } | 665 } |
| 666 | 666 |
| 667 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { |
| 668 if (!HasValidTilePriorities()) |
| 669 return TilePriority::EVENTUALLY; |
| 670 return TilePriority::NOW; |
| 671 } |
| 672 |
| 667 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { | 673 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { |
| 668 return layer_tree_impl()->settings().max_tiles_for_interest_area; | 674 return layer_tree_impl()->settings().max_tiles_for_interest_area; |
| 669 } | 675 } |
| 670 | 676 |
| 671 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const { | 677 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const { |
| 672 float skewport_target_time_in_frames = | 678 float skewport_target_time_in_frames = |
| 673 layer_tree_impl()->use_gpu_rasterization() | 679 layer_tree_impl()->use_gpu_rasterization() |
| 674 ? kGpuSkewportTargetTimeInFrames | 680 ? kGpuSkewportTargetTimeInFrames |
| 675 : kCpuSkewportTargetTimeInFrames; | 681 : kCpuSkewportTargetTimeInFrames; |
| 676 return skewport_target_time_in_frames * | 682 return skewport_target_time_in_frames * |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 current_tiling_(0u) { | 1572 current_tiling_(0u) { |
| 1567 } | 1573 } |
| 1568 | 1574 |
| 1569 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1575 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
| 1570 PictureLayerImpl* layer, | 1576 PictureLayerImpl* layer, |
| 1571 TreePriority tree_priority) | 1577 TreePriority tree_priority) |
| 1572 : layer_(layer), | 1578 : layer_(layer), |
| 1573 tree_priority_(tree_priority), | 1579 tree_priority_(tree_priority), |
| 1574 current_category_(PictureLayerTiling::EVENTUALLY), | 1580 current_category_(PictureLayerTiling::EVENTUALLY), |
| 1575 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1581 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
| 1576 current_tiling_(CurrentTilingRange().start - 1u) { | 1582 current_tiling_(0u) { |
| 1577 // TODO(vmpstr): Once tile priorities are determined by the iterators, ensure | 1583 // Early out if the layer has no tilings. |
| 1578 // that layers that don't have valid tile priorities have lowest priorities so | 1584 if (!layer_->tilings_ || !layer_->tilings_->num_tilings()) |
| 1579 // they evict their tiles first (crbug.com/381704) | 1585 return; |
| 1580 DCHECK(layer_->tilings_); | 1586 |
| 1587 current_tiling_ = CurrentTilingRange().start - 1u; |
| 1581 do { | 1588 do { |
| 1582 if (!AdvanceToNextTiling()) | 1589 if (!AdvanceToNextTiling()) |
| 1583 break; | 1590 break; |
| 1584 | 1591 |
| 1585 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( | 1592 current_iterator_ = PictureLayerTiling::TilingEvictionTileIterator( |
| 1586 layer_->tilings_->tiling_at(CurrentTilingIndex()), | 1593 layer_->tilings_->tiling_at(CurrentTilingIndex()), |
| 1587 tree_priority, | 1594 tree_priority, |
| 1588 current_category_); | 1595 current_category_); |
| 1589 } while (!current_iterator_); | 1596 } while (!current_iterator_); |
| 1590 } | 1597 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1712 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1706 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1713 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1707 return tiling_range.end - 1 - current_tiling_range_offset; | 1714 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1708 } | 1715 } |
| 1709 } | 1716 } |
| 1710 NOTREACHED(); | 1717 NOTREACHED(); |
| 1711 return 0; | 1718 return 0; |
| 1712 } | 1719 } |
| 1713 | 1720 |
| 1714 } // namespace cc | 1721 } // namespace cc |
| OLD | NEW |