Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_android.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc |
| index 07c4a2a5b2c85bfcd753556b0139b44c9c85b57d..457580edf80c26289eff2afc636075c2b145a9c5 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_android.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_android.cc |
| @@ -734,8 +734,25 @@ void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( |
| ack); |
| } |
| +void RenderWidgetHostViewAndroid::SendReturnedDelegatedResources( |
| + uint32 output_surface_id) { |
| + DCHECK(resource_collection_); |
|
danakj
2014/02/04 18:14:37
Would you mind updating the RWHVAura method to DCH
|
| + |
| + cc::CompositorFrameAck ack; |
| + resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); |
| + DCHECK(!ack.resources.empty()); |
| + |
| + RenderWidgetHostImpl::SendReclaimCompositorResources( |
| + host_->GetRoutingID(), |
| + output_surface_id, |
| + host_->GetProcess()->GetID(), |
| + ack); |
| +} |
| + |
| void RenderWidgetHostViewAndroid::UnusedResourcesAreAvailable() { |
| - // TODO(danakj): If no ack is pending, collect and send resources now. |
| + if (ack_callbacks_.size()) |
| + return; |
| + SendReturnedDelegatedResources(last_output_surface_id_); |
| } |
| void RenderWidgetHostViewAndroid::DestroyDelegatedContent() { |
| @@ -752,13 +769,12 @@ void RenderWidgetHostViewAndroid::SwapDelegatedFrame( |
| bool has_content = !texture_size_in_layer_.IsEmpty(); |
| if (output_surface_id != last_output_surface_id_) { |
| - // TODO(danakj): Lose all resources and send them back here, such as: |
| - // resource_collection_->LoseAllResources(); |
| - // SendReturnedDelegatedResources(last_output_surface_id_); |
| - |
| // Drop the cc::DelegatedFrameResourceCollection so that we will not return |
| // any resources from the old output surface with the new output surface id. |
| if (resource_collection_.get()) { |
| + if (resource_collection_->LoseAllResources()) |
| + SendReturnedDelegatedResources(last_output_surface_id_); |
| + |
| resource_collection_->SetClient(NULL); |
| resource_collection_ = NULL; |
| } |