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

Unified Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 1199963011: Force new surface on BrowserPluginGuest reattach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test, and add check for null surface id in test. Created 5 years, 6 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
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 dee512201fa42dd20f15dd2f97cd8ecf79e9a6ac..b06464e2a0a2400899b78ea5f1748eb9898810bd 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -207,8 +207,11 @@ void RenderWidgetHostViewGuest::SetTooltipText(
void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) {
- if (!guest_)
+ 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
@@ -237,10 +240,9 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
}
if (output_surface_id != last_output_surface_id_ ||
frame_size != current_surface_size_ ||
- scale_factor != current_surface_scale_factor_) {
- if (surface_factory_ && !surface_id_.is_null())
- surface_factory_->Destroy(surface_id_);
- surface_id_ = cc::SurfaceId();
+ scale_factor != current_surface_scale_factor_ ||
+ guest_->has_attached_since_surface_set()) {
+ ClearCompositorSurfaceIfNecessary();
last_output_surface_id_ = output_surface_id;
current_surface_size_ = frame_size;
current_surface_scale_factor_ = scale_factor;

Powered by Google App Engine
This is Rietveld 408576698