OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 if (layer->GetTree() == ACTIVE_TREE) { | 1187 if (layer->GetTree() == ACTIVE_TREE) { |
1188 DCHECK_IMPLIES(twin_layer, twin_layer->GetTree() == PENDING_TREE); | 1188 DCHECK_IMPLIES(twin_layer, twin_layer->GetTree() == PENDING_TREE); |
1189 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); | 1189 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); |
1190 } else if (!twin_layer) { | 1190 } else if (!twin_layer) { |
1191 DCHECK(layer->GetTree() == PENDING_TREE); | 1191 DCHECK(layer->GetTree() == PENDING_TREE); |
1192 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); | 1192 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); |
1193 } | 1193 } |
1194 } | 1194 } |
1195 } | 1195 } |
1196 | 1196 |
1197 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, | 1197 scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue( |
1198 TreePriority tree_priority, | 1198 TreePriority tree_priority, |
1199 RasterTilePriorityQueue::Type type) { | 1199 RasterTilePriorityQueue::Type type) { |
1200 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); | 1200 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); |
1201 picture_layer_pairs_.clear(); | 1201 picture_layer_pairs_.clear(); |
1202 GetPictureLayerImplPairs(&picture_layer_pairs_, true); | 1202 GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
1203 queue->Build(picture_layer_pairs_, tree_priority, type); | 1203 scoped_ptr<RasterTilePriorityQueue> queue(RasterTilePriorityQueue::Create( |
| 1204 picture_layer_pairs_, tree_priority, type)); |
1204 | 1205 |
1205 if (!queue->IsEmpty()) { | 1206 if (!queue->IsEmpty()) { |
1206 // Only checking the Top() tile here isn't a definite answer that there is | 1207 // Only checking the Top() tile here isn't a definite answer that there is |
1207 // or isn't something required for draw in this raster queue. It's just a | 1208 // or isn't something required for draw in this raster queue. It's just a |
1208 // heuristic to let us hit the common case and proactively tell the | 1209 // heuristic to let us hit the common case and proactively tell the |
1209 // scheduler that we expect to draw within each vsync until we get all the | 1210 // scheduler that we expect to draw within each vsync until we get all the |
1210 // tiles ready to draw. If we happen to miss a required for draw tile here, | 1211 // tiles ready to draw. If we happen to miss a required for draw tile here, |
1211 // then we will miss telling the scheduler each frame that we intend to draw | 1212 // then we will miss telling the scheduler each frame that we intend to draw |
1212 // so it may make worse scheduling decisions. | 1213 // so it may make worse scheduling decisions. |
1213 required_for_draw_tile_is_top_of_raster_queue_ = | 1214 required_for_draw_tile_is_top_of_raster_queue_ = |
1214 queue->Top()->required_for_draw(); | 1215 queue->Top()->required_for_draw(); |
1215 } else { | 1216 } else { |
1216 required_for_draw_tile_is_top_of_raster_queue_ = false; | 1217 required_for_draw_tile_is_top_of_raster_queue_ = false; |
1217 } | 1218 } |
| 1219 return queue; |
1218 } | 1220 } |
1219 | 1221 |
1220 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 1222 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
1221 TreePriority tree_priority) { | 1223 TreePriority tree_priority) { |
1222 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); | 1224 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); |
1223 picture_layer_pairs_.clear(); | 1225 picture_layer_pairs_.clear(); |
1224 GetPictureLayerImplPairs(&picture_layer_pairs_, false); | 1226 GetPictureLayerImplPairs(&picture_layer_pairs_, false); |
1225 queue->Build(picture_layer_pairs_, tree_priority); | 1227 queue->Build(picture_layer_pairs_, tree_priority); |
1226 } | 1228 } |
1227 | 1229 |
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 } | 3458 } |
3457 | 3459 |
3458 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3460 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3459 std::vector<PictureLayerImpl*>::iterator it = | 3461 std::vector<PictureLayerImpl*>::iterator it = |
3460 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3462 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3461 DCHECK(it != picture_layers_.end()); | 3463 DCHECK(it != picture_layers_.end()); |
3462 picture_layers_.erase(it); | 3464 picture_layers_.erase(it); |
3463 } | 3465 } |
3464 | 3466 |
3465 } // namespace cc | 3467 } // namespace cc |
OLD | NEW |