OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/resources/raster_tile_priority_queue_all.h" | 5 #include "cc/resources/raster_tile_priority_queue_all.h" |
6 | 6 |
7 #include "cc/resources/tiling_set_raster_queue_all.h" | 7 #include "cc/resources/tiling_set_raster_queue_all.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 TreePriority tree_priority_; | 82 TreePriority tree_priority_; |
83 }; | 83 }; |
84 | 84 |
85 WhichTree HigherPriorityTree(TreePriority tree_priority, | 85 WhichTree HigherPriorityTree(TreePriority tree_priority, |
86 const TilingSetRasterQueueAll* active_queue, | 86 const TilingSetRasterQueueAll* active_queue, |
87 const TilingSetRasterQueueAll* pending_queue, | 87 const TilingSetRasterQueueAll* pending_queue, |
88 const Tile* shared_tile) { | 88 const Tile* shared_tile) { |
| 89 // In cases when we're given an active tile with a non ideal active resolution |
| 90 // (or pending tile with non ideal pending resolution), we should return the |
| 91 // other tree. The reason for this is that tiling set iterators will not |
| 92 // return non ideal tiles and the only way we get here is if we're skipping |
| 93 // twin tiles, but since it's non-ideal on the twin, we shouldn't skip it. |
| 94 // TODO(vmpstr): Remove when tiles aren't shared. |
| 95 const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top(); |
| 96 const Tile* pending_tile = shared_tile ? shared_tile : pending_queue->Top(); |
| 97 if (active_tile->priority(ACTIVE_TREE).resolution == NON_IDEAL_RESOLUTION) |
| 98 return PENDING_TREE; |
| 99 if (pending_tile->priority(PENDING_TREE).resolution == NON_IDEAL_RESOLUTION) |
| 100 return ACTIVE_TREE; |
| 101 |
89 switch (tree_priority) { | 102 switch (tree_priority) { |
90 case SMOOTHNESS_TAKES_PRIORITY: { | 103 case SMOOTHNESS_TAKES_PRIORITY: { |
91 const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top(); | |
92 const Tile* pending_tile = | |
93 shared_tile ? shared_tile : pending_queue->Top(); | |
94 | |
95 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); | 104 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); |
96 const TilePriority& pending_priority = | 105 const TilePriority& pending_priority = |
97 pending_tile->priority(PENDING_TREE); | 106 pending_tile->priority(PENDING_TREE); |
98 | 107 |
99 // If we're down to eventually bin tiles on the active tree, process the | 108 // If we're down to eventually bin tiles on the active tree, process the |
100 // pending tree to allow tiles required for activation to be initialized | 109 // pending tree to allow tiles required for activation to be initialized |
101 // when memory policy only allows prepaint. | 110 // when memory policy only allows prepaint. |
102 if (active_priority.priority_bin == TilePriority::EVENTUALLY && | 111 if (active_priority.priority_bin == TilePriority::EVENTUALLY && |
103 pending_priority.priority_bin == TilePriority::NOW) { | 112 pending_priority.priority_bin == TilePriority::NOW) { |
104 return PENDING_TREE; | 113 return PENDING_TREE; |
105 } | 114 } |
106 return ACTIVE_TREE; | 115 return ACTIVE_TREE; |
107 } | 116 } |
108 case NEW_CONTENT_TAKES_PRIORITY: | 117 case NEW_CONTENT_TAKES_PRIORITY: |
109 return PENDING_TREE; | 118 return PENDING_TREE; |
110 case SAME_PRIORITY_FOR_BOTH_TREES: { | 119 case SAME_PRIORITY_FOR_BOTH_TREES: { |
111 const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top(); | |
112 const Tile* pending_tile = | |
113 shared_tile ? shared_tile : pending_queue->Top(); | |
114 | |
115 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); | 120 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); |
116 const TilePriority& pending_priority = | 121 const TilePriority& pending_priority = |
117 pending_tile->priority(PENDING_TREE); | 122 pending_tile->priority(PENDING_TREE); |
118 | 123 |
119 if (active_priority.IsHigherPriorityThan(pending_priority)) | 124 if (active_priority.IsHigherPriorityThan(pending_priority)) |
120 return ACTIVE_TREE; | 125 return ACTIVE_TREE; |
121 return PENDING_TREE; | 126 return PENDING_TREE; |
122 } | 127 } |
123 default: | 128 default: |
124 NOTREACHED(); | 129 NOTREACHED(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 318 |
314 state->BeginDictionary("pending_queue"); | 319 state->BeginDictionary("pending_queue"); |
315 state->SetBoolean("has_tile", active_queue_has_tile); | 320 state->SetBoolean("has_tile", active_queue_has_tile); |
316 state->SetInteger("active_priority_bin", active_priority_bin); | 321 state->SetInteger("active_priority_bin", active_priority_bin); |
317 state->SetInteger("pending_priority_bin", pending_priority_bin); | 322 state->SetInteger("pending_priority_bin", pending_priority_bin); |
318 state->EndDictionary(); | 323 state->EndDictionary(); |
319 return state; | 324 return state; |
320 } | 325 } |
321 | 326 |
322 } // namespace cc | 327 } // namespace cc |
OLD | NEW |