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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1361 } | 1361 } |
1362 | 1362 |
1363 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1363 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1364 return !layer_tree_impl()->IsRecycleTree(); | 1364 return !layer_tree_impl()->IsRecycleTree(); |
1365 } | 1365 } |
1366 | 1366 |
1367 bool PictureLayerImpl::HasValidTilePriorities() const { | 1367 bool PictureLayerImpl::HasValidTilePriorities() const { |
1368 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1368 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1369 } | 1369 } |
1370 | 1370 |
1371 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1371 bool PictureLayerImpl::AllTilesRequiredAreReadyToDraw( |
1372 TRACE_EVENT0("cc", | 1372 const char* action_name, |
vmpstr
2014/10/24 18:02:23
I don't think we need this. I'm not a fan of passi
ernstm
2014/10/27 21:13:56
Done.
| |
1373 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | 1373 const base::Callback<bool(PictureLayerTiling* tiling, const Tile*)>& |
1374 if (!layer_tree_impl()->IsPendingTree()) | 1374 IsTileRequiredCallback) const { |
1375 return true; | |
1376 | |
1377 if (!HasValidTilePriorities()) | 1375 if (!HasValidTilePriorities()) |
1378 return true; | 1376 return true; |
1379 | 1377 |
1380 if (!tilings_) | 1378 if (!tilings_) |
1381 return true; | 1379 return true; |
1382 | 1380 |
1383 if (visible_rect_for_tile_priority_.IsEmpty()) | 1381 if (visible_rect_for_tile_priority_.IsEmpty()) |
1384 return true; | 1382 return true; |
1385 | 1383 |
1386 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 1384 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
(...skipping 11 matching lines...) Expand all Loading... | |
1398 // A null tile (i.e. missing recording) can just be skipped. | 1396 // A null tile (i.e. missing recording) can just be skipped. |
1399 // TODO(vmpstr): Verify this is true if we create tiles in raster | 1397 // TODO(vmpstr): Verify this is true if we create tiles in raster |
1400 // iterators. | 1398 // iterators. |
1401 if (!tile) | 1399 if (!tile) |
1402 continue; | 1400 continue; |
1403 | 1401 |
1404 // We can't check tile->required_for_activation, because that value might | 1402 // We can't check tile->required_for_activation, because that value might |
1405 // be out of date. It is updated in the raster/eviction iterators. | 1403 // be out of date. It is updated in the raster/eviction iterators. |
1406 // TODO(vmpstr): Remove the comment once you can't access this information | 1404 // TODO(vmpstr): Remove the comment once you can't access this information |
1407 // from the tile. | 1405 // from the tile. |
1408 if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) { | 1406 if (IsTileRequiredCallback.Run(tiling, tile) && !tile->IsReadyToDraw()) { |
1409 TRACE_EVENT_INSTANT0("cc", | 1407 std::string event_name = "Tiles required for " + |
vmpstr
2014/10/24 18:02:23
This would be constructed even when tracing is not
ernstm
2014/10/27 21:13:56
Done.
| |
1410 "PictureLayerImpl::" | 1408 std::string(action_name) + |
1411 "AllTilesRequiredForActivationAreReadyToDraw not " | 1409 " not ready to draw."; |
1412 "ready to activate", | 1410 TRACE_EVENT_INSTANT0( |
1413 TRACE_EVENT_SCOPE_THREAD); | 1411 "cc", event_name.c_str(), TRACE_EVENT_SCOPE_THREAD); |
1414 return false; | 1412 return false; |
1415 } | 1413 } |
1416 } | 1414 } |
1417 } | 1415 } |
1418 | 1416 |
1419 return true; | 1417 return true; |
1420 } | 1418 } |
1421 | 1419 |
1420 bool PictureLayerImpl::IsTileRequiredForActivation(PictureLayerTiling* tiling, | |
1421 const Tile* tile) { | |
1422 return tiling->IsTileRequiredForActivation(tile); | |
1423 } | |
1424 | |
1425 bool PictureLayerImpl::IsTileRequiredForDraw(PictureLayerTiling* tiling, | |
1426 const Tile* tile) { | |
1427 return tiling->IsTileRequiredForDraw(tile); | |
1428 } | |
1429 | |
1430 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | |
1431 TRACE_EVENT0("cc", | |
1432 "PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw"); | |
1433 | |
1434 if (!layer_tree_impl()->IsPendingTree()) | |
1435 return true; | |
1436 | |
1437 return AllTilesRequiredAreReadyToDraw( | |
1438 "activation", base::Bind(&PictureLayerImpl::IsTileRequiredForActivation)); | |
1439 } | |
1440 | |
1441 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | |
1442 TRACE_EVENT0("cc", "PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw"); | |
1443 | |
1444 if (!layer_tree_impl()->IsActiveTree()) | |
1445 return true; | |
1446 | |
1447 return AllTilesRequiredAreReadyToDraw( | |
1448 "draw", base::Bind(&PictureLayerImpl::IsTileRequiredForDraw)); | |
1449 } | |
1450 | |
1422 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() | 1451 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() |
1423 : layer_(nullptr), current_stage_(arraysize(stages_)) { | 1452 : layer_(nullptr), current_stage_(arraysize(stages_)) { |
1424 } | 1453 } |
1425 | 1454 |
1426 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( | 1455 PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( |
1427 PictureLayerImpl* layer, | 1456 PictureLayerImpl* layer, |
1428 bool prioritize_low_res) | 1457 bool prioritize_low_res) |
1429 : layer_(layer), current_stage_(0) { | 1458 : layer_(layer), current_stage_(0) { |
1430 DCHECK(layer_); | 1459 DCHECK(layer_); |
1431 | 1460 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1685 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1714 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1686 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1715 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1687 return tiling_range.end - 1 - current_tiling_range_offset; | 1716 return tiling_range.end - 1 - current_tiling_range_offset; |
1688 } | 1717 } |
1689 } | 1718 } |
1690 NOTREACHED(); | 1719 NOTREACHED(); |
1691 return 0; | 1720 return 0; |
1692 } | 1721 } |
1693 | 1722 |
1694 } // namespace cc | 1723 } // namespace cc |
OLD | NEW |