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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 } | 1396 } |
1397 | 1397 |
1398 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1398 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1399 return !layer_tree_impl()->IsRecycleTree(); | 1399 return !layer_tree_impl()->IsRecycleTree(); |
1400 } | 1400 } |
1401 | 1401 |
1402 bool PictureLayerImpl::HasValidTilePriorities() const { | 1402 bool PictureLayerImpl::HasValidTilePriorities() const { |
1403 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1403 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1404 } | 1404 } |
1405 | 1405 |
1406 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1406 bool PictureLayerImpl::AllTilesRequiredAreReadyToDraw( |
1407 if (!layer_tree_impl()->IsPendingTree()) | 1407 TileRequirementCheck is_tile_required_callback) const { |
1408 return true; | |
1409 | |
1410 if (!HasValidTilePriorities()) | 1408 if (!HasValidTilePriorities()) |
1411 return true; | 1409 return true; |
1412 | 1410 |
1413 if (!tilings_) | 1411 if (!tilings_) |
1414 return true; | 1412 return true; |
1415 | 1413 |
1416 if (visible_rect_for_tile_priority_.IsEmpty()) | 1414 if (visible_rect_for_tile_priority_.IsEmpty()) |
1417 return true; | 1415 return true; |
1418 | 1416 |
1419 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 1417 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
(...skipping 11 matching lines...) Expand all Loading... |
1431 // A null tile (i.e. missing recording) can just be skipped. | 1429 // A null tile (i.e. missing recording) can just be skipped. |
1432 // TODO(vmpstr): Verify this is true if we create tiles in raster | 1430 // TODO(vmpstr): Verify this is true if we create tiles in raster |
1433 // iterators. | 1431 // iterators. |
1434 if (!tile) | 1432 if (!tile) |
1435 continue; | 1433 continue; |
1436 | 1434 |
1437 // We can't check tile->required_for_activation, because that value might | 1435 // We can't check tile->required_for_activation, because that value might |
1438 // be out of date. It is updated in the raster/eviction iterators. | 1436 // be out of date. It is updated in the raster/eviction iterators. |
1439 // TODO(vmpstr): Remove the comment once you can't access this information | 1437 // TODO(vmpstr): Remove the comment once you can't access this information |
1440 // from the tile. | 1438 // from the tile. |
1441 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) { | 1439 if ((tiling->*is_tile_required_callback)(tile) && |
1442 TRACE_EVENT_INSTANT0("cc", | 1440 !tile->IsReadyToDraw()) { |
1443 "PictureLayerImpl::" | 1441 TRACE_EVENT_INSTANT0("cc", "Tile required, but not ready to draw.", |
1444 "AllTilesRequiredForActivationAreReadyToDraw not " | |
1445 "ready to activate", | |
1446 TRACE_EVENT_SCOPE_THREAD); | 1442 TRACE_EVENT_SCOPE_THREAD); |
1447 return false; | 1443 return false; |
1448 } | 1444 } |
1449 } | 1445 } |
1450 } | 1446 } |
1451 | 1447 |
1452 return true; | 1448 return true; |
1453 } | 1449 } |
1454 | 1450 |
| 1451 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { |
| 1452 if (!layer_tree_impl()->IsPendingTree()) |
| 1453 return true; |
| 1454 |
| 1455 return AllTilesRequiredAreReadyToDraw( |
| 1456 &PictureLayerTiling::IsTileRequiredForActivationIfVisible); |
| 1457 } |
| 1458 |
| 1459 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
| 1460 if (!layer_tree_impl()->IsActiveTree()) |
| 1461 return true; |
| 1462 |
| 1463 return AllTilesRequiredAreReadyToDraw( |
| 1464 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
| 1465 } |
| 1466 |
1455 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1467 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
1456 : layer_(nullptr), current_stage_(arraysize(stages_)) { | 1468 : layer_(nullptr), current_stage_(arraysize(stages_)) { |
1457 } | 1469 } |
1458 | 1470 |
1459 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( | 1471 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( |
1460 PictureLayerImpl* layer, | 1472 PictureLayerImpl* layer, |
1461 bool prioritize_low_res) | 1473 bool prioritize_low_res) |
1462 : layer_(layer), current_stage_(0) { | 1474 : layer_(layer), current_stage_(0) { |
1463 DCHECK(layer_); | 1475 DCHECK(layer_); |
1464 | 1476 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1730 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1719 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1731 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1720 return tiling_range.end - 1 - current_tiling_range_offset; | 1732 return tiling_range.end - 1 - current_tiling_range_offset; |
1721 } | 1733 } |
1722 } | 1734 } |
1723 NOTREACHED(); | 1735 NOTREACHED(); |
1724 return 0; | 1736 return 0; |
1725 } | 1737 } |
1726 | 1738 |
1727 } // namespace cc | 1739 } // namespace cc |
OLD | NEW |