| Index: cc/resources/tile_priority_queue.cc
|
| diff --git a/cc/resources/tile_priority_queue.cc b/cc/resources/tile_priority_queue.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..90c0cb1492a662a6982077ff5c9a838cd1543880
|
| --- /dev/null
|
| +++ b/cc/resources/tile_priority_queue.cc
|
| @@ -0,0 +1,64 @@
|
| +// Copyright 2011 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/tile_priority_queue.h"
|
| +
|
| +#include <vector>
|
| +
|
| +#include "cc/layers/picture_layer_impl.h"
|
| +
|
| +namespace cc {
|
| +
|
| +TilePriorityQueue::PairedPictureLayer::PairedPictureLayer()
|
| + : active_layer(NULL), pending_layer(NULL) {
|
| +}
|
| +
|
| +TilePriorityQueue::PairedPictureLayer::~PairedPictureLayer() {
|
| +}
|
| +
|
| +TilePriorityQueue::~TilePriorityQueue() {
|
| +}
|
| +
|
| +void TilePriorityQueue::GetPairedPictureLayers(
|
| + const std::vector<PictureLayerImpl*>& layers,
|
| + std::vector<PairedPictureLayer>* paired_layers) const {
|
| + DCHECK(paired_layers);
|
| + DCHECK(paired_layers->empty());
|
| +
|
| + for (std::vector<PictureLayerImpl*>::const_iterator it = layers.begin();
|
| + it != layers.end();
|
| + ++it) {
|
| + PictureLayerImpl* layer = *it;
|
| +
|
| + // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
|
| + if (!layer->HasValidTilePriorities())
|
| + continue;
|
| +
|
| + PictureLayerImpl* twin_layer = layer->GetTwinLayer();
|
| +
|
| + // Ignore the twin layer when tile priorities are invalid.
|
| + // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
|
| + if (twin_layer && !twin_layer->HasValidTilePriorities())
|
| + twin_layer = NULL;
|
| +
|
| + PairedPictureLayer paired_layer;
|
| + WhichTree tree = layer->GetTree();
|
| +
|
| + // If the current tree is ACTIVE_TREE, then always generate a paired_layer.
|
| + // If current tree is PENDING_TREE, then only generate a paired_layer if
|
| + // there is no twin layer.
|
| + if (tree == ACTIVE_TREE) {
|
| + DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE);
|
| + paired_layer.active_layer = layer;
|
| + paired_layer.pending_layer = twin_layer;
|
| + paired_layers->push_back(paired_layer);
|
| + } else if (!twin_layer) {
|
| + paired_layer.active_layer = NULL;
|
| + paired_layer.pending_layer = layer;
|
| + paired_layers->push_back(paired_layer);
|
| + }
|
| + }
|
| +}
|
| +
|
| +} // namespace cc
|
|
|