1 // Copyright 2015 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 #include "cc/resources/raster_tile_priority_queue_required.h"
7 #include "cc/resources/tiling_set_raster_queue_required.h"
11 RasterTilePriorityQueueRequired::RasterTilePriorityQueueRequired() {
14 RasterTilePriorityQueueRequired::~RasterTilePriorityQueueRequired() {
17 void RasterTilePriorityQueueRequired::Build(
18 const std::vector
<PictureLayerImpl::Pair
>& paired_layers
,
20 DCHECK_NE(static_cast<int>(type
), static_cast<int>(Type::ALL
));
21 for (const auto& pair
: paired_layers
) {
22 PictureLayerTilingSet
* tiling_set
= nullptr;
23 if (type
== Type::REQUIRED_FOR_DRAW
&& pair
.active
)
24 tiling_set
= pair
.active
->picture_layer_tiling_set();
25 else if (type
== Type::REQUIRED_FOR_ACTIVATION
&& pair
.pending
)
26 tiling_set
= pair
.pending
->picture_layer_tiling_set();
31 scoped_ptr
<TilingSetRasterQueueRequired
> tiling_set_queue(
32 new TilingSetRasterQueueRequired(tiling_set
, type
));
33 if (tiling_set_queue
->IsEmpty())
35 tiling_set_queues_
.push_back(tiling_set_queue
.Pass());
39 bool RasterTilePriorityQueueRequired::IsEmpty() const {
40 return tiling_set_queues_
.empty();
43 Tile
* RasterTilePriorityQueueRequired::Top() {
45 return tiling_set_queues_
.back()->Top();
48 void RasterTilePriorityQueueRequired::Pop() {
50 tiling_set_queues_
.back()->Pop();
51 if (tiling_set_queues_
.back()->IsEmpty())
52 tiling_set_queues_
.pop_back();