From 719b8c319d97619edc6ac0570805890335b5b405 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 2 Mar 2023 17:12:55 -0800 Subject: [PATCH] Do not end the frame in the raster cache if ScopedFrame::Raster returns kResubmit (flutter/engine#40007) Do not end the frame in the raster cache if ScopedFrame::Raster returns kResubmit --- engine/src/flutter/shell/common/rasterizer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/common/rasterizer.cc b/engine/src/flutter/shell/common/rasterizer.cc index b662665867..e1b1789dad 100644 --- a/engine/src/flutter/shell/common/rasterizer.cc +++ b/engine/src/flutter/shell/common/rasterizer.cc @@ -604,7 +604,12 @@ RasterStatus Rasterizer::DrawToSurfaceUnsafe( frame->Submit(); } - compositor_context_->raster_cache().EndFrame(); + // Do not update raster cache metrics for kResubmit because that status + // indicates that the frame was not actually painted. + if (raster_status != RasterStatus::kResubmit) { + compositor_context_->raster_cache().EndFrame(); + } + frame_timings_recorder.RecordRasterEnd( &compositor_context_->raster_cache()); FireNextFrameCallbackIfPresent();