osr: Implement InvalidateLocalSurfaceIdOnEviction (fixes issue #2483)

This fixes an empty-rendering issue when the view is shown after being
evicted.
This commit is contained in:
Mathieu Lafon 2021-09-22 11:09:38 +00:00 committed by Marshall Greenblatt
parent 28599ae1a5
commit 6dad2c45ee
2 changed files with 8 additions and 5 deletions

View File

@ -114,7 +114,9 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
return view_->render_widget_host()->CollectSurfaceIdsForEviction(); return view_->render_widget_host()->CollectSurfaceIdsForEviction();
} }
void InvalidateLocalSurfaceIdOnEviction() override {} void InvalidateLocalSurfaceIdOnEviction() override {
view_->InvalidateLocalSurfaceId();
}
bool ShouldShowStaleContentOnEviction() override { return false; } bool ShouldShowStaleContentOnEviction() override { return false; }

View File

@ -275,6 +275,11 @@ class CefRenderWidgetHostViewOSR
void ReleaseCompositor(); 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: private:
void SetFrameRate(); void SetFrameRate();
bool SetDeviceScaleFactor(); bool SetDeviceScaleFactor();
@ -322,10 +327,6 @@ class CefRenderWidgetHostViewOSR
// Returns the current viz::LocalSurfaceIdAllocation. // Returns the current viz::LocalSurfaceIdAllocation.
const viz::LocalSurfaceId& GetOrCreateLocalSurfaceId(); 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); void AddDamageRect(uint32_t sequence, const gfx::Rect& rect);
// Applies background color without notifying the RenderWidget about // Applies background color without notifying the RenderWidget about