Commit 3e5ec5ff authored by jbauman's avatar jbauman Committed by Commit bot

Release resources from SurfaceAggregator when new frame arrives.

The SurfaceAggregator will never need the resources for a frame after a new frame has been submitted for that Surface, so return the resources early.

BUG=441698,441751,440213

Review URL: https://codereview.chromium.org/800133002

Cr-Commit-Position: refs/heads/master@{#308236}
parent caa3215e
...@@ -169,8 +169,11 @@ void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { ...@@ -169,8 +169,11 @@ void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
} }
void Display::OnSurfaceDamaged(SurfaceId surface) { void Display::OnSurfaceDamaged(SurfaceId surface) {
if (aggregator_ && aggregator_->previous_contained_surfaces().count(surface)) if (aggregator_ &&
aggregator_->previous_contained_surfaces().count(surface)) {
aggregator_->ReleaseResources(surface);
client_->DisplayDamaged(); client_->DisplayDamaged();
}
} }
SurfaceId Display::CurrentSurfaceId() { SurfaceId Display::CurrentSurfaceId() {
......
...@@ -438,4 +438,13 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { ...@@ -438,4 +438,13 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
return frame.Pass(); return frame.Pass();
} }
void SurfaceAggregator::ReleaseResources(SurfaceId surface_id) {
SurfaceToResourceChildIdMap::iterator it =
surface_id_to_resource_child_id_.find(surface_id);
if (it != surface_id_to_resource_child_id_.end()) {
provider_->DestroyChild(it->second);
surface_id_to_resource_child_id_.erase(it);
}
}
} // namespace cc } // namespace cc
...@@ -32,6 +32,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator { ...@@ -32,6 +32,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
~SurfaceAggregator(); ~SurfaceAggregator();
scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id);
void ReleaseResources(SurfaceId surface_id);
SurfaceIndexMap& previous_contained_surfaces() { SurfaceIndexMap& previous_contained_surfaces() {
return previous_contained_surfaces_; return previous_contained_surfaces_;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment