| Index: cc/test/fake_picture_layer_impl.cc
|
| diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
|
| index 73c1ae3f0017be483b5dcb93d8acb34b0ff6f394..bf55ebf557886e1e351d282b74a75ef940065ecb 100644
|
| --- a/cc/test/fake_picture_layer_impl.cc
|
| +++ b/cc/test/fake_picture_layer_impl.cc
|
| @@ -10,31 +10,33 @@
|
|
|
| namespace cc {
|
|
|
| -FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl,
|
| - int id,
|
| - scoped_refptr<PicturePileImpl> pile)
|
| +FakePictureLayerImpl::FakePictureLayerImpl(
|
| + LayerTreeImpl* tree_impl,
|
| + int id,
|
| + scoped_refptr<RasterSource> raster_source)
|
| : PictureLayerImpl(tree_impl, id),
|
| append_quads_count_(0),
|
| did_become_active_call_count_(0),
|
| has_valid_tile_priorities_(false),
|
| use_set_valid_tile_priorities_flag_(false),
|
| release_resources_count_(0) {
|
| - pile_ = pile;
|
| - SetBounds(pile_->tiling_size());
|
| - SetContentBounds(pile_->tiling_size());
|
| + raster_source_ = raster_source;
|
| + SetBounds(raster_source_->GetSize());
|
| + SetContentBounds(raster_source_->GetSize());
|
| }
|
|
|
| -FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl,
|
| - int id,
|
| - scoped_refptr<PicturePileImpl> pile,
|
| - const gfx::Size& layer_bounds)
|
| +FakePictureLayerImpl::FakePictureLayerImpl(
|
| + LayerTreeImpl* tree_impl,
|
| + int id,
|
| + scoped_refptr<RasterSource> raster_source,
|
| + const gfx::Size& layer_bounds)
|
| : PictureLayerImpl(tree_impl, id),
|
| append_quads_count_(0),
|
| did_become_active_call_count_(0),
|
| has_valid_tile_priorities_(false),
|
| use_set_valid_tile_priorities_flag_(false),
|
| release_resources_count_(0) {
|
| - pile_ = pile;
|
| + raster_source_ = raster_source;
|
| SetBounds(layer_bounds);
|
| SetContentBounds(layer_bounds);
|
| }
|
| @@ -97,12 +99,13 @@ PictureLayerTiling* FakePictureLayerImpl::LowResTiling() const {
|
| return result;
|
| }
|
|
|
| -void FakePictureLayerImpl::SetPile(scoped_refptr<PicturePileImpl> pile) {
|
| - pile_.swap(pile);
|
| +void FakePictureLayerImpl::SetRasterSource(
|
| + scoped_refptr<RasterSource> raster_source) {
|
| + raster_source_.swap(raster_source);
|
| if (tilings()) {
|
| for (size_t i = 0; i < num_tilings(); ++i) {
|
| - tilings()->tiling_at(i)->UpdateTilesToCurrentPile(Region(),
|
| - pile_->tiling_size());
|
| + tilings()->tiling_at(i)->UpdateTilesToCurrentRasterSource(
|
| + Region(), raster_source_->GetSize());
|
| }
|
| }
|
| }
|
| @@ -190,6 +193,65 @@ bool FakePictureLayerImpl::HasValidTilePriorities() const {
|
| : PictureLayerImpl::HasValidTilePriorities();
|
| }
|
|
|
| +size_t FakePictureLayerImpl::CountTilesRequired(
|
| + TileRequirementCheck is_tile_required_callback) const {
|
| + if (!HasValidTilePriorities())
|
| + return 0;
|
| +
|
| + if (!tilings_)
|
| + return 0;
|
| +
|
| + if (visible_rect_for_tile_priority_.IsEmpty())
|
| + return 0;
|
| +
|
| + gfx::Rect rect = GetViewportForTilePriorityInContentSpace();
|
| + rect.Intersect(visible_rect_for_tile_priority_);
|
| +
|
| + size_t count = 0;
|
| +
|
| + for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
|
| + PictureLayerTiling* tiling = tilings_->tiling_at(i);
|
| + if (tiling->resolution() != HIGH_RESOLUTION &&
|
| + tiling->resolution() != LOW_RESOLUTION)
|
| + continue;
|
| +
|
| + for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter;
|
| + ++iter) {
|
| + const Tile* tile = *iter;
|
| + // A null tile (i.e. missing recording) can just be skipped.
|
| + // TODO(vmpstr): Verify this is true if we create tiles in raster
|
| + // iterators.
|
| + if (!tile)
|
| + continue;
|
| +
|
| + // We can't check tile->required_for_activation, because that value might
|
| + // be out of date. It is updated in the raster/eviction iterators.
|
| + // TODO(vmpstr): Remove the comment once you can't access this information
|
| + // from the tile.
|
| + if ((tiling->*is_tile_required_callback)(tile))
|
| + ++count;
|
| + }
|
| + }
|
| +
|
| + return count;
|
| +}
|
| +
|
| +size_t FakePictureLayerImpl::CountTilesRequiredForActivation() const {
|
| + if (!layer_tree_impl()->IsPendingTree())
|
| + return 0;
|
| +
|
| + return CountTilesRequired(
|
| + &PictureLayerTiling::IsTileRequiredForActivationIfVisible);
|
| +}
|
| +
|
| +size_t FakePictureLayerImpl::CountTilesRequiredForDraw() const {
|
| + if (!layer_tree_impl()->IsActiveTree())
|
| + return 0;
|
| +
|
| + return CountTilesRequired(
|
| + &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
|
| +}
|
| +
|
| void FakePictureLayerImpl::ReleaseResources() {
|
| PictureLayerImpl::ReleaseResources();
|
| ++release_resources_count_;
|
|
|