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

Unified Diff: cc/tiles/raster_tile_priority_queue_all.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: cc/tiles/raster_tile_priority_queue_all.cc
diff --git a/cc/tiles/raster_tile_priority_queue_all.cc b/cc/tiles/raster_tile_priority_queue_all.cc
index ea3c14f8dd00ce9e837a677869c4bf0602e14de4..79eec197a327215ad29b966d1062e569c33198c8 100644
--- a/cc/tiles/raster_tile_priority_queue_all.cc
+++ b/cc/tiles/raster_tile_priority_queue_all.cc
@@ -15,8 +15,8 @@ class RasterOrderComparator {
explicit RasterOrderComparator(TreePriority tree_priority)
: tree_priority_(tree_priority) {}
- bool operator()(const TilingSetRasterQueueAll* a_queue,
- const TilingSetRasterQueueAll* b_queue) const {
+ bool operator()(const scoped_ptr<TilingSetRasterQueueAll>& a_queue,
+ const scoped_ptr<TilingSetRasterQueueAll>& b_queue) const {
// Note that in this function, we have to return true if and only if
// a is strictly lower priority than b.
const TilePriority& a_priority = a_queue->Top().priority();
@@ -51,7 +51,7 @@ class RasterOrderComparator {
void CreateTilingSetRasterQueues(
const std::vector<PictureLayerImpl*>& layers,
TreePriority tree_priority,
- ScopedPtrVector<TilingSetRasterQueueAll>* queues) {
+ std::vector<scoped_ptr<TilingSetRasterQueueAll>>* queues) {
DCHECK(queues->empty());
for (auto* layer : layers) {
@@ -66,7 +66,8 @@ void CreateTilingSetRasterQueues(
if (!tiling_set_queue->IsEmpty())
queues->push_back(tiling_set_queue.Pass());
}
- queues->make_heap(RasterOrderComparator(tree_priority));
+ std::make_heap(queues->begin(), queues->end(),
+ RasterOrderComparator(tree_priority));
}
} // namespace
@@ -93,32 +94,37 @@ bool RasterTilePriorityQueueAll::IsEmpty() const {
const PrioritizedTile& RasterTilePriorityQueueAll::Top() const {
DCHECK(!IsEmpty());
- const ScopedPtrVector<TilingSetRasterQueueAll>& next_queues = GetNextQueues();
+ const std::vector<scoped_ptr<TilingSetRasterQueueAll>>& next_queues =
danakj 2015/11/17 01:12:18 auto
vmpstr 2015/11/17 23:26:25 Done.
+ GetNextQueues();
return next_queues.front()->Top();
}
void RasterTilePriorityQueueAll::Pop() {
DCHECK(!IsEmpty());
- ScopedPtrVector<TilingSetRasterQueueAll>& next_queues = GetNextQueues();
- next_queues.pop_heap(RasterOrderComparator(tree_priority_));
- TilingSetRasterQueueAll* queue = next_queues.back();
+ std::vector<scoped_ptr<TilingSetRasterQueueAll>>& next_queues =
danakj 2015/11/17 01:12:18 auto?
vmpstr 2015/11/17 23:26:25 Done.
+ GetNextQueues();
+ std::pop_heap(next_queues.begin(), next_queues.end(),
+ RasterOrderComparator(tree_priority_));
+ TilingSetRasterQueueAll* queue = next_queues.back().get();
queue->Pop();
// Remove empty queues.
- if (queue->IsEmpty())
+ if (queue->IsEmpty()) {
next_queues.pop_back();
- else
- next_queues.push_heap(RasterOrderComparator(tree_priority_));
+ } else {
+ std::push_heap(next_queues.begin(), next_queues.end(),
+ RasterOrderComparator(tree_priority_));
+ }
}
-ScopedPtrVector<TilingSetRasterQueueAll>&
+std::vector<scoped_ptr<TilingSetRasterQueueAll>>&
RasterTilePriorityQueueAll::GetNextQueues() {
- return const_cast<ScopedPtrVector<TilingSetRasterQueueAll>&>(
+ return const_cast<std::vector<scoped_ptr<TilingSetRasterQueueAll>>&>(
danakj 2015/11/17 01:12:18 heh. temp vars?
vmpstr 2015/11/17 23:26:25 Done.
static_cast<const RasterTilePriorityQueueAll*>(this)->GetNextQueues());
}
-const ScopedPtrVector<TilingSetRasterQueueAll>&
+const std::vector<scoped_ptr<TilingSetRasterQueueAll>>&
RasterTilePriorityQueueAll::GetNextQueues() const {
DCHECK(!IsEmpty());

Powered by Google App Engine
This is Rietveld 408576698