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