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

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: 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
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)));
vmpstr 2015/04/02 17:30:29 nit: keep the braces, since the for loop is two li
USE eero AT chromium.org 2015/04/07 13:17:07 Done.
94 paired_queues_.push_back(
95 make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_)));
96 }
97 94
98 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_)); 95 paired_queues_.make_heap(EvictionOrderComparator(tree_priority_));
99 } 96 }
100 97
101 bool EvictionTilePriorityQueue::IsEmpty() const { 98 bool EvictionTilePriorityQueue::IsEmpty() const {
102 return paired_queues_.empty() || paired_queues_.front()->IsEmpty(); 99 return paired_queues_.empty() || paired_queues_.front()->IsEmpty();
103 } 100 }
104 101
105 Tile* EvictionTilePriorityQueue::Top() { 102 Tile* EvictionTilePriorityQueue::Top() {
106 DCHECK(!IsEmpty()); 103 DCHECK(!IsEmpty());
107 return paired_queues_.front()->Top(); 104 return paired_queues_.front()->Top();
108 } 105 }
109 106
110 void EvictionTilePriorityQueue::Pop() { 107 void EvictionTilePriorityQueue::Pop() {
111 DCHECK(!IsEmpty()); 108 DCHECK(!IsEmpty());
112 109
113 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_)); 110 paired_queues_.pop_heap(EvictionOrderComparator(tree_priority_));
114 PairedTilingSetQueue* paired_queue = paired_queues_.back(); 111 PairedTilingSetQueue* paired_queue = paired_queues_.back();
115 paired_queue->Pop(); 112 paired_queue->Pop();
116 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_)); 113 paired_queues_.push_heap(EvictionOrderComparator(tree_priority_));
117 } 114 }
118 115
119 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() { 116 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() {
120 } 117 }
121 118
122 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue( 119 EvictionTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue(
123 const PictureLayerImpl::Pair& layer_pair, 120 const PictureLayerImpl::Pair& layer_pair) {
124 TreePriority tree_priority) {
125 bool skip_shared_out_of_order_tiles = layer_pair.active && layer_pair.pending; 121 bool skip_shared_out_of_order_tiles = layer_pair.active && layer_pair.pending;
126 if (layer_pair.active) { 122 if (layer_pair.active) {
127 active_queue = make_scoped_ptr(new TilingSetEvictionQueue( 123 active_queue = make_scoped_ptr(new TilingSetEvictionQueue(
128 layer_pair.active->picture_layer_tiling_set(), tree_priority, 124 layer_pair.active->picture_layer_tiling_set(),
129 skip_shared_out_of_order_tiles)); 125 skip_shared_out_of_order_tiles));
130 } 126 }
131 if (layer_pair.pending) { 127 if (layer_pair.pending) {
132 pending_queue = make_scoped_ptr(new TilingSetEvictionQueue( 128 pending_queue = make_scoped_ptr(new TilingSetEvictionQueue(
133 layer_pair.pending->picture_layer_tiling_set(), tree_priority, 129 layer_pair.pending->picture_layer_tiling_set(),
134 skip_shared_out_of_order_tiles)); 130 skip_shared_out_of_order_tiles));
135 } 131 }
136 } 132 }
137 133
138 EvictionTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() { 134 EvictionTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() {
139 } 135 }
140 136
141 bool EvictionTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const { 137 bool EvictionTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const {
142 return (!active_queue || active_queue->IsEmpty()) && 138 return (!active_queue || active_queue->IsEmpty()) &&
143 (!pending_queue || pending_queue->IsEmpty()); 139 (!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; 194 return active_tile->required_for_activation() ? PENDING_TREE : ACTIVE_TREE;
199 } 195 }
200 196
201 // Return tile with a lower priority. 197 // Return tile with a lower priority.
202 if (pending_priority.IsHigherPriorityThan(active_priority)) 198 if (pending_priority.IsHigherPriorityThan(active_priority))
203 return ACTIVE_TREE; 199 return ACTIVE_TREE;
204 return PENDING_TREE; 200 return PENDING_TREE;
205 } 201 }
206 202
207 } // namespace cc 203 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698