debugEmptyFrameDiagnosis static method

  1. @visibleForTesting
({String? message, bool warned}) debugEmptyFrameDiagnosis({
  1. required bool warned,
  2. required bool drewSomething,
  3. required bool regionEmpty,
  4. required bool noViews,
  5. required bool noScreenViews,
  6. required int meshCount,
  7. required int visibleMeshCount,
  8. required bool anyLayerMaskZero,
  9. required List<int> screenViewMasks,
  10. required int visibleLayersUnion,
})

Diagnoses a frame that issued zero draw calls, for renderViews.

Returns the message to print (null when nothing should print) and the next state of the once-only latch. A frame that drew (drewSomething) clears the latch so a later regression prints again; a blank frame prints one message the first time and stays silent until a frame draws. The caller invokes this inside an assert, so neither it nor the scan feeding it costs anything in a release build.

Implementation

@visibleForTesting
static ({String? message, bool warned}) debugEmptyFrameDiagnosis({
  required bool warned,
  required bool drewSomething,
  required bool regionEmpty,
  required bool noViews,
  required bool noScreenViews,
  required int meshCount,
  required int visibleMeshCount,
  required bool anyLayerMaskZero,
  required List<int> screenViewMasks,
  required int visibleLayersUnion,
}) {
  if (drewSomething) return (message: null, warned: false);
  if (warned) return (message: null, warned: true);
  final cause = _blankFrameCause(
    regionEmpty: regionEmpty,
    noViews: noViews,
    noScreenViews: noScreenViews,
    meshCount: meshCount,
    visibleMeshCount: visibleMeshCount,
    anyLayerMaskZero: anyLayerMaskZero,
    screenViewMasks: screenViewMasks,
    visibleLayersUnion: visibleLayersUnion,
  );
  return (
    message: 'Flutter Scene rendered a blank frame (zero draw calls). $cause',
    warned: true,
  );
}