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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // the current tile. | 83 // the current tile. |
84 | 84 |
85 bool required_for_activation = | 85 bool required_for_activation = |
86 processing_tiling_with_required_for_activation_tiles_; | 86 processing_tiling_with_required_for_activation_tiles_; |
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->HasResources()) | 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_->UpdateTileAndTwinPriority(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; |
(...skipping 12 matching lines...) Expand all Loading... |
116 } | 116 } |
117 break; | 117 break; |
118 } | 118 } |
119 | 119 |
120 TilePriority::PriorityBin max_tile_priority_bin = | 120 TilePriority::PriorityBin max_tile_priority_bin = |
121 current_tiling_->client_->GetMaxTilePriorityBin(); | 121 current_tiling_->client_->GetMaxTilePriorityBin(); |
122 while (visible_iterator_) { | 122 while (visible_iterator_) { |
123 std::pair<int, int> next_index = visible_iterator_.index(); | 123 std::pair<int, int> next_index = visible_iterator_.index(); |
124 Tile* tile = current_tiling_->TileAt(next_index.first, next_index.second); | 124 Tile* tile = current_tiling_->TileAt(next_index.first, next_index.second); |
125 ++visible_iterator_; | 125 ++visible_iterator_; |
126 if (!tile || !tile->HasResources()) | 126 if (!tile || !tile->HasResource()) |
127 continue; | 127 continue; |
128 if (skip_all_shared_tiles_ && tile->is_shared()) | 128 if (skip_all_shared_tiles_ && tile->is_shared()) |
129 continue; | 129 continue; |
130 // If the max tile priority is not NOW, updated priorities for tiles | 130 // If the max tile priority is not NOW, updated priorities for tiles |
131 // returned by the visible iterator will not have NOW (but EVENTUALLY) | 131 // returned by the visible iterator will not have NOW (but EVENTUALLY) |
132 // priority bin and cannot therefore be required for activation tiles nor | 132 // priority bin and cannot therefore be required for activation tiles nor |
133 // occluded NOW tiles in the current tiling. | 133 // occluded NOW tiles in the current tiling. |
134 if (max_tile_priority_bin <= TilePriority::NOW) { | 134 if (max_tile_priority_bin <= TilePriority::NOW) { |
135 // If the current tiling is a pending tree tiling, required for | 135 // If the current tiling is a pending tree tiling, required for |
136 // activation tiles can be detected without updating tile priorities. | 136 // activation tiles can be detected without updating tile priorities. |
(...skipping 18 matching lines...) Expand all Loading... |
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->HasResources()) | 165 if (!tile->HasResource()) |
166 continue; | 166 continue; |
167 current_tiling_->UpdateTileAndTwinPriority(tile); | 167 current_tiling_->UpdateTileAndTwinPriority(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 |
(...skipping 223 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 |