Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: cc/resources/eviction_tile_priority_queue.cc

Issue 1051473002: cc: Switch tiling set eviction queue to consider combined priority. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/eviction_tile_priority_queue.h ('k') | cc/resources/tiling_set_eviction_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/resources/eviction_tile_priority_queue.h" 5 #include "cc/resources/eviction_tile_priority_queue.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 EvictionTilePriorityQueue::~EvictionTilePriorityQueue() { 82 EvictionTilePriorityQueue::~EvictionTilePriorityQueue() {
83 } 83 }
84 84
85 void EvictionTilePriorityQueue::Build( 85 void EvictionTilePriorityQueue::Build(
86 const std::vector<PictureLayerImpl::Pair>& paired_layers, 86 const std::vector<PictureLayerImpl::Pair>& paired_layers,
87 TreePriority tree_priority) { 87 TreePriority tree_priority) {
88 tree_priority_ = tree_priority; 88 tree_priority_ = tree_priority;
89 89
90 for (std::vector<PictureLayerImpl::Pair>::const_iterator it = 90 for (std::vector<PictureLayerImpl::Pair>::const_iterator it =
91 paired_layers.begin(); 91 paired_layers.begin();
92 it != paired_layers.end(); 92 it != paired_layers.end(); ++it) {
93 ++it) { 93 paired_queues_.push_back(make_scoped_ptr(new PairedTilingSetQueue(*it)));
94 paired_queues_.push_back(
95 make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_)));
96 } 94 }
97 95
98 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); 96 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_));
99 } 97 }
100 98
101 bool EvictionTilePriorityQueue::IsEmpty() const { 99 bool EvictionTilePriorityQueue::IsEmpty() const {
102 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); 100 return paired_queues_.empty() || paired_queues_.front()->IsEmpty();
103 } 101 }
104 102
105 Tile* EvictionTilePriorityQueue::Top() { 103 Tile* EvictionTilePriorityQueue::Top() {
106 DCHECK(!IsEmpty()); 104 DCHECK(!IsEmpty());
107 return paired_queues_.front()->Top(); 105 return paired_queues_.front()->Top();
108 } 106 }
109 107
110 void EvictionTilePriorityQueue::Pop() { 108 void EvictionTilePriorityQueue::Pop() {
111 DCHECK(!IsEmpty()); 109 DCHECK(!IsEmpty());
112 110
113 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_)); 111 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_));
114 PairedTilingSetQueue* paired_queue = paired_queues_.back(); 112 PairedTilingSetQueue* paired_queue = paired_queues_.back();
115 paired_queue->Pop(); 113 paired_queue->Pop();
116 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_)); 114 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_));
117 } 115 }
118 116
119 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() { 117 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() {
120 } 118 }
121 119
122 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue( 120 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue(
123 const PictureLayerImpl::Pair& layer_pair, 121 const PictureLayerImpl::Pair& layer_pair) {
124 TreePriority tree_priority) {
125 bool skip_shared_out_of_order_tiles = layer_pair.active && layer_pair.pending; 122 bool skip_shared_out_of_order_tiles = layer_pair.active && layer_pair.pending;
126 if (layer_pair.active) { 123 if (layer_pair.active) {
127 active_queue = make_scoped_ptr(new TilingSetEvictionQueue( 124 active_queue = make_scoped_ptr(new TilingSetEvictionQueue(
128 layer_pair.active->picture_layer_tiling_set(), tree_priority, 125 layer_pair.active->picture_layer_tiling_set(),
129 skip_shared_out_of_order_tiles)); 126 skip_shared_out_of_order_tiles));
130 } 127 }
131 if (layer_pair.pending) { 128 if (layer_pair.pending) {
132 pending_queue = make_scoped_ptr(new TilingSetEvictionQueue( 129 pending_queue = make_scoped_ptr(new TilingSetEvictionQueue(
133 layer_pair.pending->picture_layer_tiling_set(), tree_priority, 130 layer_pair.pending->picture_layer_tiling_set(),
134 skip_shared_out_of_order_tiles)); 131 skip_shared_out_of_order_tiles));
135 } 132 }
136 } 133 }
137 134
138 EvictionTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() { 135 EvictionTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() {
139 } 136 }
140 137
141 bool EvictionTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const { 138 bool EvictionTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const {
142 return (!active_queue || active_queue->IsEmpty()) && 139 return (!active_queue || active_queue->IsEmpty()) &&
143 (!pending_queue || pending_queue->IsEmpty()); 140 (!pending_queue || pending_queue->IsEmpty());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE; 195 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE;
199 } 196 }
200 197
201 // Return tile with a lower priority. 198 // Return tile with a lower priority.
202 if (pending_priority.IsHigherPriorityThan(active_priority)) 199 if (pending_priority.IsHigherPriorityThan(active_priority))
203 return ACTIVE_TREE; 200 return ACTIVE_TREE;
204 return PENDING_TREE; 201 return PENDING_TREE;
205 } 202 }
206 203
207 } // namespace cc 204 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/eviction_tile_priority_queue.h ('k') | cc/resources/tiling_set_eviction_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698