summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. James MacLean <wjmaclean@chromium.org>2016-03-09 15:23:48 -0500
committerW. James MacLean <wjmaclean@chromium.org>2016-03-09 20:26:20 +0000
commita050c821fdd32be6941f9c1938d151ecd58047cc (patch)
treeabbd388710f6ce160559e533cbdb0c8aa59f4bea
parent449279b9ecb1f2b2ff1d20f4a296fcc880badc7c (diff)
downloadchromium_src-a050c821fdd32be6941f9c1938d151ecd58047cc.zip
chromium_src-a050c821fdd32be6941f9c1938d151ecd58047cc.tar.gz
chromium_src-a050c821fdd32be6941f9c1938d151ecd58047cc.tar.bz2
Frames received after guest detaches should be displayed.
In RenderWidgetHostViewGuest::OnSwapCompositorFrame() we currently detect if the guest has been detached, and if it has we clear the compositor surface and exit without processing the frame we've been given. Based on the repro app in the associated bug, it seems that if this happens, it prevents subsequent frames from being sent, presumably on account of the most recent frame remaining unsatisfied. This CL modifies the logic to complete processing of the frame, and then clearing the surface. This appears to prevent the behaviour observed in the bug. BUG=581440 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Review URL: https://codereview.chromium.org/1772393002 Cr-Commit-Position: refs/heads/master@{#380134} (cherry picked from commit 17f1c1ded552cbcd11cac1b7985593ea2c847808) Review URL: https://codereview.chromium.org/1776673005 . Cr-Commit-Position: refs/branch-heads/2623@{#605} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r--content/browser/frame_host/render_widget_host_view_guest.cc11
1 files changed, 5 insertions, 6 deletions
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 6d4a181..9240afb 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -234,12 +234,6 @@ 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;
- }
-
last_scroll_offset_ = frame->metadata.root_scroll_offset;
// When not using surfaces, the frame just gets proxied to
// the embedder's renderer to be composited.
@@ -298,6 +292,11 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
DCHECK(ack_pending_count_ < 1000);
surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame),
ack_callback);
+ // 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.
+ if (!guest_ || !guest_->attached())
+ ClearCompositorSurfaceIfNecessary();
}
bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) {