Skip to main content

euv_core/app/accounting/
enum.rs

1/// Coarse ownership domain responsible for the lifecycle of a tracked framework resource.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub enum ResourceOwnerKind {
4    /// Process-wide singleton runtime infrastructure.
5    #[default]
6    GlobalRuntime,
7    /// Routed page instance identified by `(page_id, generation)`.
8    Page,
9    /// Dynamically loaded WASM/OTA module instance.
10    DynamicModule,
11    /// OS window surface generation.
12    Surface,
13    /// Active audio/video media playback or decoder session.
14    MediaSession,
15    /// Bounded framework cache (glyph atlas, shaping cache, tile pool).
16    RenderCache,
17}
18
19/// Framework resource category tracked by `ResourceAccountant`.
20#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
21pub enum TrackedResourceKind {
22    /// Retained UI scene graph node.
23    #[default]
24    SceneNode,
25    /// Reactive effect closure bound to a scope.
26    ReactiveEffect,
27    /// Event or signal subscription handle.
28    Subscription,
29    /// Scheduled timer or animation ticker.
30    Timer,
31    /// In-flight asynchronous task or callback.
32    AsyncTask,
33    /// Dynamically loaded component/page module instance.
34    DynamicInstance,
35    /// Native OS window, surface, font, or platform handle.
36    OsHandle,
37    /// GPU texture allocation (atlas, image, or persistent tile layer).
38    GpuTexture,
39    /// GPU vertex, index, uniform, or staging buffer allocation.
40    GpuBuffer,
41    /// Bounded CPU or GPU cache allocation.
42    CacheAllocation,
43}
44
45/// Expected lifecycle retention classification separating intentional caches from leaked objects.
46#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub enum ResourceRetentionClass {
48    /// Actively owned by a live foreground/runtime owner.
49    #[default]
50    Active,
51    /// Intentionally retained within a bounded cache or frozen-page retention budget.
52    ExpectedRetained,
53    /// Owned by a destroyed owner or evicted cache awaiting GPU fence completion before final release.
54    PendingFenceRelease,
55}