Chromium Code Reviews| Index: cc/resources/picture_layer_tiling.cc |
| diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc |
| index 4dc46e0820b04062bbb8621ed8ef32985a51d4bc..36cf316d7eb09f19aa473bc8e4079ab8d4c5201b 100644 |
| --- a/cc/resources/picture_layer_tiling.cc |
| +++ b/cc/resources/picture_layer_tiling.cc |
| @@ -693,15 +693,13 @@ bool PictureLayerTiling::IsTileOccluded(const Tile* tile) const { |
| return current_occlusion_in_layer_space_.IsOccluded(tile_query_rect); |
| } |
| -bool PictureLayerTiling::IsTileRequiredForActivation(const Tile* tile) const { |
| +bool PictureLayerTiling::IsTileRequiredForActivationIfVisible( |
| + const Tile* tile) const { |
| DCHECK_EQ(PENDING_TREE, client_->GetTree()); |
| - // Note that although this function will determine whether tile is required |
| - // for activation assuming that it is in visible (ie in the viewport). That is |
| - // to say, even if the tile is outside of the viewport, it will be treated as |
| - // if it was inside (there are no explicit checks for this). Hence, this |
| - // function is only called for visible tiles to ensure we don't block |
| - // activation on tiles outside of the viewport. |
| + // 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. |
| @@ -737,6 +735,21 @@ bool PictureLayerTiling::IsTileRequiredForActivation(const Tile* tile) const { |
| 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 { |
| UpdateTilePriority(tile); |
| @@ -748,6 +761,8 @@ void PictureLayerTiling::UpdateTileAndTwinPriority(Tile* tile) const { |
| 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; |
| } |
| @@ -767,13 +782,18 @@ void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { |
| if (current_visible_rect_.Intersects(tile_bounds)) { |
| tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); |
| if (tree == PENDING_TREE) |
|
danakj
2014/10/31 17:00:57
{}
ernstm
2014/11/03 22:34:41
Done.
|
| - tile->set_required_for_activation(IsTileRequiredForActivation(tile)); |
| + tile->set_required_for_activation( |
| + IsTileRequiredForActivationIfVisible(tile)); |
| + else |
| + tile->set_required_for_draw(IsTileRequiredForDrawIfVisible(tile)); |
| tile->set_is_occluded(tree, IsTileOccluded(tile)); |
| return; |
| } |
| if (tree == PENDING_TREE) |
| tile->set_required_for_activation(false); |
| + else |
| + tile->set_required_for_draw(false); |
| tile->set_is_occluded(tree, false); |
| DCHECK_GT(content_to_screen_scale_, 0.f); |