| Index: cc/resources/picture_layer_tiling.cc
|
| diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
|
| index 171a8cb15242a259dc8e6e8cadcd0e5e1bbd83ba..8ba2fe1d6ca3b134e64b55a61b56e62560566004 100644
|
| --- a/cc/resources/picture_layer_tiling.cc
|
| +++ b/cc/resources/picture_layer_tiling.cc
|
| @@ -28,19 +28,6 @@ const float kMaxSoonBorderDistanceInScreenPixels = 312.f;
|
|
|
| } // namespace
|
|
|
| -scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
|
| - float contents_scale,
|
| - scoped_refptr<RasterSource> raster_source,
|
| - PictureLayerTilingClient* client,
|
| - size_t max_tiles_for_interest_area,
|
| - float skewport_target_time_in_seconds,
|
| - int skewport_extrapolation_limit_in_content_pixels) {
|
| - return make_scoped_ptr(new PictureLayerTiling(
|
| - contents_scale, raster_source, client, max_tiles_for_interest_area,
|
| - skewport_target_time_in_seconds,
|
| - skewport_extrapolation_limit_in_content_pixels));
|
| -}
|
| -
|
| PictureLayerTiling::PictureLayerTiling(
|
| float contents_scale,
|
| scoped_refptr<RasterSource> raster_source,
|
| @@ -79,8 +66,6 @@ PictureLayerTiling::PictureLayerTiling(
|
| }
|
|
|
| PictureLayerTiling::~PictureLayerTiling() {
|
| - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
|
| - it->second->set_shared(false);
|
| }
|
|
|
| // static
|
| @@ -94,13 +79,14 @@ float PictureLayerTiling::CalculateSoonBorderDistance(
|
| max_dimension * kSoonBorderDistanceViewportPercentage);
|
| }
|
|
|
| -Tile* PictureLayerTiling::CreateTile(int i,
|
| - int j,
|
| - const PictureLayerTiling* twin_tiling,
|
| - PictureLayerTiling* recycled_twin) {
|
| +bool PictureLayerTiling::TilingMatchesTileIndecies(
|
| + const PictureLayerTiling* twin) const {
|
| + return tiling_data_.max_texture_size() ==
|
| + twin->tiling_data_.max_texture_size();
|
| +}
|
| +
|
| +Tile* PictureLayerTiling::CreateTile(int i, int j) {
|
| // Can't have both a (pending or active) twin and a recycled twin tiling.
|
| - DCHECK_IMPLIES(twin_tiling, !recycled_twin);
|
| - DCHECK_IMPLIES(recycled_twin, !twin_tiling);
|
| TileMapKey key(i, j);
|
| DCHECK(tiles_.find(key) == tiles_.end());
|
|
|
| @@ -108,258 +94,16 @@ Tile* PictureLayerTiling::CreateTile(int i,
|
| gfx::Rect tile_rect = paint_rect;
|
| tile_rect.set_size(tiling_data_.max_texture_size());
|
|
|
| - // Check our twin for a valid tile.
|
| - if (twin_tiling &&
|
| - tiling_data_.max_texture_size() ==
|
| - twin_tiling->tiling_data_.max_texture_size()) {
|
| - if (Tile* candidate_tile = twin_tiling->TileAt(i, j)) {
|
| - gfx::Rect rect =
|
| - gfx::ScaleToEnclosingRect(paint_rect, 1.0f / contents_scale_);
|
| - const Region* invalidation = client_->GetPendingInvalidation();
|
| - if (!invalidation || !invalidation->Intersects(rect)) {
|
| - DCHECK(!candidate_tile->is_shared());
|
| - DCHECK_EQ(i, candidate_tile->tiling_i_index());
|
| - DCHECK_EQ(j, candidate_tile->tiling_j_index());
|
| - candidate_tile->set_shared(true);
|
| - tiles_[key] = candidate_tile;
|
| - return candidate_tile;
|
| - }
|
| - }
|
| - }
|
| -
|
| if (!raster_source_->CoversRect(tile_rect, contents_scale_))
|
| return nullptr;
|
|
|
| // Create a new tile because our twin didn't have a valid one.
|
| scoped_refptr<Tile> tile = client_->CreateTile(contents_scale_, tile_rect);
|
| - DCHECK(!tile->is_shared());
|
| tile->set_tiling_index(i, j);
|
| tiles_[key] = tile;
|
| -
|
| - if (recycled_twin) {
|
| - DCHECK(recycled_twin->tiles_.find(key) == recycled_twin->tiles_.end());
|
| - // Do what recycled_twin->CreateTile() would do.
|
| - tile->set_shared(true);
|
| - recycled_twin->tiles_[key] = tile;
|
| - }
|
| return tile.get();
|
| }
|
|
|
| -void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() {
|
| - const PictureLayerTiling* twin_tiling =
|
| - client_->GetPendingOrActiveTwinTiling(this);
|
| - // There is no recycled twin during commit from the main thread which is when
|
| - // this occurs.
|
| - PictureLayerTiling* null_recycled_twin = nullptr;
|
| - DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this));
|
| - bool include_borders = false;
|
| - for (TilingData::Iterator iter(
|
| - &tiling_data_, live_tiles_rect_, include_borders);
|
| - iter;
|
| - ++iter) {
|
| - TileMapKey key = iter.index();
|
| - TileMap::iterator find = tiles_.find(key);
|
| - if (find != tiles_.end())
|
| - continue;
|
| - CreateTile(key.first, key.second, twin_tiling, null_recycled_twin);
|
| - }
|
| -
|
| - VerifyLiveTilesRect(false);
|
| -}
|
| -
|
| -void PictureLayerTiling::CloneTilesAndPropertiesFrom(
|
| - const PictureLayerTiling& twin_tiling) {
|
| - DCHECK_EQ(&twin_tiling, client_->GetPendingOrActiveTwinTiling(this));
|
| -
|
| - SetRasterSourceAndResize(twin_tiling.raster_source_);
|
| - DCHECK_EQ(twin_tiling.contents_scale_, contents_scale_);
|
| - DCHECK_EQ(twin_tiling.raster_source_, raster_source_);
|
| - DCHECK_EQ(twin_tiling.tile_size().ToString(), tile_size().ToString());
|
| -
|
| - resolution_ = twin_tiling.resolution_;
|
| -
|
| - SetLiveTilesRect(twin_tiling.live_tiles_rect());
|
| -
|
| - // Recreate unshared tiles.
|
| - std::vector<TileMapKey> to_remove;
|
| - for (const auto& tile_map_pair : tiles_) {
|
| - TileMapKey key = tile_map_pair.first;
|
| - Tile* tile = tile_map_pair.second.get();
|
| - if (!tile->is_shared())
|
| - to_remove.push_back(key);
|
| - }
|
| - // The recycled twin does not exist since there is a pending twin (which is
|
| - // |twin_tiling|).
|
| - PictureLayerTiling* null_recycled_twin = nullptr;
|
| - DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this));
|
| - for (const auto& key : to_remove) {
|
| - RemoveTileAt(key.first, key.second, null_recycled_twin);
|
| - CreateTile(key.first, key.second, &twin_tiling, null_recycled_twin);
|
| - }
|
| -
|
| - // Create any missing tiles from the |twin_tiling|.
|
| - for (const auto& tile_map_pair : twin_tiling.tiles_) {
|
| - TileMapKey key = tile_map_pair.first;
|
| - Tile* tile = tile_map_pair.second.get();
|
| - if (!tile->is_shared())
|
| - CreateTile(key.first, key.second, &twin_tiling, null_recycled_twin);
|
| - }
|
| -
|
| - DCHECK_EQ(twin_tiling.tiles_.size(), tiles_.size());
|
| -#if DCHECK_IS_ON()
|
| - for (const auto& tile_map_pair : tiles_)
|
| - DCHECK(tile_map_pair.second->is_shared());
|
| - VerifyLiveTilesRect(false);
|
| -#endif
|
| -
|
| - UpdateTilePriorityRects(twin_tiling.current_content_to_screen_scale_,
|
| - twin_tiling.current_visible_rect_,
|
| - twin_tiling.current_skewport_rect_,
|
| - twin_tiling.current_soon_border_rect_,
|
| - twin_tiling.current_eventually_rect_,
|
| - twin_tiling.current_occlusion_in_layer_space_);
|
| -}
|
| -
|
| -void PictureLayerTiling::SetRasterSourceAndResize(
|
| - scoped_refptr<RasterSource> raster_source) {
|
| - DCHECK(!raster_source->IsSolidColor());
|
| - gfx::Size old_layer_bounds = raster_source_->GetSize();
|
| - raster_source_.swap(raster_source);
|
| - gfx::Size new_layer_bounds = raster_source_->GetSize();
|
| - gfx::Size content_bounds =
|
| - gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_));
|
| - gfx::Size tile_size = client_->CalculateTileSize(content_bounds);
|
| -
|
| - if (tile_size != tiling_data_.max_texture_size()) {
|
| - tiling_data_.SetTilingSize(content_bounds);
|
| - tiling_data_.SetMaxTextureSize(tile_size);
|
| - // When the tile size changes, the TilingData positions no longer work
|
| - // as valid keys to the TileMap, so just drop all tiles and clear the live
|
| - // tiles rect.
|
| - Reset();
|
| - return;
|
| - }
|
| -
|
| - if (old_layer_bounds == new_layer_bounds)
|
| - return;
|
| -
|
| - // The SetLiveTilesRect() method would drop tiles outside the new bounds,
|
| - // but may do so incorrectly if resizing the tiling causes the number of
|
| - // tiles in the tiling_data_ to change.
|
| - gfx::Rect content_rect(content_bounds);
|
| - int before_left = tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.x());
|
| - int before_top = tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.y());
|
| - int before_right =
|
| - tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1);
|
| - int before_bottom =
|
| - tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.bottom() - 1);
|
| -
|
| - // The live_tiles_rect_ is clamped to stay within the tiling size as we
|
| - // change it.
|
| - live_tiles_rect_.Intersect(content_rect);
|
| - tiling_data_.SetTilingSize(content_bounds);
|
| -
|
| - int after_right = -1;
|
| - int after_bottom = -1;
|
| - if (!live_tiles_rect_.IsEmpty()) {
|
| - after_right =
|
| - tiling_data_.TileXIndexFromSrcCoord(live_tiles_rect_.right() - 1);
|
| - after_bottom =
|
| - tiling_data_.TileYIndexFromSrcCoord(live_tiles_rect_.bottom() - 1);
|
| - }
|
| -
|
| - // There is no recycled twin since this is run on the pending tiling
|
| - // during commit, and on the active tree during activate.
|
| - PictureLayerTiling* null_recycled_twin = nullptr;
|
| - DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this));
|
| -
|
| - // Drop tiles outside the new layer bounds if the layer shrank.
|
| - for (int i = after_right + 1; i <= before_right; ++i) {
|
| - for (int j = before_top; j <= before_bottom; ++j)
|
| - RemoveTileAt(i, j, null_recycled_twin);
|
| - }
|
| - for (int i = before_left; i <= after_right; ++i) {
|
| - for (int j = after_bottom + 1; j <= before_bottom; ++j)
|
| - RemoveTileAt(i, j, null_recycled_twin);
|
| - }
|
| -
|
| - // If the layer grew, the live_tiles_rect_ is not changed, but a new row
|
| - // and/or column of tiles may now exist inside the same live_tiles_rect_.
|
| - const PictureLayerTiling* twin_tiling =
|
| - client_->GetPendingOrActiveTwinTiling(this);
|
| - if (after_right > before_right) {
|
| - DCHECK_EQ(after_right, before_right + 1);
|
| - for (int j = before_top; j <= after_bottom; ++j)
|
| - CreateTile(after_right, j, twin_tiling, null_recycled_twin);
|
| - }
|
| - if (after_bottom > before_bottom) {
|
| - DCHECK_EQ(after_bottom, before_bottom + 1);
|
| - for (int i = before_left; i <= before_right; ++i)
|
| - CreateTile(i, after_bottom, twin_tiling, null_recycled_twin);
|
| - }
|
| -}
|
| -
|
| -void PictureLayerTiling::Invalidate(const Region& layer_invalidation) {
|
| - if (live_tiles_rect_.IsEmpty())
|
| - return;
|
| - std::vector<TileMapKey> new_tile_keys;
|
| - gfx::Rect expanded_live_tiles_rect =
|
| - tiling_data_.ExpandRectIgnoringBordersToTileBounds(live_tiles_rect_);
|
| - for (Region::Iterator iter(layer_invalidation); iter.has_rect();
|
| - iter.next()) {
|
| - gfx::Rect layer_rect = iter.rect();
|
| - gfx::Rect content_rect =
|
| - gfx::ScaleToEnclosingRect(layer_rect, contents_scale_);
|
| - // Consider tiles inside the live tiles rect even if only their border
|
| - // pixels intersect the invalidation. But don't consider tiles outside
|
| - // the live tiles rect with the same conditions, as they won't exist.
|
| - int border_pixels = tiling_data_.border_texels();
|
| - content_rect.Inset(-border_pixels, -border_pixels);
|
| - // Avoid needless work by not bothering to invalidate where there aren't
|
| - // tiles.
|
| - content_rect.Intersect(expanded_live_tiles_rect);
|
| - if (content_rect.IsEmpty())
|
| - continue;
|
| - // Since the content_rect includes border pixels already, don't include
|
| - // borders when iterating to avoid double counting them.
|
| - bool include_borders = false;
|
| - for (TilingData::Iterator iter(
|
| - &tiling_data_, content_rect, include_borders);
|
| - iter;
|
| - ++iter) {
|
| - // There is no recycled twin for the pending tree during commit, or for
|
| - // the active tree during activation.
|
| - PictureLayerTiling* null_recycled_twin = nullptr;
|
| - DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this));
|
| - if (RemoveTileAt(iter.index_x(), iter.index_y(), null_recycled_twin))
|
| - new_tile_keys.push_back(iter.index());
|
| - }
|
| - }
|
| -
|
| - if (!new_tile_keys.empty()) {
|
| - // During commit from the main thread, invalidations can never be shared
|
| - // with the active tree since the active tree has different content there.
|
| - // And when invalidating an active-tree tiling, it means there was no
|
| - // pending tiling to clone from.
|
| - const PictureLayerTiling* null_twin_tiling = nullptr;
|
| - PictureLayerTiling* null_recycled_twin = nullptr;
|
| - DCHECK_EQ(null_recycled_twin, client_->GetRecycledTwinTiling(this));
|
| - for (size_t i = 0; i < new_tile_keys.size(); ++i) {
|
| - CreateTile(new_tile_keys[i].first, new_tile_keys[i].second,
|
| - null_twin_tiling, null_recycled_twin);
|
| - }
|
| - }
|
| -}
|
| -
|
| -void PictureLayerTiling::SetRasterSourceOnTiles() {
|
| - // Shared (ie. non-invalidated) tiles on the pending tree are updated to use
|
| - // the new raster source. When this raster source is activated, the raster
|
| - // source will remain valid for shared tiles in the active tree.
|
| - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
|
| - it->second->set_raster_source(raster_source_);
|
| - VerifyLiveTilesRect(false);
|
| -}
|
| -
|
| PictureLayerTiling::CoverageIterator::CoverageIterator()
|
| : tiling_(NULL),
|
| current_tile_(NULL),
|
| @@ -499,29 +243,16 @@ gfx::RectF PictureLayerTiling::CoverageIterator::texture_rect() const {
|
| return texture_rect;
|
| }
|
|
|
| -bool PictureLayerTiling::RemoveTileAt(int i,
|
| - int j,
|
| - PictureLayerTiling* recycled_twin) {
|
| +bool PictureLayerTiling::RemoveTileAt(int i, int j) {
|
| TileMap::iterator found = tiles_.find(TileMapKey(i, j));
|
| if (found == tiles_.end())
|
| return false;
|
| - found->second->set_shared(false);
|
| tiles_.erase(found);
|
| - if (recycled_twin) {
|
| - // Recycled twin does not also have a recycled twin, so pass null.
|
| - recycled_twin->RemoveTileAt(i, j, nullptr);
|
| - }
|
| return true;
|
| }
|
|
|
| void PictureLayerTiling::Reset() {
|
| live_tiles_rect_ = gfx::Rect();
|
| - PictureLayerTiling* recycled_twin = client_->GetRecycledTwinTiling(this);
|
| - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
|
| - it->second->set_shared(false);
|
| - if (recycled_twin)
|
| - recycled_twin->RemoveTileAt(it->first.first, it->first.second, nullptr);
|
| - }
|
| tiles_.clear();
|
| }
|
|
|
| @@ -631,14 +362,14 @@ bool PictureLayerTiling::ComputeTilePriorityRects(
|
| visible_rect_in_content_space);
|
| last_viewport_in_layer_space_ = viewport_in_layer_space;
|
|
|
| + SetTilePriorityRects(content_to_screen_scale, visible_rect_in_content_space,
|
| + skewport, soon_border_rect, eventually_rect,
|
| + occlusion_in_layer_space);
|
| SetLiveTilesRect(eventually_rect);
|
| - UpdateTilePriorityRects(
|
| - content_to_screen_scale, visible_rect_in_content_space, skewport,
|
| - soon_border_rect, eventually_rect, occlusion_in_layer_space);
|
| return true;
|
| }
|
|
|
| -void PictureLayerTiling::UpdateTilePriorityRects(
|
| +void PictureLayerTiling::SetTilePriorityRects(
|
| float content_to_screen_scale,
|
| const gfx::Rect& visible_rect_in_content_space,
|
| const gfx::Rect& skewport,
|
| @@ -660,47 +391,6 @@ void PictureLayerTiling::UpdateTilePriorityRects(
|
| has_eventually_rect_tiles_ = tiling_rect.Intersects(current_eventually_rect_);
|
| }
|
|
|
| -void PictureLayerTiling::SetLiveTilesRect(
|
| - const gfx::Rect& new_live_tiles_rect) {
|
| - DCHECK(new_live_tiles_rect.IsEmpty() ||
|
| - gfx::Rect(tiling_size()).Contains(new_live_tiles_rect))
|
| - << "tiling_size: " << tiling_size().ToString()
|
| - << " new_live_tiles_rect: " << new_live_tiles_rect.ToString();
|
| - if (live_tiles_rect_ == new_live_tiles_rect)
|
| - return;
|
| -
|
| - PictureLayerTiling* recycled_twin = client_->GetRecycledTwinTiling(this);
|
| -
|
| - // Iterate to delete all tiles outside of our new live_tiles rect.
|
| - for (TilingData::DifferenceIterator iter(&tiling_data_,
|
| - live_tiles_rect_,
|
| - new_live_tiles_rect);
|
| - iter;
|
| - ++iter) {
|
| - RemoveTileAt(iter.index_x(), iter.index_y(), recycled_twin);
|
| - }
|
| -
|
| - const PictureLayerTiling* twin_tiling =
|
| - client_->GetPendingOrActiveTwinTiling(this);
|
| -
|
| - // Iterate to allocate new tiles for all regions with newly exposed area.
|
| - for (TilingData::DifferenceIterator iter(&tiling_data_,
|
| - new_live_tiles_rect,
|
| - live_tiles_rect_);
|
| - iter;
|
| - ++iter) {
|
| - TileMapKey key(iter.index());
|
| - CreateTile(key.first, key.second, twin_tiling, recycled_twin);
|
| - }
|
| -
|
| - live_tiles_rect_ = new_live_tiles_rect;
|
| - VerifyLiveTilesRect(false);
|
| - if (recycled_twin) {
|
| - recycled_twin->live_tiles_rect_ = live_tiles_rect_;
|
| - recycled_twin->VerifyLiveTilesRect(true);
|
| - }
|
| -}
|
| -
|
| void PictureLayerTiling::VerifyLiveTilesRect(bool is_on_recycle_tree) const {
|
| #if DCHECK_IS_ON()
|
| for (auto it = tiles_.begin(); it != tiles_.end(); ++it) {
|
| @@ -725,131 +415,13 @@ void PictureLayerTiling::VerifyLiveTilesRect(bool is_on_recycle_tree) const {
|
| #endif
|
| }
|
|
|
| -bool PictureLayerTiling::IsTileOccluded(const Tile* tile) const {
|
| - DCHECK(tile);
|
| -
|
| - if (!current_occlusion_in_layer_space_.HasOcclusion())
|
| - return false;
|
| -
|
| - gfx::Rect tile_query_rect =
|
| - gfx::IntersectRects(tile->content_rect(), current_visible_rect_);
|
| -
|
| - // Explicitly check if the tile is outside the viewport. If so, we need to
|
| - // return false, since occlusion for this tile is unknown.
|
| - // TODO(vmpstr): Since the current visible rect is really a viewport in
|
| - // layer space, we should probably clip tile query rect to tiling bounds
|
| - // or live tiles rect.
|
| - if (tile_query_rect.IsEmpty())
|
| - return false;
|
| -
|
| - if (contents_scale_ != 1.f) {
|
| - tile_query_rect =
|
| - gfx::ScaleToEnclosingRect(tile_query_rect, 1.0f / contents_scale_);
|
| - }
|
| -
|
| - return current_occlusion_in_layer_space_.IsOccluded(tile_query_rect);
|
| -}
|
| -
|
| -bool PictureLayerTiling::IsTileRequiredForActivationIfVisible(
|
| - const Tile* tile) const {
|
| - DCHECK_EQ(PENDING_TREE, client_->GetTree());
|
| -
|
| - // This function assumes that the tile is visible (i.e. in the viewport). The
|
| - // caller needs to make sure that this condition is met to ensure we don't
|
| - // block activation on tiles outside of the viewport.
|
| -
|
| - // If we are not allowed to mark tiles as required for activation, then don't
|
| - // do it.
|
| - if (!can_require_tiles_for_activation_)
|
| - return false;
|
| -
|
| - if (resolution_ != HIGH_RESOLUTION)
|
| - return false;
|
| -
|
| - if (IsTileOccluded(tile))
|
| - return false;
|
| -
|
| - if (client_->RequiresHighResToDraw())
|
| - return true;
|
| -
|
| - const PictureLayerTiling* twin_tiling =
|
| - client_->GetPendingOrActiveTwinTiling(this);
|
| - if (!twin_tiling)
|
| - return true;
|
| -
|
| - if (twin_tiling->raster_source()->GetSize() != raster_source()->GetSize())
|
| - return true;
|
| -
|
| - if (twin_tiling->current_visible_rect_ != current_visible_rect_)
|
| - return true;
|
| -
|
| - Tile* twin_tile =
|
| - twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index());
|
| - // If twin tile is missing, it might not have a recording, so we don't need
|
| - // this tile to be required for activation.
|
| - if (!twin_tile)
|
| - return false;
|
| -
|
| - return true;
|
| -}
|
| -
|
| -bool PictureLayerTiling::IsTileRequiredForDrawIfVisible(
|
| - const Tile* tile) const {
|
| - DCHECK_EQ(ACTIVE_TREE, client_->GetTree());
|
| -
|
| - // This function assumes that the tile is visible (i.e. in the viewport).
|
| -
|
| - if (resolution_ != HIGH_RESOLUTION)
|
| - return false;
|
| -
|
| - if (IsTileOccluded(tile))
|
| - return false;
|
| -
|
| - return true;
|
| -}
|
| -
|
| void PictureLayerTiling::UpdateTileAndTwinPriority(Tile* tile) const {
|
| WhichTree tree = client_->GetTree();
|
| WhichTree twin_tree = tree == ACTIVE_TREE ? PENDING_TREE : ACTIVE_TREE;
|
| -
|
| tile->SetPriority(tree, ComputePriorityForTile(tile));
|
| - UpdateRequiredStateForTile(tile, tree);
|
| -
|
| - const PictureLayerTiling* twin_tiling =
|
| - client_->GetPendingOrActiveTwinTiling(this);
|
| - if (!tile->is_shared() || !twin_tiling) {
|
| - tile->SetPriority(twin_tree, TilePriority());
|
| - tile->set_is_occluded(twin_tree, false);
|
| - if (twin_tree == PENDING_TREE)
|
| - tile->set_required_for_activation(false);
|
| - else
|
| - tile->set_required_for_draw(false);
|
| - return;
|
| - }
|
| -
|
| - tile->SetPriority(twin_tree, twin_tiling->ComputePriorityForTile(tile));
|
| - twin_tiling->UpdateRequiredStateForTile(tile, twin_tree);
|
| -}
|
| -
|
| -void PictureLayerTiling::UpdateRequiredStateForTile(Tile* tile,
|
| - WhichTree tree) const {
|
| - if (tile->priority(tree).priority_bin == TilePriority::NOW) {
|
| - if (tree == PENDING_TREE) {
|
| - tile->set_required_for_activation(
|
| - IsTileRequiredForActivationIfVisible(tile));
|
| - } else {
|
| - tile->set_required_for_draw(IsTileRequiredForDrawIfVisible(tile));
|
| - }
|
| - tile->set_is_occluded(tree, IsTileOccluded(tile));
|
| - return;
|
| - }
|
| -
|
| - // Non-NOW bin tiles are not required or occluded.
|
| - if (tree == PENDING_TREE)
|
| - tile->set_required_for_activation(false);
|
| - else
|
| - tile->set_required_for_draw(false);
|
| - tile->set_is_occluded(tree, false);
|
| + tile->SetPriority(twin_tree, TilePriority());
|
| + tile->set_required_for_activation(IsTileRequiredForActivation(tile));
|
| + tile->set_required_for_draw(IsTileRequiredForDraw(tile));
|
| }
|
|
|
| TilePriority PictureLayerTiling::ComputePriorityForTile(
|
| @@ -867,6 +439,11 @@ TilePriority PictureLayerTiling::ComputePriorityForTile(
|
| return TilePriority(resolution_, TilePriority::NOW, 0);
|
| }
|
|
|
| + if (max_tile_priority_bin <= TilePriority::SOON &&
|
| + pending_visible_rect().Intersects(tile_bounds)) {
|
| + return TilePriority(resolution_, TilePriority::SOON, 0);
|
| + }
|
| +
|
| DCHECK_GT(current_content_to_screen_scale_, 0.f);
|
| float distance_to_visible =
|
| current_visible_rect_.ManhattanInternalDistance(tile_bounds) *
|
|
|