| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "cc/resources/tiling_set_eviction_queue.h" | 7 #include "cc/resources/tiling_set_eviction_queue.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 for (;;) { | 88 for (;;) { |
| 89 while (spiral_iterator_) { | 89 while (spiral_iterator_) { |
| 90 std::pair<int, int> next_index = spiral_iterator_.index(); | 90 std::pair<int, int> next_index = spiral_iterator_.index(); |
| 91 Tile* tile = current_tiling_->TileAt(next_index.first, next_index.second); | 91 Tile* tile = current_tiling_->TileAt(next_index.first, next_index.second); |
| 92 ++spiral_iterator_; | 92 ++spiral_iterator_; |
| 93 if (!tile || !tile->HasResource()) | 93 if (!tile || !tile->HasResource()) |
| 94 continue; | 94 continue; |
| 95 if (skip_all_shared_tiles_ && tile->is_shared()) | 95 if (skip_all_shared_tiles_ && tile->is_shared()) |
| 96 continue; | 96 continue; |
| 97 current_tiling_->UpdateTileAndTwinPriority(tile); | 97 current_tiling_->UpdateTilePriority(tile); |
| 98 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) | 98 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) |
| 99 continue; | 99 continue; |
| 100 if (tile->required_for_activation() != required_for_activation) | 100 if (tile->required_for_activation() != required_for_activation) |
| 101 continue; | 101 continue; |
| 102 current_eviction_tile_ = tile; | 102 current_eviction_tile_ = tile; |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 if (processing_soon_border_rect_) { | 105 if (processing_soon_border_rect_) { |
| 106 // Advance from soon border rect to skewport rect. | 106 // Advance from soon border rect to skewport rect. |
| 107 processing_soon_border_rect_ = false; | 107 processing_soon_border_rect_ = false; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 required_for_activation) { | 139 required_for_activation) { |
| 140 continue; | 140 continue; |
| 141 } | 141 } |
| 142 // Unoccluded NOW tiles should be evicted (and thus returned) only after | 142 // Unoccluded NOW tiles should be evicted (and thus returned) only after |
| 143 // all occluded NOW tiles. | 143 // all occluded NOW tiles. |
| 144 if (!current_tiling_->IsTileOccluded(tile)) { | 144 if (!current_tiling_->IsTileOccluded(tile)) { |
| 145 unoccluded_now_tiles_.push_back(tile); | 145 unoccluded_now_tiles_.push_back(tile); |
| 146 continue; | 146 continue; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 current_tiling_->UpdateTileAndTwinPriority(tile); | 149 current_tiling_->UpdateTilePriority(tile); |
| 150 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) | 150 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) |
| 151 continue; | 151 continue; |
| 152 if (tile->required_for_activation() != required_for_activation) | 152 if (tile->required_for_activation() != required_for_activation) |
| 153 continue; | 153 continue; |
| 154 current_eviction_tile_ = tile; | 154 current_eviction_tile_ = tile; |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 while (!unoccluded_now_tiles_.empty()) { | 158 while (!unoccluded_now_tiles_.empty()) { |
| 159 // All (unoccluded) NOW tiles have the same priority bin (NOW) and the same | 159 // All (unoccluded) NOW tiles have the same priority bin (NOW) and the same |
| 160 // distance to visible (0.0), so it does not matter that tiles are popped | 160 // distance to visible (0.0), so it does not matter that tiles are popped |
| 161 // in reversed (FILO) order. | 161 // in reversed (FILO) order. |
| 162 Tile* tile = unoccluded_now_tiles_.back(); | 162 Tile* tile = unoccluded_now_tiles_.back(); |
| 163 unoccluded_now_tiles_.pop_back(); | 163 unoccluded_now_tiles_.pop_back(); |
| 164 DCHECK(tile); | 164 DCHECK(tile); |
| 165 if (!tile->HasResource()) | 165 if (!tile->HasResource()) |
| 166 continue; | 166 continue; |
| 167 current_tiling_->UpdateTileAndTwinPriority(tile); | 167 current_tiling_->UpdateTilePriority(tile); |
| 168 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) | 168 if (skip_shared_out_of_order_tiles_ && IsSharedOutOfOrderTile(tile)) |
| 169 continue; | 169 continue; |
| 170 if (tile->required_for_activation() != required_for_activation) | 170 if (tile->required_for_activation() != required_for_activation) |
| 171 continue; | 171 continue; |
| 172 current_eviction_tile_ = tile; | 172 current_eviction_tile_ = tile; |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 current_eviction_tile_ = nullptr; | 176 current_eviction_tile_ = nullptr; |
| 177 return false; | 177 return false; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 tiling_set_->client()->GetPendingOrActiveTwinTiling(tiling); | 399 tiling_set_->client()->GetPendingOrActiveTwinTiling(tiling); |
| 400 if (pending_tiling && pending_tiling->resolution() == HIGH_RESOLUTION) | 400 if (pending_tiling && pending_tiling->resolution() == HIGH_RESOLUTION) |
| 401 return i; | 401 return i; |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 return num_tilings; | 405 return num_tilings; |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace cc | 408 } // namespace cc |
| OLD | NEW |