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

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

Issue 816453008: cc: Split tiling set raster queues into all and required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 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
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.h" 5 #include "cc/resources/tiling_set_raster_queue_all.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 TilingSetRasterQueue::TilingSetRasterQueue() 9 TilingSetRasterQueueAll::TilingSetRasterQueueAll(
10 : tiling_set_(nullptr), current_stage_(arraysize(stages_)) { 10 PictureLayerTilingSet* tiling_set,
11 } 11 bool prioritize_low_res)
12
13 TilingSetRasterQueue::TilingSetRasterQueue(PictureLayerTilingSet* tiling_set,
14 bool prioritize_low_res)
15 : tiling_set_(tiling_set), current_stage_(0) { 12 : tiling_set_(tiling_set), current_stage_(0) {
16 DCHECK(tiling_set_); 13 DCHECK(tiling_set_);
17 14
18 // Early out if the tiling set has no tilings. 15 // Early out if the tiling set has no tilings.
19 if (!tiling_set_->num_tilings()) { 16 if (!tiling_set_->num_tilings()) {
20 current_stage_ = arraysize(stages_); 17 current_stage_ = arraysize(stages_);
21 return; 18 return;
22 } 19 }
23 20
24 // Find high and low res tilings and initialize the iterators. 21 // Find high and low res tilings and initialize the iterators.
(...skipping 29 matching lines...) Expand all
54 51
55 stages_[3].iterator_type = HIGH_RES; 52 stages_[3].iterator_type = HIGH_RES;
56 stages_[3].tile_type = TilePriority::EVENTUALLY; 53 stages_[3].tile_type = TilePriority::EVENTUALLY;
57 54
58 IteratorType index = stages_[current_stage_].iterator_type; 55 IteratorType index = stages_[current_stage_].iterator_type;
59 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; 56 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type;
60 if (!iterators_[index] || iterators_[index].get_type() != tile_type) 57 if (!iterators_[index] || iterators_[index].get_type() != tile_type)
61 AdvanceToNextStage(); 58 AdvanceToNextStage();
62 } 59 }
63 60
64 TilingSetRasterQueue::~TilingSetRasterQueue() { 61 TilingSetRasterQueueAll::~TilingSetRasterQueueAll() {
65 } 62 }
66 63
67 bool TilingSetRasterQueue::IsEmpty() const { 64 bool TilingSetRasterQueueAll::IsEmpty() const {
68 return current_stage_ >= arraysize(stages_); 65 return current_stage_ >= arraysize(stages_);
69 } 66 }
70 67
71 void TilingSetRasterQueue::Pop() { 68 void TilingSetRasterQueueAll::Pop() {
72 IteratorType index = stages_[current_stage_].iterator_type; 69 IteratorType index = stages_[current_stage_].iterator_type;
73 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; 70 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type;
74 71
75 // First advance the iterator. 72 // First advance the iterator.
76 DCHECK(iterators_[index]); 73 DCHECK(iterators_[index]);
77 DCHECK(iterators_[index].get_type() == tile_type); 74 DCHECK(iterators_[index].get_type() == tile_type);
78 ++iterators_[index]; 75 ++iterators_[index];
79 76
80 if (!iterators_[index] || iterators_[index].get_type() != tile_type) 77 if (!iterators_[index] || iterators_[index].get_type() != tile_type)
81 AdvanceToNextStage(); 78 AdvanceToNextStage();
82 } 79 }
83 80
84 Tile* TilingSetRasterQueue::Top() { 81 Tile* TilingSetRasterQueueAll::Top() {
85 DCHECK(!IsEmpty()); 82 DCHECK(!IsEmpty());
86 83
87 IteratorType index = stages_[current_stage_].iterator_type; 84 IteratorType index = stages_[current_stage_].iterator_type;
88 DCHECK(iterators_[index]); 85 DCHECK(iterators_[index]);
89 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); 86 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type);
90 87
91 return *iterators_[index]; 88 return *iterators_[index];
92 } 89 }
93 90
94 const Tile* TilingSetRasterQueue::Top() const { 91 const Tile* TilingSetRasterQueueAll::Top() const {
95 DCHECK(!IsEmpty()); 92 DCHECK(!IsEmpty());
96 93
97 IteratorType index = stages_[current_stage_].iterator_type; 94 IteratorType index = stages_[current_stage_].iterator_type;
98 DCHECK(iterators_[index]); 95 DCHECK(iterators_[index]);
99 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); 96 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type);
100 97
101 return *iterators_[index]; 98 return *iterators_[index];
102 } 99 }
103 100
104 void TilingSetRasterQueue::AdvanceToNextStage() { 101 void TilingSetRasterQueueAll::AdvanceToNextStage() {
105 DCHECK_LT(current_stage_, arraysize(stages_)); 102 DCHECK_LT(current_stage_, arraysize(stages_));
106 ++current_stage_; 103 ++current_stage_;
107 while (current_stage_ < arraysize(stages_)) { 104 while (current_stage_ < arraysize(stages_)) {
108 IteratorType index = stages_[current_stage_].iterator_type; 105 IteratorType index = stages_[current_stage_].iterator_type;
109 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; 106 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type;
110 107
111 if (iterators_[index] && iterators_[index].get_type() == tile_type) 108 if (iterators_[index] && iterators_[index].get_type() == tile_type)
112 break; 109 break;
113 ++current_stage_; 110 ++current_stage_;
114 } 111 }
115 } 112 }
116 113
117 } // namespace cc 114 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698