OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | 5 #ifndef CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ |
6 #define CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | 6 #define CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ |
7 | 7 |
| 8 #include <set> |
8 #include <utility> | 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/layers/picture_layer_impl.h" | 13 #include "cc/layers/picture_layer_impl.h" |
13 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_priority.h" |
14 #include "cc/resources/tiling_set_eviction_queue.h" | 15 #include "cc/resources/tiling_set_eviction_queue.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 class CC_EXPORT EvictionTilePriorityQueue { | 19 class CC_EXPORT EvictionTilePriorityQueue { |
19 public: | 20 public: |
20 struct PairedTilingSetQueue { | 21 struct PairedTilingSetQueue { |
21 PairedTilingSetQueue(); | 22 PairedTilingSetQueue(); |
22 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, | 23 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, |
23 TreePriority tree_priority); | 24 TreePriority tree_priority); |
24 ~PairedTilingSetQueue(); | 25 ~PairedTilingSetQueue(); |
25 | 26 |
26 bool IsEmpty() const; | 27 bool IsEmpty() const; |
27 Tile* Top(TreePriority tree_priority); | 28 Tile* Top(TreePriority tree_priority); |
28 void Pop(TreePriority tree_priority); | 29 void Pop(TreePriority tree_priority); |
29 | 30 |
30 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; | 31 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; |
31 | 32 |
32 scoped_ptr<TilingSetEvictionQueue> active_queue; | 33 scoped_ptr<TilingSetEvictionQueue> active_queue; |
33 scoped_ptr<TilingSetEvictionQueue> pending_queue; | 34 scoped_ptr<TilingSetEvictionQueue> pending_queue; |
34 | 35 |
35 // TODO(vmpstr): Investigate removing this. | 36 // Set of returned tiles (excluding the current one) for DCHECKing. |
36 std::vector<Tile*> returned_shared_tiles; | 37 std::set<const Tile*> returned_tiles_for_debug; |
37 }; | 38 }; |
38 | 39 |
39 EvictionTilePriorityQueue(); | 40 EvictionTilePriorityQueue(); |
40 ~EvictionTilePriorityQueue(); | 41 ~EvictionTilePriorityQueue(); |
41 | 42 |
42 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, | 43 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers, |
43 TreePriority tree_priority); | 44 TreePriority tree_priority); |
44 void Reset(); | 45 void Reset(); |
45 | 46 |
46 bool IsEmpty() const; | 47 bool IsEmpty() const; |
47 Tile* Top(); | 48 Tile* Top(); |
48 void Pop(); | 49 void Pop(); |
49 | 50 |
50 private: | 51 private: |
51 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that | 52 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that |
52 // PairedTilingSetQueue is fast enough to copy. In that case, we can use | 53 // PairedTilingSetQueue is fast enough to copy. In that case, we can use |
53 // objects directly (ie std::vector<PairedTilingSetQueue>). | 54 // objects directly (ie std::vector<PairedTilingSetQueue>). |
54 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; | 55 ScopedPtrVector<PairedTilingSetQueue> paired_queues_; |
55 TreePriority tree_priority_; | 56 TreePriority tree_priority_; |
56 | 57 |
57 DISALLOW_COPY_AND_ASSIGN(EvictionTilePriorityQueue); | 58 DISALLOW_COPY_AND_ASSIGN(EvictionTilePriorityQueue); |
58 }; | 59 }; |
59 | 60 |
60 } // namespace cc | 61 } // namespace cc |
61 | 62 |
62 #endif // CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ | 63 #endif // CC_RESOURCES_EVICTION_TILE_PRIORITY_QUEUE_H_ |
OLD | NEW |