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

Unified Diff: cc/resources/raster_tile_priority_queue_all.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/raster_tile_priority_queue_all.h ('k') | cc/resources/raster_tile_priority_queue_required.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/raster_tile_priority_queue_all.cc
diff --git a/cc/resources/raster_tile_priority_queue.cc b/cc/resources/raster_tile_priority_queue_all.cc
similarity index 77%
copy from cc/resources/raster_tile_priority_queue.cc
copy to cc/resources/raster_tile_priority_queue_all.cc
index 08862f68a6417e697a2e99997a6fc521a2611077..e9836cd8414f7915bd6354eb573b6c0ff6df48f2 100644
--- a/cc/resources/raster_tile_priority_queue.cc
+++ b/cc/resources/raster_tile_priority_queue_all.cc
@@ -1,11 +1,10 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/raster_tile_priority_queue.h"
+#include "cc/resources/raster_tile_priority_queue_all.h"
#include "cc/resources/tiling_set_raster_queue_all.h"
-#include "cc/resources/tiling_set_raster_queue_required.h"
namespace cc {
@@ -17,8 +16,8 @@ class RasterOrderComparator {
: tree_priority_(tree_priority) {}
bool operator()(
- const RasterTilePriorityQueue::PairedTilingSetQueue* a,
- const RasterTilePriorityQueue::PairedTilingSetQueue* b) const {
+ const RasterTilePriorityQueueAll::PairedTilingSetQueue* a,
+ const RasterTilePriorityQueueAll::PairedTilingSetQueue* b) const {
// Note that in this function, we have to return true if and only if
// a is strictly lower priority than b. Note that for the sake of
// completeness, empty queue is considered to have lowest priority.
@@ -26,11 +25,11 @@ class RasterOrderComparator {
return b->IsEmpty() < a->IsEmpty();
WhichTree a_tree = a->NextTileIteratorTree(tree_priority_);
- const TilingSetRasterQueue* a_queue =
+ const TilingSetRasterQueueAll* a_queue =
a_tree == ACTIVE_TREE ? a->active_queue() : a->pending_queue();
WhichTree b_tree = b->NextTileIteratorTree(tree_priority_);
- const TilingSetRasterQueue* b_queue =
+ const TilingSetRasterQueueAll* b_queue =
b_tree == ACTIVE_TREE ? b->active_queue() : b->pending_queue();
const Tile* a_tile = a_queue->Top();
@@ -84,8 +83,8 @@ class RasterOrderComparator {
};
WhichTree HigherPriorityTree(TreePriority tree_priority,
- const TilingSetRasterQueue* active_queue,
- const TilingSetRasterQueue* pending_queue,
+ const TilingSetRasterQueueAll* active_queue,
+ const TilingSetRasterQueueAll* pending_queue,
const Tile* shared_tile) {
switch (tree_priority) {
case SMOOTHNESS_TAKES_PRIORITY: {
@@ -127,58 +126,48 @@ WhichTree HigherPriorityTree(TreePriority tree_priority,
}
}
-scoped_ptr<TilingSetRasterQueue> CreateTilingSetRasterQueue(
+scoped_ptr<TilingSetRasterQueueAll> CreateTilingSetRasterQueue(
PictureLayerImpl* layer,
- TreePriority tree_priority,
- RasterTilePriorityQueue::Type type) {
+ TreePriority tree_priority) {
if (!layer)
return nullptr;
PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set();
- if (type == RasterTilePriorityQueue::Type::ALL) {
- bool prioritize_low_res = tree_priority == SMOOTHNESS_TAKES_PRIORITY;
- return make_scoped_ptr(
- new TilingSetRasterQueueAll(tiling_set, prioritize_low_res));
- }
- return make_scoped_ptr(new TilingSetRasterQueueRequired(tiling_set, type));
+ bool prioritize_low_res = tree_priority == SMOOTHNESS_TAKES_PRIORITY;
+ return make_scoped_ptr(
+ new TilingSetRasterQueueAll(tiling_set, prioritize_low_res));
}
} // namespace
-RasterTilePriorityQueue::RasterTilePriorityQueue() {
+RasterTilePriorityQueueAll::RasterTilePriorityQueueAll() {
}
-RasterTilePriorityQueue::~RasterTilePriorityQueue() {
+RasterTilePriorityQueueAll::~RasterTilePriorityQueueAll() {
}
-void RasterTilePriorityQueue::Build(
+void RasterTilePriorityQueueAll::Build(
const std::vector<PictureLayerImpl::Pair>& paired_layers,
- TreePriority tree_priority,
- Type type) {
+ TreePriority tree_priority) {
tree_priority_ = tree_priority;
for (std::vector<PictureLayerImpl::Pair>::const_iterator it =
paired_layers.begin();
- it != paired_layers.end();
- ++it) {
+ it != paired_layers.end(); ++it) {
paired_queues_.push_back(
- make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_, type)));
+ make_scoped_ptr(new PairedTilingSetQueue(*it, tree_priority_)));
}
paired_queues_.make_heap(RasterOrderComparator(tree_priority_));
}
-void RasterTilePriorityQueue::Reset() {
- paired_queues_.clear();
-}
-
-bool RasterTilePriorityQueue::IsEmpty() const {
+bool RasterTilePriorityQueueAll::IsEmpty() const {
return paired_queues_.empty() || paired_queues_.front()->IsEmpty();
}
-Tile* RasterTilePriorityQueue::Top() {
+Tile* RasterTilePriorityQueueAll::Top() {
DCHECK(!IsEmpty());
return paired_queues_.front()->Top(tree_priority_);
}
-void RasterTilePriorityQueue::Pop() {
+void RasterTilePriorityQueueAll::Pop() {
DCHECK(!IsEmpty());
paired_queues_.pop_heap(RasterOrderComparator(tree_priority_));
@@ -187,33 +176,17 @@ void RasterTilePriorityQueue::Pop() {
paired_queues_.push_heap(RasterOrderComparator(tree_priority_));
}
-RasterTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue() {
+RasterTilePriorityQueueAll::PairedTilingSetQueue::PairedTilingSetQueue() {
}
-RasterTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue(
+RasterTilePriorityQueueAll::PairedTilingSetQueue::PairedTilingSetQueue(
const PictureLayerImpl::Pair& layer_pair,
- TreePriority tree_priority,
- Type type)
- : has_both_layers_(false) {
- switch (type) {
- case RasterTilePriorityQueue::Type::ALL:
- has_both_layers_ = layer_pair.active && layer_pair.pending;
- active_queue_ =
- CreateTilingSetRasterQueue(layer_pair.active, tree_priority, type);
- pending_queue_ =
- CreateTilingSetRasterQueue(layer_pair.pending, tree_priority, type);
- break;
- case RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION:
- pending_queue_ =
- CreateTilingSetRasterQueue(layer_pair.pending, tree_priority, type);
- break;
- case RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW:
- active_queue_ =
- CreateTilingSetRasterQueue(layer_pair.active, tree_priority, type);
- break;
- }
- DCHECK_IMPLIES(has_both_layers_, active_queue_ && pending_queue_);
-
+ TreePriority tree_priority)
+ : active_queue_(
+ CreateTilingSetRasterQueue(layer_pair.active, tree_priority)),
+ pending_queue_(
+ CreateTilingSetRasterQueue(layer_pair.pending, tree_priority)),
+ has_both_layers_(layer_pair.active && layer_pair.pending) {
SkipTilesReturnedByTwin(tree_priority);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
@@ -221,23 +194,23 @@ RasterTilePriorityQueue::PairedTilingSetQueue::PairedTilingSetQueue(
TRACE_EVENT_SCOPE_THREAD, "state", StateAsValue());
}
-RasterTilePriorityQueue::PairedTilingSetQueue::~PairedTilingSetQueue() {
+RasterTilePriorityQueueAll::PairedTilingSetQueue::~PairedTilingSetQueue() {
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
"PairedTilingSetQueue::~PairedTilingSetQueue",
TRACE_EVENT_SCOPE_THREAD, "state", StateAsValue());
}
-bool RasterTilePriorityQueue::PairedTilingSetQueue::IsEmpty() const {
+bool RasterTilePriorityQueueAll::PairedTilingSetQueue::IsEmpty() const {
return (!active_queue_ || active_queue_->IsEmpty()) &&
(!pending_queue_ || pending_queue_->IsEmpty());
}
-Tile* RasterTilePriorityQueue::PairedTilingSetQueue::Top(
+Tile* RasterTilePriorityQueueAll::PairedTilingSetQueue::Top(
TreePriority tree_priority) {
DCHECK(!IsEmpty());
WhichTree next_tree = NextTileIteratorTree(tree_priority);
- TilingSetRasterQueue* next_queue =
+ TilingSetRasterQueueAll* next_queue =
next_tree == ACTIVE_TREE ? active_queue_.get() : pending_queue_.get();
DCHECK(next_queue && !next_queue->IsEmpty());
Tile* tile = next_queue->Top();
@@ -246,12 +219,12 @@ Tile* RasterTilePriorityQueue::PairedTilingSetQueue::Top(
return tile;
}
-void RasterTilePriorityQueue::PairedTilingSetQueue::Pop(
+void RasterTilePriorityQueueAll::PairedTilingSetQueue::Pop(
TreePriority tree_priority) {
DCHECK(!IsEmpty());
WhichTree next_tree = NextTileIteratorTree(tree_priority);
- TilingSetRasterQueue* next_queue =
+ TilingSetRasterQueueAll* next_queue =
next_tree == ACTIVE_TREE ? active_queue_.get() : pending_queue_.get();
DCHECK(next_queue && !next_queue->IsEmpty());
DCHECK(returned_tiles_for_debug_.insert(next_queue->Top()).second);
@@ -263,7 +236,7 @@ void RasterTilePriorityQueue::PairedTilingSetQueue::Pop(
DCHECK(IsEmpty() || Top(tree_priority));
}
-void RasterTilePriorityQueue::PairedTilingSetQueue::SkipTilesReturnedByTwin(
+void RasterTilePriorityQueueAll::PairedTilingSetQueue::SkipTilesReturnedByTwin(
TreePriority tree_priority) {
if (!has_both_layers_)
return;
@@ -272,7 +245,7 @@ void RasterTilePriorityQueue::PairedTilingSetQueue::SkipTilesReturnedByTwin(
// tiles twice (from the active iterator and from the pending iterator).
while (!IsEmpty()) {
WhichTree next_tree = NextTileIteratorTree(tree_priority);
- TilingSetRasterQueue* next_queue =
+ TilingSetRasterQueueAll* next_queue =
next_tree == ACTIVE_TREE ? active_queue_.get() : pending_queue_.get();
DCHECK(next_queue && !next_queue->IsEmpty());
@@ -291,7 +264,8 @@ void RasterTilePriorityQueue::PairedTilingSetQueue::SkipTilesReturnedByTwin(
}
}
-WhichTree RasterTilePriorityQueue::PairedTilingSetQueue::NextTileIteratorTree(
+WhichTree
+RasterTilePriorityQueueAll::PairedTilingSetQueue::NextTileIteratorTree(
TreePriority tree_priority) const {
DCHECK(!IsEmpty());
@@ -307,7 +281,7 @@ WhichTree RasterTilePriorityQueue::PairedTilingSetQueue::NextTileIteratorTree(
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
-RasterTilePriorityQueue::PairedTilingSetQueue::StateAsValue() const {
+RasterTilePriorityQueueAll::PairedTilingSetQueue::StateAsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
« no previous file with comments | « cc/resources/raster_tile_priority_queue_all.h ('k') | cc/resources/raster_tile_priority_queue_required.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698