core/cache/screen_merge
library
Classes
-
NodeMergeResult
-
Result of a node-set merge: the union, and whether anything changed.
Constants
-
kMaxNodesPerOverlay
→ const int
-
Ceiling on one overlay record's node union. A dialog or sheet is a small
surface; anything larger is a list-in-a-sheet growing the union.
-
kMaxNodesPerScreen
→ const int
-
Ceiling on how many nodes one screen file retains.
-
kMaxOverlayNodesPerScreen
→ const int
-
Ceiling on overlay nodes across ALL of a screen's overlay records, so a
screen file's total stays within ~2× kMaxNodesPerScreen.
-
kMaxOverlayRecords
→ const int
-
Most overlay records (distinct dialogs / sheets / menus) one screen file
keeps.
-
kMinPruneCoverage
→ const double
-
An incoming capture whose node count is below this fraction of the cached
set is treated as PARTIAL (semantics blocked by a modal barrier, a scrolled
long page, a half-built first frame) and never stamps or prunes.
-
kMissingSinceKey
→ const String
-
Per-node bookkeeping key: when an eligible changing merge first observed
the node ABSENT from the capture. See kStaleNodeMaxAge.
-
kStaleNodeMaxAge
→ const Duration
-
A cached node is pruned once it has been ABSENT from eligible changing
captures spanning at least this long. Bounds the union: a transient ID fork
(a wrapper label that renamed the whole tree for two captures) or a ticker
value that minted its own node stops living in the file — and in every
upload — forever.
-
kVolatileWireKeys
→ const Set<String>
-
Wire keys that change with SCROLL POSITION rather than with structure.
Functions
-
capNodes(List<CachedNode> nodes, int maxNodes, {Set<String> live = const {}})
→ List<CachedNode>
-
Trim a node set to
maxNodes (0 = no cap), preserving nodes' order.
-
mergeNodeUnion(List<CachedNode>? existing, List<CachedNode> incoming, String ts, {DateTime? staleBefore, int maxNodes = 0})
→ NodeMergeResult
-
Union the incoming capture into the cached node set, keyed on
id, then
cap it at maxNodes (0 = uncapped).
-
mergeScreenCache(ScreenCacheFile? existing, UiSnapshot snap, String now(), {int maxNodes = kMaxNodesPerScreen})
→ ScreenCacheFile
-
Merge one capture into a screen's cumulative file.
-
migrateScreenCacheFile(ScreenCacheFile? file)
→ ScreenCacheFile?
-
Format-version migration seam. A file from another format version is
DISCARDED (treated as absent): its node IDs were minted by older stable-ID
rules and would otherwise coexist forever with the new IDs for the same
elements. The next capture rebuilds the screen from scratch.
-
sameWireFields(CachedNode prev, WireNode next)
→ bool
-
Whether the incoming wire node carries the same information as the cached
one.
-
stalePruneCutoff({required String? now, required int existingCount, required int incomingCount, bool hasOpenOverlay = false})
→ DateTime?
-
The
staleBefore cutoff for merging incomingCount nodes into a cached
set of existingCount nodes at time now: now minus kStaleNodeMaxAge.
A node is pruned only if its kMissingSinceKey stamp — itself written by
an earlier eligible changing merge — is at or before this.