Commit dad1528d authored by vivek.vg@samsung.com's avatar vivek.vg@samsung.com

Implement DelegatedFrameResourceCollectionClient::UnusedResourcesAreAvailable for Android.

Implment UnusedResourcesAreAvailable to send the unused resources back if there are
no pending ACKs.

Also handle the LoseAllResources from ResourceCollection to send back the resources.

R=danakj, sievers

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248892 0039d316-1c4b-4281-b951-d872f2087c98
parent d019c815
...@@ -734,8 +734,25 @@ void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( ...@@ -734,8 +734,25 @@ void RenderWidgetHostViewAndroid::SendDelegatedFrameAck(
ack); ack);
} }
void RenderWidgetHostViewAndroid::SendReturnedDelegatedResources(
uint32 output_surface_id) {
DCHECK(resource_collection_);
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() { 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() { void RenderWidgetHostViewAndroid::DestroyDelegatedContent() {
...@@ -751,13 +768,12 @@ void RenderWidgetHostViewAndroid::SwapDelegatedFrame( ...@@ -751,13 +768,12 @@ void RenderWidgetHostViewAndroid::SwapDelegatedFrame(
bool has_content = !texture_size_in_layer_.IsEmpty(); bool has_content = !texture_size_in_layer_.IsEmpty();
if (output_surface_id != last_output_surface_id_) { 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 // Drop the cc::DelegatedFrameResourceCollection so that we will not return
// any resources from the old output surface with the new output surface id. // any resources from the old output surface with the new output surface id.
if (resource_collection_.get()) { if (resource_collection_.get()) {
if (resource_collection_->LoseAllResources())
SendReturnedDelegatedResources(last_output_surface_id_);
resource_collection_->SetClient(NULL); resource_collection_->SetClient(NULL);
resource_collection_ = NULL; resource_collection_ = NULL;
} }
......
...@@ -261,6 +261,7 @@ class RenderWidgetHostViewAndroid ...@@ -261,6 +261,7 @@ class RenderWidgetHostViewAndroid
void SwapDelegatedFrame(uint32 output_surface_id, void SwapDelegatedFrame(uint32 output_surface_id,
scoped_ptr<cc::DelegatedFrameData> frame_data); scoped_ptr<cc::DelegatedFrameData> frame_data);
void SendDelegatedFrameAck(uint32 output_surface_id); void SendDelegatedFrameAck(uint32 output_surface_id);
void SendReturnedDelegatedResources(uint32 output_surface_id);
void UpdateContentViewCoreFrameMetadata( void UpdateContentViewCoreFrameMetadata(
const cc::CompositorFrameMetadata& frame_metadata); const cc::CompositorFrameMetadata& frame_metadata);
......
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