Add test for clicking bookmark star in presence of ctrl-D keybinding
[chromium-blink-merge.git] / cc / resources / tiling_set_raster_queue.h
blobe3250369fd60fc2055f7ef423a42c107d9df3571
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.
5 #ifndef CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_
6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/resources/picture_layer_tiling_set.h"
10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_priority.h"
13 namespace cc {
15 class CC_EXPORT TilingSetRasterQueue {
16 public:
17 TilingSetRasterQueue();
18 TilingSetRasterQueue(PictureLayerTilingSet* tiling_set,
19 bool prioritize_low_res);
20 ~TilingSetRasterQueue();
22 Tile* Top();
23 const Tile* Top() const;
24 void Pop();
25 bool IsEmpty() const;
27 private:
28 class TilingIterator {
29 public:
30 TilingIterator();
31 explicit TilingIterator(PictureLayerTiling* tiling,
32 TilingData* tiling_data);
33 ~TilingIterator();
35 operator bool() const { return !!current_tile_; }
36 const Tile* operator*() const { return current_tile_; }
37 Tile* operator*() { return current_tile_; }
38 TilePriority::PriorityBin type() const {
39 switch (phase_) {
40 case VISIBLE_RECT:
41 return TilePriority::NOW;
42 case SKEWPORT_RECT:
43 case SOON_BORDER_RECT:
44 return TilePriority::SOON;
45 case EVENTUALLY_RECT:
46 return TilePriority::EVENTUALLY;
48 NOTREACHED();
49 return TilePriority::EVENTUALLY;
52 TilingIterator& operator++();
54 private:
55 enum Phase {
56 VISIBLE_RECT,
57 SKEWPORT_RECT,
58 SOON_BORDER_RECT,
59 EVENTUALLY_RECT
62 void AdvancePhase();
63 bool TileNeedsRaster(Tile* tile) const {
64 return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile);
67 PictureLayerTiling* tiling_;
68 TilingData* tiling_data_;
70 Phase phase_;
72 Tile* current_tile_;
73 TilingData::Iterator visible_iterator_;
74 TilingData::SpiralDifferenceIterator spiral_iterator_;
77 enum IteratorType { LOW_RES, HIGH_RES, NUM_ITERATORS };
79 void AdvanceToNextStage();
81 PictureLayerTilingSet* tiling_set_;
83 struct IterationStage {
84 IteratorType iterator_type;
85 TilePriority::PriorityBin tile_type;
88 size_t current_stage_;
90 // One low res stage, and three high res stages.
91 IterationStage stages_[4];
92 TilingIterator iterators_[NUM_ITERATORS];
95 } // namespace cc
97 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_