feat(render): unify physical residency accounting
This commit is contained in:
parent
1866ea0c6d
commit
3e18fc2730
25 changed files with 642 additions and 48 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue