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 27 matching lines...) Expand all Loading... |
38 #include "cc/layers/scrollbar_layer_impl_base.h" | 38 #include "cc/layers/scrollbar_layer_impl_base.h" |
39 #include "cc/output/compositor_frame_metadata.h" | 39 #include "cc/output/compositor_frame_metadata.h" |
40 #include "cc/output/copy_output_request.h" | 40 #include "cc/output/copy_output_request.h" |
41 #include "cc/output/delegating_renderer.h" | 41 #include "cc/output/delegating_renderer.h" |
42 #include "cc/output/gl_renderer.h" | 42 #include "cc/output/gl_renderer.h" |
43 #include "cc/output/software_renderer.h" | 43 #include "cc/output/software_renderer.h" |
44 #include "cc/quads/render_pass_draw_quad.h" | 44 #include "cc/quads/render_pass_draw_quad.h" |
45 #include "cc/quads/shared_quad_state.h" | 45 #include "cc/quads/shared_quad_state.h" |
46 #include "cc/quads/solid_color_draw_quad.h" | 46 #include "cc/quads/solid_color_draw_quad.h" |
47 #include "cc/quads/texture_draw_quad.h" | 47 #include "cc/quads/texture_draw_quad.h" |
| 48 #include "cc/resources/eviction_tile_priority_queue.h" |
48 #include "cc/resources/gpu_raster_worker_pool.h" | 49 #include "cc/resources/gpu_raster_worker_pool.h" |
49 #include "cc/resources/image_copy_raster_worker_pool.h" | 50 #include "cc/resources/image_copy_raster_worker_pool.h" |
50 #include "cc/resources/image_raster_worker_pool.h" | 51 #include "cc/resources/image_raster_worker_pool.h" |
51 #include "cc/resources/memory_history.h" | 52 #include "cc/resources/memory_history.h" |
52 #include "cc/resources/picture_layer_tiling.h" | 53 #include "cc/resources/picture_layer_tiling.h" |
53 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 54 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
54 #include "cc/resources/prioritized_resource_manager.h" | 55 #include "cc/resources/prioritized_resource_manager.h" |
| 56 #include "cc/resources/raster_tile_priority_queue.h" |
55 #include "cc/resources/raster_worker_pool.h" | 57 #include "cc/resources/raster_worker_pool.h" |
56 #include "cc/resources/resource_pool.h" | 58 #include "cc/resources/resource_pool.h" |
57 #include "cc/resources/texture_mailbox_deleter.h" | 59 #include "cc/resources/texture_mailbox_deleter.h" |
58 #include "cc/resources/ui_resource_bitmap.h" | 60 #include "cc/resources/ui_resource_bitmap.h" |
59 #include "cc/scheduler/delay_based_time_source.h" | 61 #include "cc/scheduler/delay_based_time_source.h" |
60 #include "cc/trees/damage_tracker.h" | 62 #include "cc/trees/damage_tracker.h" |
61 #include "cc/trees/layer_tree_host.h" | 63 #include "cc/trees/layer_tree_host.h" |
62 #include "cc/trees/layer_tree_host_common.h" | 64 #include "cc/trees/layer_tree_host_common.h" |
63 #include "cc/trees/layer_tree_impl.h" | 65 #include "cc/trees/layer_tree_impl.h" |
64 #include "cc/trees/occlusion_tracker.h" | 66 #include "cc/trees/occlusion_tracker.h" |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 // Mark priorities as dirty and schedule a ManageTiles(). | 1241 // Mark priorities as dirty and schedule a ManageTiles(). |
1240 tile_priorities_dirty_ = true; | 1242 tile_priorities_dirty_ = true; |
1241 client_->SetNeedsManageTilesOnImplThread(); | 1243 client_->SetNeedsManageTilesOnImplThread(); |
1242 } | 1244 } |
1243 | 1245 |
1244 void LayerTreeHostImpl::DidInitializeVisibleTile() { | 1246 void LayerTreeHostImpl::DidInitializeVisibleTile() { |
1245 if (client_ && !client_->IsInsideDraw()) | 1247 if (client_ && !client_->IsInsideDraw()) |
1246 client_->DidInitializeVisibleTileOnImplThread(); | 1248 client_->DidInitializeVisibleTileOnImplThread(); |
1247 } | 1249 } |
1248 | 1250 |
1249 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() { | 1251 void LayerTreeHostImpl::GetPictureLayerImplPairs( |
| 1252 std::vector<PictureLayerImpl::Pair>* layer_pairs) const { |
| 1253 DCHECK(layer_pairs->empty()); |
| 1254 for (std::vector<PictureLayerImpl*>::const_iterator it = |
| 1255 picture_layers_.begin(); |
| 1256 it != picture_layers_.end(); |
| 1257 ++it) { |
| 1258 PictureLayerImpl* layer = *it; |
| 1259 |
| 1260 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704 |
| 1261 if (!layer->HasValidTilePriorities()) |
| 1262 continue; |
| 1263 |
| 1264 PictureLayerImpl* twin_layer = layer->GetTwinLayer(); |
| 1265 |
| 1266 // Ignore the twin layer when tile priorities are invalid. |
| 1267 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704 |
| 1268 if (twin_layer && !twin_layer->HasValidTilePriorities()) |
| 1269 twin_layer = NULL; |
| 1270 |
| 1271 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. |
| 1272 // If current tree is PENDING_TREE, then only generate a layer_pair if |
| 1273 // there is no twin layer. |
| 1274 if (layer->GetTree() == ACTIVE_TREE) { |
| 1275 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE); |
| 1276 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); |
| 1277 } else if (!twin_layer) { |
| 1278 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); |
| 1279 } |
| 1280 } |
| 1281 } |
| 1282 |
| 1283 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, |
| 1284 TreePriority tree_priority) { |
| 1285 picture_layer_pairs_.clear(); |
| 1286 GetPictureLayerImplPairs(&picture_layer_pairs_); |
| 1287 queue->Build(picture_layer_pairs_, tree_priority); |
| 1288 } |
| 1289 |
| 1290 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
| 1291 TreePriority tree_priority) { |
| 1292 picture_layer_pairs_.clear(); |
| 1293 GetPictureLayerImplPairs(&picture_layer_pairs_); |
| 1294 queue->Build(picture_layer_pairs_, tree_priority); |
| 1295 } |
| 1296 |
| 1297 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() |
| 1298 const { |
1250 return picture_layers_; | 1299 return picture_layers_; |
1251 } | 1300 } |
1252 | 1301 |
1253 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1302 void LayerTreeHostImpl::NotifyReadyToActivate() { |
1254 client_->NotifyReadyToActivate(); | 1303 client_->NotifyReadyToActivate(); |
1255 } | 1304 } |
1256 | 1305 |
1257 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { | 1306 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { |
1258 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); | 1307 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); |
1259 | 1308 |
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 } | 3290 } |
3242 | 3291 |
3243 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3292 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3244 std::vector<PictureLayerImpl*>::iterator it = | 3293 std::vector<PictureLayerImpl*>::iterator it = |
3245 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3294 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3246 DCHECK(it != picture_layers_.end()); | 3295 DCHECK(it != picture_layers_.end()); |
3247 picture_layers_.erase(it); | 3296 picture_layers_.erase(it); |
3248 } | 3297 } |
3249 | 3298 |
3250 } // namespace cc | 3299 } // namespace cc |
OLD | NEW |