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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 if (layer->GetTree() == ACTIVE_TREE) { | 1232 if (layer->GetTree() == ACTIVE_TREE) { |
1233 DCHECK_IMPLIES(twin_layer, twin_layer->GetTree() == PENDING_TREE); | 1233 DCHECK_IMPLIES(twin_layer, twin_layer->GetTree() == PENDING_TREE); |
1234 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); | 1234 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); |
1235 } else if (!twin_layer) { | 1235 } else if (!twin_layer) { |
1236 DCHECK(layer->GetTree() == PENDING_TREE); | 1236 DCHECK(layer->GetTree() == PENDING_TREE); |
1237 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); | 1237 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); |
1238 } | 1238 } |
1239 } | 1239 } |
1240 } | 1240 } |
1241 | 1241 |
1242 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, | 1242 scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue( |
1243 TreePriority tree_priority, | 1243 TreePriority tree_priority, |
1244 RasterTilePriorityQueue::Type type) { | 1244 RasterTilePriorityQueue::Type type) { |
1245 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); | 1245 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); |
1246 picture_layer_pairs_.clear(); | 1246 picture_layer_pairs_.clear(); |
1247 GetPictureLayerImplPairs(&picture_layer_pairs_, true); | 1247 GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
1248 queue->Build(picture_layer_pairs_, tree_priority, type); | 1248 scoped_ptr<RasterTilePriorityQueue> queue(RasterTilePriorityQueue::Create( |
| 1249 picture_layer_pairs_, tree_priority, type)); |
1249 | 1250 |
1250 if (!queue->IsEmpty()) { | 1251 if (!queue->IsEmpty()) { |
1251 // Only checking the Top() tile here isn't a definite answer that there is | 1252 // Only checking the Top() tile here isn't a definite answer that there is |
1252 // or isn't something required for draw in this raster queue. It's just a | 1253 // or isn't something required for draw in this raster queue. It's just a |
1253 // heuristic to let us hit the common case and proactively tell the | 1254 // heuristic to let us hit the common case and proactively tell the |
1254 // scheduler that we expect to draw within each vsync until we get all the | 1255 // scheduler that we expect to draw within each vsync until we get all the |
1255 // tiles ready to draw. If we happen to miss a required for draw tile here, | 1256 // tiles ready to draw. If we happen to miss a required for draw tile here, |
1256 // then we will miss telling the scheduler each frame that we intend to draw | 1257 // then we will miss telling the scheduler each frame that we intend to draw |
1257 // so it may make worse scheduling decisions. | 1258 // so it may make worse scheduling decisions. |
1258 required_for_draw_tile_is_top_of_raster_queue_ = | 1259 required_for_draw_tile_is_top_of_raster_queue_ = |
1259 queue->Top()->required_for_draw(); | 1260 queue->Top()->required_for_draw(); |
1260 } else { | 1261 } else { |
1261 required_for_draw_tile_is_top_of_raster_queue_ = false; | 1262 required_for_draw_tile_is_top_of_raster_queue_ = false; |
1262 } | 1263 } |
| 1264 return queue; |
1263 } | 1265 } |
1264 | 1266 |
1265 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 1267 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
1266 TreePriority tree_priority) { | 1268 TreePriority tree_priority) { |
1267 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); | 1269 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); |
1268 picture_layer_pairs_.clear(); | 1270 picture_layer_pairs_.clear(); |
1269 GetPictureLayerImplPairs(&picture_layer_pairs_, false); | 1271 GetPictureLayerImplPairs(&picture_layer_pairs_, false); |
1270 queue->Build(picture_layer_pairs_, tree_priority); | 1272 queue->Build(picture_layer_pairs_, tree_priority); |
1271 } | 1273 } |
1272 | 1274 |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 } | 3509 } |
3508 | 3510 |
3509 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3511 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3510 std::vector<PictureLayerImpl*>::iterator it = | 3512 std::vector<PictureLayerImpl*>::iterator it = |
3511 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3513 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3512 DCHECK(it != picture_layers_.end()); | 3514 DCHECK(it != picture_layers_.end()); |
3513 picture_layers_.erase(it); | 3515 picture_layers_.erase(it); |
3514 } | 3516 } |
3515 | 3517 |
3516 } // namespace cc | 3518 } // namespace cc |
OLD | NEW |