Chromium Code Reviews| Index: cc/resources/tile_priority_queue.h |
| diff --git a/cc/resources/tile_priority_queue.h b/cc/resources/tile_priority_queue.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d5894fc6fbc08d0acda460ae6cf3a393c306793 |
| --- /dev/null |
| +++ b/cc/resources/tile_priority_queue.h |
| @@ -0,0 +1,129 @@ |
| +// Copyright 2014 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. |
| + |
| +#ifndef CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ |
| +#define CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ |
| + |
| +#include <utility> |
| +#include <vector> |
| + |
| +#include "cc/base/cc_export.h" |
| +#include "cc/layers/picture_layer_impl.h" |
| +#include "cc/resources/tile_priority.h" |
| + |
| +namespace cc { |
| + |
| +class Tile; |
| + |
| +struct CC_EXPORT PairedPictureLayer { |
| + PairedPictureLayer(); |
| + ~PairedPictureLayer(); |
| + |
| + PictureLayerImpl* active_layer; |
| + PictureLayerImpl* pending_layer; |
| +}; |
| + |
| +class CC_EXPORT RasterTileQueue { |
|
reveman
2014/07/09 02:21:09
How about only declaring an abstract TilePriortyQu
vmpstr
2014/07/09 18:35:38
Done.
|
| + public: |
| + RasterTileQueue(); |
| + ~RasterTileQueue(); |
| + |
| + void Prepare(const std::vector<PairedPictureLayer>& paired_picture_layers, |
| + TreePriority tree_priority); |
| + |
| + void Pop(); |
| + bool IsEmpty(); |
| + Tile* Top(); |
| + |
| + private: |
| + struct PairedPictureLayerIterator { |
| + PairedPictureLayerIterator(); |
| + ~PairedPictureLayerIterator(); |
| + |
| + Tile* PeekTile(TreePriority tree_priority); |
| + void PopTile(TreePriority tree_priority); |
| + |
| + std::pair<PictureLayerImpl::LayerRasterTileIterator*, WhichTree> |
| + NextTileIterator(TreePriority tree_priority); |
| + |
| + PictureLayerImpl::LayerRasterTileIterator active_iterator; |
| + PictureLayerImpl::LayerRasterTileIterator pending_iterator; |
| + |
| + std::vector<Tile*> returned_shared_tiles; |
| + }; |
| + |
| + class RasterOrderComparator { |
| + public: |
| + explicit RasterOrderComparator(TreePriority tree_priority); |
| + |
| + bool operator()(PairedPictureLayerIterator* a, |
| + PairedPictureLayerIterator* b) const; |
| + |
| + private: |
| + TreePriority tree_priority_; |
| + }; |
| + |
| + std::vector<PairedPictureLayerIterator> paired_iterators_; |
| + std::vector<PairedPictureLayerIterator*> iterator_heap_; |
| + TreePriority tree_priority_; |
| + RasterOrderComparator comparator_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RasterTileQueue); |
| +}; |
| + |
| +struct CC_EXPORT EvictionTileQueue { |
| + public: |
| + EvictionTileQueue(); |
| + ~EvictionTileQueue(); |
| + |
| + void Prepare(const std::vector<PairedPictureLayer>& paired_picture_layers, |
| + TreePriority tree_priority); |
| + |
| + void Pop(); |
| + bool IsEmpty(); |
| + Tile* Top(); |
| + |
| + private: |
| + struct PairedPictureLayerIterator { |
| + PairedPictureLayerIterator(); |
| + ~PairedPictureLayerIterator(); |
| + |
| + Tile* PeekTile(TreePriority tree_priority); |
| + void PopTile(TreePriority tree_priority); |
| + |
| + PictureLayerImpl::LayerEvictionTileIterator* NextTileIterator( |
| + TreePriority tree_priority); |
| + |
| + PictureLayerImpl::LayerEvictionTileIterator active_iterator; |
| + PictureLayerImpl::LayerEvictionTileIterator pending_iterator; |
| + |
| + std::vector<Tile*> returned_shared_tiles; |
| + }; |
| + |
| + class EvictionOrderComparator { |
| + public: |
| + explicit EvictionOrderComparator(TreePriority tree_priority); |
| + |
| + bool operator()(PairedPictureLayerIterator* a, |
| + PairedPictureLayerIterator* b) const; |
| + |
| + private: |
| + TreePriority tree_priority_; |
| + }; |
| + |
| + void Initialize(); |
| + |
| + std::vector<PairedPictureLayerIterator> paired_iterators_; |
| + std::vector<PairedPictureLayerIterator*> iterator_heap_; |
| + std::vector<PairedPictureLayer> paired_picture_layers_; |
| + TreePriority tree_priority_; |
| + EvictionOrderComparator comparator_; |
| + bool initialized_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EvictionTileQueue); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_RESOURCES_TILE_PRIORITY_QUEUE_H_ |