From 6dad2c45eebb7f81d9c21dcae3837f5665586efe Mon Sep 17 00:00:00 2001 From: Mathieu Lafon Date: Wed, 22 Sep 2021 11:09:38 +0000 Subject: [PATCH] osr: Implement InvalidateLocalSurfaceIdOnEviction (fixes issue #2483) This fixes an empty-rendering issue when the view is shown after being evicted. --- libcef/browser/osr/render_widget_host_view_osr.cc | 4 +++- libcef/browser/osr/render_widget_host_view_osr.h | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index fe2f2c094..240b3ecc0 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -114,7 +114,9 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient { return view_->render_widget_host()->CollectSurfaceIdsForEviction(); } - void InvalidateLocalSurfaceIdOnEviction() override {} + void InvalidateLocalSurfaceIdOnEviction() override { + view_->InvalidateLocalSurfaceId(); + } bool ShouldShowStaleContentOnEviction() override { return false; } diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 7a5ac1da7..518838c5f 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -275,6 +275,11 @@ class CefRenderWidgetHostViewOSR void ReleaseCompositor(); + // Marks the current viz::LocalSurfaceId as invalid. AllocateLocalSurfaceId + // must be called before submitting new CompositorFrames. May be called by + // content::DelegatedFrameHostClient::InvalidateLocalSurfaceIdOnEviction. + void InvalidateLocalSurfaceId(); + private: void SetFrameRate(); bool SetDeviceScaleFactor(); @@ -322,10 +327,6 @@ class CefRenderWidgetHostViewOSR // Returns the current viz::LocalSurfaceIdAllocation. const viz::LocalSurfaceId& GetOrCreateLocalSurfaceId(); - // Marks the current viz::LocalSurfaceId as invalid. AllocateLocalSurfaceId - // must be called before submitting new CompositorFrames. - void InvalidateLocalSurfaceId(); - void AddDamageRect(uint32_t sequence, const gfx::Rect& rect); // Applies background color without notifying the RenderWidget about