Chromium Code Reviews| 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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 tile_priorities_dirty_ = true; | 1258 tile_priorities_dirty_ = true; |
| 1259 client_->SetNeedsManageTilesOnImplThread(); | 1259 client_->SetNeedsManageTilesOnImplThread(); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 void LayerTreeHostImpl::DidInitializeVisibleTile() { | 1262 void LayerTreeHostImpl::DidInitializeVisibleTile() { |
| 1263 if (client_ && !client_->IsInsideDraw()) | 1263 if (client_ && !client_->IsInsideDraw()) |
| 1264 client_->DidInitializeVisibleTileOnImplThread(); | 1264 client_->DidInitializeVisibleTileOnImplThread(); |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 void LayerTreeHostImpl::GetPictureLayerImplPairs( | 1267 void LayerTreeHostImpl::GetPictureLayerImplPairs( |
| 1268 std::vector<PictureLayerImpl::Pair>* layer_pairs) const { | 1268 std::vector<PictureLayerImpl::Pair>* layer_pairs, |
| 1269 bool need_valid_tile_priorities) const { | |
| 1269 DCHECK(layer_pairs->empty()); | 1270 DCHECK(layer_pairs->empty()); |
| 1270 for (std::vector<PictureLayerImpl*>::const_iterator it = | 1271 for (std::vector<PictureLayerImpl*>::const_iterator it = |
| 1271 picture_layers_.begin(); | 1272 picture_layers_.begin(); |
| 1272 it != picture_layers_.end(); | 1273 it != picture_layers_.end(); |
| 1273 ++it) { | 1274 ++it) { |
| 1274 PictureLayerImpl* layer = *it; | 1275 PictureLayerImpl* layer = *it; |
| 1275 | 1276 |
| 1276 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704 | 1277 if (!layer->IsOnActiveOrPendingTree() || |
| 1277 if (!layer->HasValidTilePriorities()) | 1278 (need_valid_tile_priorities && !layer->HasValidTilePriorities())) |
| 1278 continue; | 1279 continue; |
| 1279 | 1280 |
| 1280 PictureLayerImpl* twin_layer = layer->GetPendingOrActiveTwinLayer(); | 1281 PictureLayerImpl* twin_layer = layer->GetPendingOrActiveTwinLayer(); |
| 1281 | 1282 |
| 1282 // Ignore the twin layer when tile priorities are invalid. | 1283 // Ignore the twin layer when tile priorities are invalid. |
| 1283 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704 | 1284 if (need_valid_tile_priorities && twin_layer && |
| 1284 if (twin_layer && !twin_layer->HasValidTilePriorities()) | 1285 !twin_layer->HasValidTilePriorities()) |
| 1285 twin_layer = NULL; | 1286 twin_layer = NULL; |
| 1286 | 1287 |
| 1287 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. | 1288 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. |
| 1288 // If current tree is PENDING_TREE, then only generate a layer_pair if | 1289 // If current tree is PENDING_TREE, then only generate a layer_pair if |
| 1289 // there is no twin layer. | 1290 // there is no twin layer. |
| 1290 if (layer->GetTree() == ACTIVE_TREE) { | 1291 if (layer->GetTree() == ACTIVE_TREE) { |
| 1291 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE); | 1292 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE); |
|
vmpstr
2014/11/04 18:15:16
while here, can you change this to DCHECK_IMPLIES(
USE eero AT chromium.org
2014/11/06 15:23:07
Done.
| |
| 1292 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); | 1293 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); |
| 1293 } else if (!twin_layer) { | 1294 } else if (!twin_layer) { |
| 1295 DCHECK(layer->GetTree() == PENDING_TREE); | |
| 1294 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); | 1296 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); |
| 1295 } | 1297 } |
| 1296 } | 1298 } |
| 1297 } | 1299 } |
| 1298 | 1300 |
| 1299 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, | 1301 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, |
| 1300 TreePriority tree_priority) { | 1302 TreePriority tree_priority) { |
| 1301 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); | 1303 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); |
| 1302 picture_layer_pairs_.clear(); | 1304 picture_layer_pairs_.clear(); |
| 1303 GetPictureLayerImplPairs(&picture_layer_pairs_); | 1305 GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
| 1304 queue->Build(picture_layer_pairs_, tree_priority); | 1306 queue->Build(picture_layer_pairs_, tree_priority); |
| 1305 } | 1307 } |
| 1306 | 1308 |
| 1307 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 1309 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
| 1308 TreePriority tree_priority) { | 1310 TreePriority tree_priority) { |
| 1309 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); | 1311 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); |
| 1310 picture_layer_pairs_.clear(); | 1312 picture_layer_pairs_.clear(); |
| 1311 GetPictureLayerImplPairs(&picture_layer_pairs_); | 1313 GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
|
vmpstr
2014/11/04 18:15:16
false here?
USE eero AT chromium.org
2014/11/06 15:23:07
Yes.
| |
| 1312 queue->Build(picture_layer_pairs_, tree_priority); | 1314 queue->Build(picture_layer_pairs_, tree_priority); |
| 1313 } | 1315 } |
| 1314 | 1316 |
| 1315 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() | 1317 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() |
| 1316 const { | 1318 const { |
| 1317 return picture_layers_; | 1319 return picture_layers_; |
| 1318 } | 1320 } |
| 1319 | 1321 |
| 1320 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1322 void LayerTreeHostImpl::NotifyReadyToActivate() { |
| 1321 client_->NotifyReadyToActivate(); | 1323 client_->NotifyReadyToActivate(); |
| (...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3514 } | 3516 } |
| 3515 | 3517 |
| 3516 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3518 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3517 std::vector<PictureLayerImpl*>::iterator it = | 3519 std::vector<PictureLayerImpl*>::iterator it = |
| 3518 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3520 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3519 DCHECK(it != picture_layers_.end()); | 3521 DCHECK(it != picture_layers_.end()); |
| 3520 picture_layers_.erase(it); | 3522 picture_layers_.erase(it); |
| 3521 } | 3523 } |
| 3522 | 3524 |
| 3523 } // namespace cc | 3525 } // namespace cc |
| OLD | NEW |