Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 153683002: Implement DelegatedFrameResourceCollectionClient::UnusedResourcesAreAvailable for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aca1c5801b9212072e22a4d9d578feaefd47d44e..50f052123c22b81e50f73fde4167441d8be25feb 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_);
+
+ 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;
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698