Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.cc |
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
| index 90907d7583f0bf6d624b4dfac18a41c7f934d24b..4a0ce75f5d1e392c89b2a34542015b2a71b79e96 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -1049,10 +1049,15 @@ bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, |
| active_tree_->source_frame_number()); |
| if (need_to_update_visible_tiles_before_draw_) { |
| - DCHECK(tile_manager_); |
| - if (tile_manager_->UpdateVisibleTiles()) |
| - DidInitializeVisibleTile(); |
| + if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) { |
| + // We do not notify the client that there is a new visible tile |
| + // unless the UpdateVisibleTiles was triggered by the client explicitly. |
| + // Otherwise, we will get spurious redraws. |
| + const bool notify_client = false; |
| + DidInitializeVisibleTile(notify_client); |
| + } |
| } |
| + need_to_update_visible_tiles_before_draw_ = true; |
| active_tree_->UpdateDrawProperties(); |
| @@ -1090,6 +1095,11 @@ void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { |
| NOTREACHED(); |
| } |
| +void LayerTreeHostImpl::DidInitializeVisibleTileForTesting() { |
| + const bool notify_client = true; |
| + DidInitializeVisibleTile(notify_client); |
| +} |
| + |
| void LayerTreeHostImpl::EnforceManagedMemoryPolicy( |
| const ManagedMemoryPolicy& policy) { |
| @@ -1136,11 +1146,11 @@ void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( |
| manage_tiles_needed_ = true; |
| } |
| -void LayerTreeHostImpl::DidInitializeVisibleTile() { |
| +void LayerTreeHostImpl::DidInitializeVisibleTile(bool notify_client) { |
| // TODO(reveman): Determine tiles that changed and only damage |
| // what's necessary. |
| SetFullRootLayerDamage(); |
| - if (client_) |
| + if (client_ && notify_client) |
| client_->DidInitializeVisibleTileOnImplThread(); |
| } |
| @@ -1487,11 +1497,12 @@ void LayerTreeHostImpl::CreatePendingTree() { |
| } |
| void LayerTreeHostImpl::UpdateVisibleTiles() { |
| - DCHECK(!client_->IsInsideDraw()) << |
| - "Updating visible tiles within a draw may trigger " |
| - "spurious redraws."; |
| - if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) |
| - DidInitializeVisibleTile(); |
| + DCHECK(!client_->IsInsideDraw()) |
|
enne (OOO)
2013/09/11 22:30:47
I think this would be cleaner if you just checked
brianderson
2013/09/12 00:12:34
I like your first suggestion and will go with that
|
| + << "Updating visible tiles within a draw may trigger spurious redraws."; |
| + if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) { |
| + const bool notify_client = true; |
| + DidInitializeVisibleTile(notify_client); |
| + } |
| need_to_update_visible_tiles_before_draw_ = false; |
| } |