Index: content/browser/frame_host/render_widget_host_view_guest.cc |
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc |
index 66ef61369b3a1f3093b8604118eecaeeb5508bd3..c22ce75b5b8a7be4453b09c72ca90610e63f3256 100644 |
--- a/content/browser/frame_host/render_widget_host_view_guest.cc |
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc |
@@ -207,11 +207,10 @@ void RenderWidgetHostViewGuest::SetTooltipText( |
void RenderWidgetHostViewGuest::OnSwapCompositorFrame( |
uint32_t output_surface_id, |
scoped_ptr<cc::CompositorFrame> frame) { |
- if (!guest_ || !guest_->attached()) { |
- // We shouldn't hang on to a surface while we are detached. |
- ClearCompositorSurfaceIfNecessary(); |
- return; |
- } |
+ // If after detaching we are sent a frame, we should finish processing it, and |
+ // then we should clear the surface so that we are not holding resources we |
+ // no longer need. |
+ bool should_clear_compositor_surface_on_exit = !guest_ || !guest_->attached(); |
wjmaclean
2016/03/08 16:13:06
We don't actually need to declare a var for this i
|
last_scroll_offset_ = frame->metadata.root_scroll_offset; |
@@ -266,6 +265,9 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame( |
ack_callback); |
ProcessFrameSwappedCallbacks(); |
+ |
+ if (should_clear_compositor_surface_on_exit) |
+ ClearCompositorSurfaceIfNecessary(); |
} |
bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { |