feat(render): unify physical residency accounting

This commit is contained in:
Erik 2026-07-24 16:20:48 +02:00
parent 1866ea0c6d
commit 3e18fc2730
25 changed files with 642 additions and 48 deletions

View file

@ -0,0 +1,22 @@
namespace AcDream.App.Rendering.Residency;
internal sealed class DelegateResidencyDomainSource(
ResidencyDomain domain,
Func<ResidencyDomainSnapshot> capture) : IResidencyDomainSource
{
private readonly Func<ResidencyDomainSnapshot> _capture =
capture ?? throw new ArgumentNullException(nameof(capture));
public ResidencyDomain Domain { get; } = domain;
public ResidencyDomainSnapshot CaptureResidency()
{
ResidencyDomainSnapshot snapshot = _capture();
if (snapshot.Domain != Domain)
{
throw new InvalidOperationException(
$"Residency source {Domain} returned {snapshot.Domain}.");
}
return snapshot;
}
}