From 8ca0b4580ebd3e42856779824fb08f5f11b22a7c Mon Sep 17 00:00:00 2001 From: elad bahar Date: Wed, 8 Jan 2020 12:33:57 +0000 Subject: [PATCH] Fix OSR rendering recovery after GPU process crash (fixes issue #2827) --- .../browser/osr/render_widget_host_view_osr.cc | 17 ++++++++++++++--- .../browser/osr/render_widget_host_view_osr.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 124ee84b5..7596e2196 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -435,6 +435,17 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink( void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame() {} +void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete( + const cc::RenderFrameMetadata& metadata) { + bool force = false; + if (metadata.local_surface_id_allocation) { + force = local_surface_id_allocator_.UpdateFromChild( + *metadata.local_surface_id_allocation); + } + + SynchronizeVisualProperties(force); +} + void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence, const gfx::Rect& rect) { // Associate the given damage rect with the presentation token. @@ -700,9 +711,9 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() { viz::ScopedSurfaceIdAllocator CefRenderWidgetHostViewOSR::DidUpdateVisualProperties( const cc::RenderFrameMetadata& metadata) { - base::OnceCallback allocation_task = - base::BindOnce(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties, - weak_ptr_factory_.GetWeakPtr(), false); + base::OnceCallback allocation_task = base::BindOnce( + &CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete, + weak_ptr_factory_.GetWeakPtr(), metadata); return viz::ScopedSurfaceIdAllocator(std::move(allocation_task)); } #endif diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index ec6d7c548..951d79d36 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -268,6 +268,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, void OnPresentCompositorFrame(); + void OnDidUpdateVisualPropertiesComplete( + const cc::RenderFrameMetadata& metadata); + private: content::DelegatedFrameHost* GetDelegatedFrameHost() const;