| 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 | 1196 |
| 1197 scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue( | 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 scoped_ptr<RasterTilePriorityQueue> queue(RasterTilePriorityQueue::Create( | 1203 scoped_ptr<RasterTilePriorityQueue> queue(RasterTilePriorityQueue::Create( |
| 1204 picture_layer_pairs_, tree_priority, type)); | 1204 picture_layer_pairs_, tree_priority, type)); |
| 1205 | 1205 |
| 1206 if (!queue->IsEmpty()) { | 1206 // Only check whether the top tile is required for draw if we're not building |
| 1207 // Only checking the Top() tile here isn't a definite answer that there is | 1207 // a required for activation queue. |
| 1208 // or isn't something required for draw in this raster queue. It's just a | 1208 // TODO(vmpstr): Remove side-effects from this function. crbug.com/451147 |
| 1209 // heuristic to let us hit the common case and proactively tell the | 1209 if (type != RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION) { |
| 1210 // scheduler that we expect to draw within each vsync until we get all the | 1210 if (!queue->IsEmpty()) { |
| 1211 // tiles ready to draw. If we happen to miss a required for draw tile here, | 1211 // Only checking the Top() tile here isn't a definite answer that there is |
| 1212 // then we will miss telling the scheduler each frame that we intend to draw | 1212 // or isn't something required for draw in this raster queue. It's just a |
| 1213 // so it may make worse scheduling decisions. | 1213 // heuristic to let us hit the common case and proactively tell the |
| 1214 required_for_draw_tile_is_top_of_raster_queue_ = | 1214 // scheduler that we expect to draw within each vsync until we get all the |
| 1215 queue->Top()->required_for_draw(); | 1215 // tiles ready to draw. If we happen to miss a required for draw tile |
| 1216 } else { | 1216 // here, then we will miss telling the scheduler each frame that we intend |
| 1217 required_for_draw_tile_is_top_of_raster_queue_ = false; | 1217 // to draw so it may make worse scheduling decisions. |
| 1218 required_for_draw_tile_is_top_of_raster_queue_ = |
| 1219 queue->Top()->required_for_draw(); |
| 1220 } else { |
| 1221 required_for_draw_tile_is_top_of_raster_queue_ = false; |
| 1222 } |
| 1218 } | 1223 } |
| 1219 return queue; | 1224 return queue; |
| 1220 } | 1225 } |
| 1221 | 1226 |
| 1222 scoped_ptr<EvictionTilePriorityQueue> LayerTreeHostImpl::BuildEvictionQueue( | 1227 scoped_ptr<EvictionTilePriorityQueue> LayerTreeHostImpl::BuildEvictionQueue( |
| 1223 TreePriority tree_priority) { | 1228 TreePriority tree_priority) { |
| 1224 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); | 1229 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); |
| 1225 scoped_ptr<EvictionTilePriorityQueue> queue(new EvictionTilePriorityQueue); | 1230 scoped_ptr<EvictionTilePriorityQueue> queue(new EvictionTilePriorityQueue); |
| 1226 picture_layer_pairs_.clear(); | 1231 picture_layer_pairs_.clear(); |
| 1227 GetPictureLayerImplPairs(&picture_layer_pairs_, false); | 1232 GetPictureLayerImplPairs(&picture_layer_pairs_, false); |
| (...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3454 } | 3459 } |
| 3455 | 3460 |
| 3456 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3461 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3457 std::vector<PictureLayerImpl*>::iterator it = | 3462 std::vector<PictureLayerImpl*>::iterator it = |
| 3458 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3463 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3459 DCHECK(it != picture_layers_.end()); | 3464 DCHECK(it != picture_layers_.end()); |
| 3460 picture_layers_.erase(it); | 3465 picture_layers_.erase(it); |
| 3461 } | 3466 } |
| 3462 | 3467 |
| 3463 } // namespace cc | 3468 } // namespace cc |
| OLD | NEW |