Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / tiles / raster_tile_priority_queue_required.cc
blobbccc34bc6c36e06f53febe9985797458c2790fa9
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/tiles/raster_tile_priority_queue_required.h"
7 #include "cc/tiles/tiling_set_raster_queue_required.h"
9 namespace cc {
11 namespace {
13 void AppendTilingSetRequiredQueues(
14 const std::vector<PictureLayerImpl*>& layers,
15 ScopedPtrVector<TilingSetRasterQueueRequired>* queues) {
16 for (auto* layer : layers) {
17 if (!layer->HasValidTilePriorities())
18 continue;
20 scoped_ptr<TilingSetRasterQueueRequired> tiling_set_queue(
21 new TilingSetRasterQueueRequired(
22 layer->picture_layer_tiling_set(),
23 RasterTilePriorityQueueRequired::Type::REQUIRED_FOR_ACTIVATION));
24 if (!tiling_set_queue->IsEmpty())
25 queues->push_back(tiling_set_queue.Pass());
29 } // namespace
31 RasterTilePriorityQueueRequired::RasterTilePriorityQueueRequired() {
34 RasterTilePriorityQueueRequired::~RasterTilePriorityQueueRequired() {
37 void RasterTilePriorityQueueRequired::Build(
38 const std::vector<PictureLayerImpl*>& active_layers,
39 const std::vector<PictureLayerImpl*>& pending_layers,
40 Type type) {
41 DCHECK_NE(static_cast<int>(type), static_cast<int>(Type::ALL));
42 if (type == Type::REQUIRED_FOR_DRAW)
43 BuildRequiredForDraw(active_layers);
44 else
45 BuildRequiredForActivation(active_layers, pending_layers);
48 void RasterTilePriorityQueueRequired::BuildRequiredForDraw(
49 const std::vector<PictureLayerImpl*>& active_layers) {
50 for (const auto& layer : active_layers) {
51 if (!layer->HasValidTilePriorities())
52 continue;
54 scoped_ptr<TilingSetRasterQueueRequired> tiling_set_queue(
55 new TilingSetRasterQueueRequired(layer->picture_layer_tiling_set(),
56 Type::REQUIRED_FOR_DRAW));
57 if (!tiling_set_queue->IsEmpty())
58 tiling_set_queues_.push_back(tiling_set_queue.Pass());
62 void RasterTilePriorityQueueRequired::BuildRequiredForActivation(
63 const std::vector<PictureLayerImpl*>& active_layers,
64 const std::vector<PictureLayerImpl*>& pending_layers) {
65 AppendTilingSetRequiredQueues(active_layers, &tiling_set_queues_);
66 AppendTilingSetRequiredQueues(pending_layers, &tiling_set_queues_);
69 bool RasterTilePriorityQueueRequired::IsEmpty() const {
70 return tiling_set_queues_.empty();
73 const PrioritizedTile& RasterTilePriorityQueueRequired::Top() const {
74 DCHECK(!IsEmpty());
75 return tiling_set_queues_.back()->Top();
78 void RasterTilePriorityQueueRequired::Pop() {
79 DCHECK(!IsEmpty());
80 tiling_set_queues_.back()->Pop();
81 if (tiling_set_queues_.back()->IsEmpty())
82 tiling_set_queues_.pop_back();
85 } // namespace cc