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

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

Issue 2346863004: Speculative fix for OnSwapCompositorFrame crasher. (Closed)
Patch Set: Don't try to set surface if guest is destructing. Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cdb2d1799beccd2d50f0f35f1589df85cae22850..3fd814852f9e1445ecc8af62fe82e213d3628bd5 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -283,7 +283,7 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
if (output_surface_id != last_output_surface_id_ ||
frame_size != current_surface_size_ ||
scale_factor != current_surface_scale_factor_ ||
- guest_->has_attached_since_surface_set()) {
+ (guest_ && guest_->has_attached_since_surface_set())) {
ClearCompositorSurfaceIfNecessary();
last_output_surface_id_ = output_surface_id;
current_surface_size_ = frame_size;
@@ -305,8 +305,14 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
// SurfaceLayer.
cc::SurfaceManager* manager = GetSurfaceManager();
manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence);
- guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor,
- sequence);
+ // TODO(wjmaclean): I'm not sure what it means to create a surface id
+ // without setting it on the child, though since we will in this case be
+ // guaranteed to call ClearCompositorSurfaceIfNecessary() below, I suspect
+ // skipping SetChildFrameSurface() here is irrelevant.
+ if (guest_ && !guest_->is_in_destruction()) {
Charlie Reis 2016/09/19 17:29:21 If the crash is actually a UaF on guest_, then nei
+ guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor,
+ sequence);
+ }
}
cc::SurfaceFactory::DrawCallback ack_callback = base::Bind(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698