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

Side by Side Diff: cc/resources/tiling_set_raster_queue_required.cc

Issue 1130123003: cc: Separate the priority from the tile and put in new PrioritizedTile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 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/tiling_set_raster_queue_required.h ('k') | cc/test/fake_picture_layer_impl.h » ('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 #include "cc/resources/tiling_set_raster_queue_required.h" 5 #include "cc/resources/tiling_set_raster_queue_required.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/resources/picture_layer_tiling_set.h" 9 #include "cc/resources/picture_layer_tiling_set.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return iterator_.done(); 63 return iterator_.done();
64 } 64 }
65 65
66 void TilingSetRasterQueueRequired::Pop() { 66 void TilingSetRasterQueueRequired::Pop() {
67 DCHECK(!IsEmpty()); 67 DCHECK(!IsEmpty());
68 ++iterator_; 68 ++iterator_;
69 while (!iterator_.done() && !IsTileRequired(*iterator_)) 69 while (!iterator_.done() && !IsTileRequired(*iterator_))
70 ++iterator_; 70 ++iterator_;
71 } 71 }
72 72
73 Tile* TilingSetRasterQueueRequired::Top() { 73 const PrioritizedTile& TilingSetRasterQueueRequired::Top() const {
74 DCHECK(!IsEmpty()); 74 DCHECK(!IsEmpty());
75 return *iterator_; 75 return *iterator_;
76 } 76 }
77 77
78 const Tile* TilingSetRasterQueueRequired::Top() const { 78 bool TilingSetRasterQueueRequired::IsTileRequired(
79 DCHECK(!IsEmpty()); 79 const PrioritizedTile& prioritized_tile) const {
80 return *iterator_;
81 }
82
83 bool TilingSetRasterQueueRequired::IsTileRequired(const Tile* tile) const {
84 return (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION && 80 return (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION &&
85 tile->required_for_activation()) || 81 prioritized_tile.tile()->required_for_activation()) ||
86 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && 82 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW &&
87 tile->required_for_draw()); 83 prioritized_tile.tile()->required_for_draw());
88 } 84 }
89 85
90 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() 86 TilingSetRasterQueueRequired::TilingIterator::TilingIterator()
91 : tiling_(nullptr), current_tile_(nullptr) { 87 : tiling_(nullptr) {
92 } 88 }
93 89
94 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( 90 TilingSetRasterQueueRequired::TilingIterator::TilingIterator(
95 PictureLayerTiling* tiling, 91 PictureLayerTiling* tiling,
96 TilingData* tiling_data, 92 TilingData* tiling_data,
97 const gfx::Rect& rect) 93 const gfx::Rect& rect)
98 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { 94 : tiling_(tiling), tiling_data_(tiling_data) {
99 visible_iterator_ = 95 visible_iterator_ =
100 TilingData::Iterator(tiling_data_, rect, false /* include_borders */); 96 TilingData::Iterator(tiling_data_, rect, false /* include_borders */);
101 if (!visible_iterator_) 97 if (!visible_iterator_)
102 return; 98 return;
103 99
104 current_tile_ = 100 Tile* tile =
105 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); 101 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y());
106
107 // If this is a valid tile, return it. Note that we have to use a tiling check 102 // If this is a valid tile, return it. Note that we have to use a tiling check
108 // for occlusion, since the tile's internal state has not yet been updated. 103 // for occlusion, since the tile's internal state has not yet been updated.
109 if (current_tile_ && current_tile_->NeedsRaster() && 104 if (tile && tile->NeedsRaster() && !tiling_->IsTileOccluded(tile)) {
110 !tiling_->IsTileOccluded(current_tile_)) { 105 tiling_->UpdateRequiredStatesOnTile(tile);
111 tiling_->UpdateTilePriority(current_tile_); 106 current_tile_ = tiling_->MakePrioritizedTile(tile);
112 return; 107 return;
113 } 108 }
114 ++(*this); 109 ++(*this);
115 } 110 }
116 111
117 TilingSetRasterQueueRequired::TilingIterator::~TilingIterator() { 112 TilingSetRasterQueueRequired::TilingIterator::~TilingIterator() {
118 } 113 }
119 114
120 TilingSetRasterQueueRequired::TilingIterator& 115 TilingSetRasterQueueRequired::TilingIterator&
121 TilingSetRasterQueueRequired::TilingIterator:: 116 TilingSetRasterQueueRequired::TilingIterator::
122 operator++() { 117 operator++() {
118 Tile* tile = nullptr;
123 while (true) { 119 while (true) {
124 ++visible_iterator_; 120 ++visible_iterator_;
125 if (!visible_iterator_) { 121 if (!visible_iterator_) {
126 current_tile_ = nullptr; 122 current_tile_ = PrioritizedTile();
127 return *this; 123 return *this;
128 } 124 }
129 std::pair<int, int> next_index = visible_iterator_.index(); 125 std::pair<int, int> next_index = visible_iterator_.index();
130 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); 126 tile = tiling_->TileAt(next_index.first, next_index.second);
131 // If the tile doesn't exist or if it exists but doesn't need raster work, 127 // If the tile doesn't exist or if it exists but doesn't need raster work,
132 // we can move on to the next tile. 128 // we can move on to the next tile.
133 if (!current_tile_ || !current_tile_->NeedsRaster()) 129 if (!tile || !tile->NeedsRaster())
134 continue; 130 continue;
135 131
136 // If the tile is occluded, we also can skip it. Note that we use the tiling 132 // If the tile is occluded, we also can skip it. Note that we use the tiling
137 // check for occlusion, since tile's internal state has not yet been updated 133 // check for occlusion, since tile's internal state has not yet been updated
138 // (by UpdateTilePriority). The tiling check does not rely on tile's 134 // (by UpdateTilePriority). The tiling check does not rely on tile's
139 // internal state (it is, in fact, used to determine the tile's state). 135 // internal state (it is, in fact, used to determine the tile's state).
140 if (tiling_->IsTileOccluded(current_tile_)) 136 if (tiling_->IsTileOccluded(tile))
141 continue; 137 continue;
142 138
143 // If we get here, that means we have a valid tile that needs raster and is 139 // If we get here, that means we have a valid tile that needs raster and is
144 // in the NOW bin, which means that it can be required. 140 // in the NOW bin, which means that it can be required.
145 break; 141 break;
146 } 142 }
147 143
148 if (current_tile_) 144 tiling_->UpdateRequiredStatesOnTile(tile);
149 tiling_->UpdateTilePriority(current_tile_); 145 current_tile_ = tiling_->MakePrioritizedTile(tile);
150 return *this; 146 return *this;
151 } 147 }
152 148
153 } // namespace cc 149 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tiling_set_raster_queue_required.h ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698