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

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

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2011 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.
4
5 #include "cc/resources/tile_priority_queue.h"
6
7 #include <vector>
8
9 #include "cc/layers/picture_layer_impl.h"
10
11 namespace cc {
12
13 TilePriorityQueue::PairedPictureLayer::PairedPictureLayer()
14 : active_layer(NULL), pending_layer(NULL) {
15 }
16
17 TilePriorityQueue::PairedPictureLayer::~PairedPictureLayer() {
18 }
19
20 TilePriorityQueue::~TilePriorityQueue() {
21 }
22
23 void TilePriorityQueue::GetPairedPictureLayers(
24 const std::vector<PictureLayerImpl*>& layers,
25 std::vector<PairedPictureLayer>* paired_layers) const {
26 DCHECK(paired_layers);
27 DCHECK(paired_layers->empty());
28
29 for (std::vector<PictureLayerImpl*>::const_iterator it = layers.begin();
30 it != layers.end();
31 ++it) {
32 PictureLayerImpl* layer = *it;
33
34 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
35 if (!layer->HasValidTilePriorities())
36 continue;
37
38 PictureLayerImpl* twin_layer = layer->GetTwinLayer();
39
40 // Ignore the twin layer when tile priorities are invalid.
41 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
42 if (twin_layer && !twin_layer->HasValidTilePriorities())
43 twin_layer = NULL;
44
45 PairedPictureLayer paired_layer;
46 WhichTree tree = layer->GetTree();
47
48 // If the current tree is ACTIVE_TREE, then always generate a paired_layer.
49 // If current tree is PENDING_TREE, then only generate a paired_layer if
50 // there is no twin layer.
51 if (tree == ACTIVE_TREE) {
52 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE);
53 paired_layer.active_layer = layer;
54 paired_layer.pending_layer = twin_layer;
55 paired_layers->push_back(paired_layer);
56 } else if (!twin_layer) {
57 paired_layer.active_layer = NULL;
58 paired_layer.pending_layer = layer;
59 paired_layers->push_back(paired_layer);
60 }
61 }
62 }
63
64 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698