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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 406543003: cc: Change TileManager iterators to be queues. (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
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
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
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 layer_pairs->clear();
reveman 2014/07/19 00:45:50 Let's make this the responsibility of the caller i
vmpstr 2014/07/20 01:15:04 Done.
1254 // Reserve a maximum possible paired layers.
1255 layer_pairs->reserve(picture_layers_.size());
reveman 2014/07/19 00:45:50 Please have the caller reuse the same vector inste
vmpstr 2014/07/20 01:15:04 Done.
1256
1257 for (std::vector<PictureLayerImpl*>::const_iterator it =
1258 picture_layers_.begin();
1259 it != picture_layers_.end();
1260 ++it) {
1261 PictureLayerImpl* layer = *it;
1262
1263 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
1264 if (!layer->HasValidTilePriorities())
1265 continue;
1266
1267 PictureLayerImpl* twin_layer = layer->GetTwinLayer();
1268
1269 // Ignore the twin layer when tile priorities are invalid.
1270 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
1271 if (twin_layer && !twin_layer->HasValidTilePriorities())
1272 twin_layer = NULL;
1273
1274 PictureLayerImpl::Pair layer_pair;
reveman 2014/07/19 00:45:50 This temporary variable seem unnecessary. How abou
vmpstr 2014/07/20 01:15:04 Done.
1275 WhichTree tree = layer->GetTree();
reveman 2014/07/19 00:45:50 this temporary variable seem unnecessary too
vmpstr 2014/07/20 01:15:04 Done.
1276
1277 // If the current tree is ACTIVE_TREE, then always generate a layer_pair.
1278 // If current tree is PENDING_TREE, then only generate a layer_pair if
1279 // there is no twin layer.
1280 if (tree == ACTIVE_TREE) {
1281 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE);
1282 layer_pair.active = layer;
1283 layer_pair.pending = twin_layer;
1284 layer_pairs->push_back(layer_pair);
1285 } else if (!twin_layer) {
1286 layer_pair.active = NULL;
1287 layer_pair.pending = layer;
1288 layer_pairs->push_back(layer_pair);
1289 }
1290 }
1291 }
1292
1293 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue,
1294 TreePriority tree_priority) {
1295 std::vector<PictureLayerImpl::Pair> layer_pairs;
1296 GetPictureLayerImplPairs(&layer_pairs);
1297 queue->Build(layer_pairs, tree_priority);
1298 }
1299
1300 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue,
1301 TreePriority tree_priority) {
1302 std::vector<PictureLayerImpl::Pair> layer_pairs;
1303 GetPictureLayerImplPairs(&layer_pairs);
1304 queue->Build(layer_pairs, tree_priority);
1305 }
1306
1307 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers()
1308 const {
1250 return picture_layers_; 1309 return picture_layers_;
1251 } 1310 }
1252 1311
1253 void LayerTreeHostImpl::NotifyReadyToActivate() { 1312 void LayerTreeHostImpl::NotifyReadyToActivate() {
1254 client_->NotifyReadyToActivate(); 1313 client_->NotifyReadyToActivate();
1255 } 1314 }
1256 1315
1257 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { 1316 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) {
1258 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); 1317 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged");
1259 1318
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
3241 } 3300 }
3242 3301
3243 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3302 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3244 std::vector<PictureLayerImpl*>::iterator it = 3303 std::vector<PictureLayerImpl*>::iterator it =
3245 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3304 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3246 DCHECK(it != picture_layers_.end()); 3305 DCHECK(it != picture_layers_.end());
3247 picture_layers_.erase(it); 3306 picture_layers_.erase(it);
3248 } 3307 }
3249 3308
3250 } // namespace cc 3309 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698