Chromium Code Reviews| 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 template <typename F> |
|
vmpstr
2014/11/03 23:07:00
nit: I think F == bool (*)(PictureLayerTiling*, co
ernstm
2014/11/04 00:21:55
Done. This is what I originally wanted to do, but
| |
| 1409 TRACE_EVENT0("cc", | 1409 bool PictureLayerImpl::AllTilesRequiredAreReadyToDraw( |
| 1410 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | 1410 const F& is_tile_required_callback) const { |
| 1411 if (!layer_tree_impl()->IsPendingTree()) | |
| 1412 return true; | |
| 1413 | |
| 1414 if (!HasValidTilePriorities()) | 1411 if (!HasValidTilePriorities()) |
| 1415 return true; | 1412 return true; |
| 1416 | 1413 |
| 1417 if (!tilings_) | 1414 if (!tilings_) |
| 1418 return true; | 1415 return true; |
| 1419 | 1416 |
| 1420 if (visible_rect_for_tile_priority_.IsEmpty()) | 1417 if (visible_rect_for_tile_priority_.IsEmpty()) |
| 1421 return true; | 1418 return true; |
| 1422 | 1419 |
| 1423 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 1420 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1435 // A null tile (i.e. missing recording) can just be skipped. | 1432 // A null tile (i.e. missing recording) can just be skipped. |
| 1436 // TODO(vmpstr): Verify this is true if we create tiles in raster | 1433 // TODO(vmpstr): Verify this is true if we create tiles in raster |
| 1437 // iterators. | 1434 // iterators. |
| 1438 if (!tile) | 1435 if (!tile) |
| 1439 continue; | 1436 continue; |
| 1440 | 1437 |
| 1441 // We can't check tile->required_for_activation, because that value might | 1438 // 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. | 1439 // 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 | 1440 // TODO(vmpstr): Remove the comment once you can't access this information |
| 1444 // from the tile. | 1441 // from the tile. |
| 1445 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) { | 1442 if (is_tile_required_callback(tiling, tile) && !tile->IsReadyToDraw()) { |
| 1446 TRACE_EVENT_INSTANT0("cc", | 1443 TRACE_EVENT_INSTANT0("cc", "Tile required, but not ready to draw.", |
| 1447 "PictureLayerImpl::" | |
| 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 namespace { | |
|
vmpstr
2014/11/03 23:07:00
nit: I prefer anonymous namespace to be at the top
ernstm
2014/11/04 00:21:55
Done.
| |
| 1454 bool IsTileRequiredForActivationIfVisible(PictureLayerTiling* tiling, | |
| 1455 const Tile* tile) { | |
| 1456 return tiling->IsTileRequiredForActivationIfVisible(tile); | |
| 1457 } | |
| 1458 | |
| 1459 bool IsTileRequiredForDrawIfVisible(PictureLayerTiling* tiling, | |
| 1460 const Tile* tile) { | |
| 1461 return tiling->IsTileRequiredForDrawIfVisible(tile); | |
| 1462 } | |
| 1463 } // namespace | |
| 1464 | |
| 1465 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | |
| 1466 TRACE_EVENT0("cc", | |
| 1467 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | |
| 1468 | |
| 1469 if (!layer_tree_impl()->IsPendingTree()) | |
| 1470 return true; | |
| 1471 | |
| 1472 return AllTilesRequiredAreReadyToDraw(&IsTileRequiredForActivationIfVisible); | |
| 1473 } | |
| 1474 | |
| 1475 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | |
| 1476 TRACE_EVENT0("cc", "PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw"); | |
| 1477 | |
| 1478 if (!layer_tree_impl()->IsActiveTree()) | |
| 1479 return true; | |
| 1480 | |
| 1481 return AllTilesRequiredAreReadyToDraw(&IsTileRequiredForDrawIfVisible); | |
| 1482 } | |
| 1483 | |
| 1459 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1484 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
| 1460 : layer_(nullptr), current_stage_(arraysize(stages_)) { | 1485 : layer_(nullptr), current_stage_(arraysize(stages_)) { |
| 1461 } | 1486 } |
| 1462 | 1487 |
| 1463 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( | 1488 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( |
| 1464 PictureLayerImpl* layer, | 1489 PictureLayerImpl* layer, |
| 1465 bool prioritize_low_res) | 1490 bool prioritize_low_res) |
| 1466 : layer_(layer), current_stage_(0) { | 1491 : layer_(layer), current_stage_(0) { |
| 1467 DCHECK(layer_); | 1492 DCHECK(layer_); |
| 1468 | 1493 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1722 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1747 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1723 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1748 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1724 return tiling_range.end - 1 - current_tiling_range_offset; | 1749 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1725 } | 1750 } |
| 1726 } | 1751 } |
| 1727 NOTREACHED(); | 1752 NOTREACHED(); |
| 1728 return 0; | 1753 return 0; |
| 1729 } | 1754 } |
| 1730 | 1755 |
| 1731 } // namespace cc | 1756 } // namespace cc |
| OLD | NEW |