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

Side by Side Diff: cc/resources/raster_tile_priority_queue.h

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, 10 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 unified diff | Download patch
« no previous file with comments | « cc/resources/raster_source_helper.cc ('k') | cc/resources/raster_tile_priority_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RASTER_TILE_PRIORITY_QUEUE_H_ 5 #ifndef CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_
6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ 6 #define CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_
7 7
8 #include <set>
9 #include <utility>
10 #include <vector> 8 #include <vector>
11 9
12 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
13 #include "cc/layers/picture_layer_impl.h" 11 #include "cc/layers/picture_layer_impl.h"
14 #include "cc/resources/tile_priority.h" 12 #include "cc/resources/tile_priority.h"
15 #include "cc/resources/tiling_set_raster_queue.h"
16 13
17 namespace cc { 14 namespace cc {
15 class Tile;
18 16
19 // TODO(vmpstr): Consider virtualizing this and adding ::Create with the
20 // parameters of ::Build that would create a simpler queue for required only
21 // tiles (ie, there's no need for the heap if all we're interested in are the
22 // required tiles.
23 class CC_EXPORT RasterTilePriorityQueue { 17 class CC_EXPORT RasterTilePriorityQueue {
24 public: 18 public:
25 enum class Type { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW }; 19 enum class Type { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW };
26 20
27 class PairedTilingSetQueue { 21 // TODO(vmpstr): Make this work with PictureLayerTilingSet pairs instead.
28 public: 22 static scoped_ptr<RasterTilePriorityQueue> Create(
29 PairedTilingSetQueue(); 23 const std::vector<PictureLayerImpl::Pair>& paired_layers,
30 PairedTilingSetQueue(const PictureLayerImpl::Pair& layer_pair, 24 TreePriority tree_priority,
31 TreePriority tree_priority, 25 Type type);
32 Type type);
33 ~PairedTilingSetQueue();
34 26
35 bool IsEmpty() const; 27 virtual ~RasterTilePriorityQueue() {}
36 Tile* Top(TreePriority tree_priority);
37 void Pop(TreePriority tree_priority);
38 28
39 WhichTree NextTileIteratorTree(TreePriority tree_priority) const; 29 virtual bool IsEmpty() const = 0;
40 void SkipTilesReturnedByTwin(TreePriority tree_priority); 30 virtual Tile* Top() = 0;
31 virtual void Pop() = 0;
41 32
42 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; 33 protected:
43 34 RasterTilePriorityQueue() {}
44 const TilingSetRasterQueue* active_queue() const {
45 return active_queue_.get();
46 }
47 const TilingSetRasterQueue* pending_queue() const {
48 return pending_queue_.get();
49 }
50
51 private:
52 scoped_ptr<TilingSetRasterQueue> active_queue_;
53 scoped_ptr<TilingSetRasterQueue> pending_queue_;
54 bool has_both_layers_;
55
56 // Set of returned tiles (excluding the current one) for DCHECKing.
57 std::set<const Tile*> returned_tiles_for_debug_;
58 };
59
60 RasterTilePriorityQueue();
61 ~RasterTilePriorityQueue();
62
63 void Build(const std::vector<PictureLayerImpl::Pair>& paired_layers,
64 TreePriority tree_priority,
65 Type type);
66 void Reset();
67
68 bool IsEmpty() const;
69 Tile* Top();
70 void Pop();
71 35
72 private: 36 private:
73 // TODO(vmpstr): This is potentially unnecessary if it becomes the case that
74 // PairedTilingSetQueue is fast enough to copy. In that case, we can use
75 // objects directly (ie std::vector<PairedTilingSetQueue>.
76 ScopedPtrVector<PairedTilingSetQueue> paired_queues_;
77 TreePriority tree_priority_;
78
79 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue); 37 DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueue);
80 }; 38 };
81 39
82 } // namespace cc 40 } // namespace cc
83 41
84 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_ 42 #endif // CC_RESOURCES_RASTER_TILE_PRIORITY_QUEUE_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_source_helper.cc ('k') | cc/resources/raster_tile_priority_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698