Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| index 2f27455a8569096ecb3167f748ae9dedebffbcd1..63bbaa42a8fdc1fe0bb27a12509f1d3cb74f964c 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/logging.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "cc/layers/delegated_frame_provider.h" |
| #include "cc/output/compositor_frame.h" |
| #include "cc/output/compositor_frame_ack.h" |
| #include "cc/output/copy_output_request.h" |
| @@ -1470,15 +1471,33 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame( |
| // resources from the old one with resources from the new one which would |
| // have the same id. Changing the layer to showing painted content destroys |
| // the DelegatedRendererLayer. |
| - // TODO(danakj): Lose and return all resources in the delegated layer first. |
| window_->layer()->SetShowPaintedContent(); |
| + |
| + // 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. |
|
piman
2013/10/04 23:42:25
I wonder if we should have the DelegatedFrameResou
danakj
2013/10/07 21:57:39
Hm, if I'm understanding your suggestion, we'll ha
piman
2013/10/08 03:38:08
Ok. The thing I'm kinda worried is below in SendDe
|
| + frame_provider_.reset(); |
| + resource_collection_.reset(); |
| last_output_surface_id_ = output_surface_id; |
| } |
| if (frame_size.IsEmpty()) { |
| - // TODO(danakj): Return all resources in the delegated layer somehow. |
| + DCHECK_EQ(0u, frame_data->resource_list.size()); |
| window_->layer()->SetShowPaintedContent(); |
| } else { |
| - window_->layer()->SetDelegatedFrame(frame_data.Pass(), frame_size_in_dip); |
| + if (!resource_collection_) |
|
piman
2013/10/04 23:42:25
nit: needs {}
danakj
2013/10/07 21:57:39
Done.
|
| + resource_collection_.reset( |
| + new cc::DelegatedFrameResourceCollection(this)); |
| + if (!frame_provider_ || frame_size != frame_provider_->frame_size()) { |
| + frame_provider_.reset(new cc::DelegatedFrameProvider( |
| + resource_collection_.get(), frame_data.Pass())); |
| + window_->layer()->SetShowDelegatedContent(frame_provider_.get(), |
| + frame_size_in_dip); |
| + } else { |
| + frame_provider_->SetFrameData(frame_data.Pass()); |
| + } |
| } |
| released_front_lock_ = NULL; |
| current_frame_size_ = frame_size_in_dip; |
| @@ -1503,10 +1522,16 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame( |
| void RenderWidgetHostViewAura::SendDelegatedFrameAck(uint32 output_surface_id) { |
| cc::CompositorFrameAck ack; |
| - window_->layer()->TakeUnusedResourcesForChildCompositor(&ack.resources); |
| - RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
| - host_->GetRoutingID(), output_surface_id, |
| - host_->GetProcess()->GetID(), ack); |
| + if (resource_collection_) |
| + resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); |
| + RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), |
| + output_surface_id, |
| + host_->GetProcess()->GetID(), |
| + ack); |
| +} |
| + |
| +void RenderWidgetHostViewAura::UnusedResourcesAreAvailable() { |
| + // TODO(danakj): If no ack is pending, collect and send resources now. |
| } |
| void RenderWidgetHostViewAura::SwapSoftwareFrame( |