Index: cc/surfaces/display.cc |
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc |
index 8833037c5ecbd822fc554b6697657c59b474739e..763b81c070054838c1554a0f03b47970f1867aa9 100644 |
--- a/cc/surfaces/display.cc |
+++ b/cc/surfaces/display.cc |
@@ -168,10 +168,16 @@ void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
client_->SetMemoryPolicy(policy); |
} |
-void Display::OnSurfaceDamaged(SurfaceId surface) { |
+void Display::OnSurfaceDamaged(SurfaceId surface_id) { |
if (aggregator_ && |
- aggregator_->previous_contained_surfaces().count(surface)) { |
- aggregator_->ReleaseResources(surface); |
+ aggregator_->previous_contained_surfaces().count(surface_id)) { |
+ Surface* surface = manager_->GetSurfaceForId(surface_id); |
+ if (surface) { |
+ const CompositorFrame* current_frame = surface->GetEligibleFrame(); |
+ if (!current_frame || !current_frame->delegated_frame_data || |
+ !current_frame->delegated_frame_data->resource_list.size()) |
+ aggregator_->ReleaseResources(surface_id); |
+ } |
client_->DisplayDamaged(); |
} |
} |