OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | |
6 #define CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | |
7 | |
8 #include <utility> | |
9 #include <vector> | |
10 | |
11 #include "cc/base/cc_export.h" | |
12 #include "cc/layers/picture_layer_impl.h" | |
13 #include "cc/resources/tile_priority.h" | |
14 #include "cc/resources/tile_priority_queue.h" | |
15 | |
16 namespace cc { | |
17 | |
18 struct CC_EXPORT EvictionTilePriorityQueue : public TilePriorityQueue { | |
19 public: | |
20 EvictionTilePriorityQueue(); | |
21 virtual ~EvictionTilePriorityQueue(); | |
22 | |
23 void Prepare(const std::vector<PairedPictureLayer>& paired_picture_layers, | |
24 TreePriority tree_priority); | |
25 | |
26 // TilePriorityQueue overrides. | |
27 virtual void Pop() OVERRIDE; | |
28 virtual bool IsEmpty() OVERRIDE; | |
29 virtual Tile* Top() OVERRIDE; | |
30 | |
31 private: | |
32 struct PairedPictureLayerIterator { | |
33 PairedPictureLayerIterator(); | |
34 ~PairedPictureLayerIterator(); | |
35 | |
36 Tile* PeekTile(TreePriority tree_priority); | |
37 void PopTile(TreePriority tree_priority); | |
38 | |
39 PictureLayerImpl::LayerEvictionTileIterator* NextTileIterator( | |
40 TreePriority tree_priority); | |
41 | |
42 PictureLayerImpl::LayerEvictionTileIterator active_iterator; | |
43 PictureLayerImpl::LayerEvictionTileIterator pending_iterator; | |
44 | |
45 std::vector<Tile*> returned_shared_tiles; | |
46 }; | |
47 | |
48 class EvictionOrderComparator { | |
49 public: | |
50 explicit EvictionOrderComparator(TreePriority tree_priority); | |
51 | |
52 bool operator()(PairedPictureLayerIterator* a, | |
53 PairedPictureLayerIterator* b) const; | |
54 | |
55 private: | |
56 TreePriority tree_priority_; | |
57 }; | |
58 | |
59 void Initialize(); | |
reveman
2014/07/14 15:52:38
Why is there both a Prepare function and an Initia
vmpstr
2014/07/14 18:10:44
Prepare is a part of a public interface, Initializ
| |
60 | |
61 std::vector<PairedPictureLayerIterator> paired_iterators_; | |
62 std::vector<PairedPictureLayerIterator*> iterator_heap_; | |
63 std::vector<PairedPictureLayer> paired_picture_layers_; | |
64 TreePriority tree_priority_; | |
65 EvictionOrderComparator comparator_; | |
66 bool initialized_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(EvictionTilePriorityQueue); | |
69 }; | |
70 | |
71 } // namespace cc | |
72 | |
73 #endif // CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | |
OLD | NEW |