acceptSnapshot method

Future<void> acceptSnapshot(
  1. Object handle,
  2. UiSnapshot snapshot
)

Fan out the live pump's complete capture before its transport budget is applied. During a call this replaces the cache's second semantics walk.

Implementation

Future<void> acceptSnapshot(Object handle, UiSnapshot snapshot) async {
  if (_disposed || !ActionGates.instance.localCacheEnabled) return;
  if (handle is! _CaptureSource || !_sources.contains(handle)) return;
  // Admission and storage can straddle a navigation or an async disk write.
  // A later allowed route must never authorize an earlier excluded capture.
  bool inScope;
  try {
    inScope = handle.isInScope?.call(snapshot.screen.trim()) ?? true;
  } catch (_) {
    inScope = false;
  }
  _pendingSharedCapture = _SharedCapture(handle, snapshot, inScope);
  _captureTimer?.cancel();
  _captureTimer = null;
  _firstTriggerAt = null;
  await _runCapture();
}