OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1352 } | 1352 } |
1353 | 1353 |
1354 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1354 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1355 return !layer_tree_impl()->IsRecycleTree(); | 1355 return !layer_tree_impl()->IsRecycleTree(); |
1356 } | 1356 } |
1357 | 1357 |
1358 bool PictureLayerImpl::HasValidTilePriorities() const { | 1358 bool PictureLayerImpl::HasValidTilePriorities() const { |
1359 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1359 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1360 } | 1360 } |
1361 | 1361 |
1362 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1362 bool PictureLayerImpl::AllTilesRequiredAreReadyToDraw( |
1363 TRACE_EVENT0("cc", | 1363 const base::Callback<bool(PictureLayerTiling* tiling, const Tile*)>& |
danakj
2014/10/31 17:00:57
Can you give this callback type a name somewhere,
danakj
2014/10/31 18:41:31
ignore this comment :)
| |
1364 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | 1364 is_tile_required_callback) const { |
1365 if (!layer_tree_impl()->IsPendingTree()) | |
1366 return true; | |
1367 | |
1368 if (!HasValidTilePriorities()) | 1365 if (!HasValidTilePriorities()) |
1369 return true; | 1366 return true; |
1370 | 1367 |
1371 if (!tilings_) | 1368 if (!tilings_) |
1372 return true; | 1369 return true; |
1373 | 1370 |
1374 if (visible_rect_for_tile_priority_.IsEmpty()) | 1371 if (visible_rect_for_tile_priority_.IsEmpty()) |
1375 return true; | 1372 return true; |
1376 | 1373 |
1377 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 1374 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
(...skipping 11 matching lines...) Expand all Loading... | |
1389 // A null tile (i.e. missing recording) can just be skipped. | 1386 // A null tile (i.e. missing recording) can just be skipped. |
1390 // TODO(vmpstr): Verify this is true if we create tiles in raster | 1387 // TODO(vmpstr): Verify this is true if we create tiles in raster |
1391 // iterators. | 1388 // iterators. |
1392 if (!tile) | 1389 if (!tile) |
1393 continue; | 1390 continue; |
1394 | 1391 |
1395 // We can't check tile->required_for_activation, because that value might | 1392 // We can't check tile->required_for_activation, because that value might |
1396 // be out of date. It is updated in the raster/eviction iterators. | 1393 // be out of date. It is updated in the raster/eviction iterators. |
1397 // TODO(vmpstr): Remove the comment once you can't access this information | 1394 // TODO(vmpstr): Remove the comment once you can't access this information |
1398 // from the tile. | 1395 // from the tile. |
1399 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) { | 1396 if (is_tile_required_callback.Run(tiling, tile) && |
1397 !tile->IsReadyToDraw()) { | |
1400 TRACE_EVENT_INSTANT0("cc", | 1398 TRACE_EVENT_INSTANT0("cc", |
1401 "PictureLayerImpl::" | 1399 "Tile required, but not ready to draw.", |
1402 "AllTilesRequiredForActivationAreReadyToDraw not " | |
1403 "ready to activate", | |
1404 TRACE_EVENT_SCOPE_THREAD); | 1400 TRACE_EVENT_SCOPE_THREAD); |
1405 return false; | 1401 return false; |
1406 } | 1402 } |
1407 } | 1403 } |
1408 } | 1404 } |
1409 | 1405 |
1410 return true; | 1406 return true; |
1411 } | 1407 } |
1412 | 1408 |
1409 namespace { | |
1410 bool IsTileRequiredForActivationIfVisible(PictureLayerTiling* tiling, | |
1411 const Tile* tile) { | |
1412 return tiling->IsTileRequiredForActivationIfVisible(tile); | |
1413 } | |
1414 | |
1415 bool IsTileRequiredForDrawIfVisible(PictureLayerTiling* tiling, | |
1416 const Tile* tile) { | |
1417 return tiling->IsTileRequiredForDrawIfVisible(tile); | |
1418 } | |
1419 } // namespace | |
1420 | |
1421 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | |
1422 TRACE_EVENT0("cc", | |
1423 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | |
1424 | |
1425 if (!layer_tree_impl()->IsPendingTree()) | |
1426 return true; | |
1427 | |
1428 return AllTilesRequiredAreReadyToDraw( | |
1429 base::Bind(&IsTileRequiredForActivationIfVisible)); | |
danakj
2014/10/31 17:00:57
this seems like a functor (function pointer) would
ernstm
2014/11/03 22:34:41
Done.
| |
1430 } | |
1431 | |
1432 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | |
1433 TRACE_EVENT0("cc", "PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw"); | |
1434 | |
1435 if (!layer_tree_impl()->IsActiveTree()) | |
1436 return true; | |
1437 | |
1438 return AllTilesRequiredAreReadyToDraw( | |
1439 base::Bind(&IsTileRequiredForDrawIfVisible)); | |
1440 } | |
1441 | |
1413 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1442 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
1414 : layer_(nullptr), current_stage_(arraysize(stages_)) { | 1443 : layer_(nullptr), current_stage_(arraysize(stages_)) { |
1415 } | 1444 } |
1416 | 1445 |
1417 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( | 1446 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( |
1418 PictureLayerImpl* layer, | 1447 PictureLayerImpl* layer, |
1419 bool prioritize_low_res) | 1448 bool prioritize_low_res) |
1420 : layer_(layer), current_stage_(0) { | 1449 : layer_(layer), current_stage_(0) { |
1421 DCHECK(layer_); | 1450 DCHECK(layer_); |
1422 | 1451 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1705 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1677 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1706 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1678 return tiling_range.end - 1 - current_tiling_range_offset; | 1707 return tiling_range.end - 1 - current_tiling_range_offset; |
1679 } | 1708 } |
1680 } | 1709 } |
1681 NOTREACHED(); | 1710 NOTREACHED(); |
1682 return 0; | 1711 return 0; |
1683 } | 1712 } |
1684 | 1713 |
1685 } // namespace cc | 1714 } // namespace cc |
OLD | NEW |