feat: park viewport refreshes across worker turns and serialize new input

This commit is contained in:
2026-10-23 01:20:39 +08:00
parent 3a636a8a79
commit ba26e74bea
3 changed files with 40 additions and 3 deletions
+3
View File
@@ -161,3 +161,6 @@ UiBridge::begin_layout_frame/resume_layout_frame now expose PendingLayout around
ReplSession now owns a resumable RefreshWork containing window traversal, pending bridge layout, unpublished per-window documents and the cumulative refresh work budget. poll_refresh advances one refresh stage or VM quantum; only a complete stable pass replaces the session's full document map. Synchronous callers drain the same state machine. Failure stops the domain, releases any pending bridge work and preserves the externally published picture. refreshYields counts cooperative refresh returns, not wall-clock time. Prepared-Mount live rollback remains unfinished.
Viewport refresh now advances through ReplSession's saved refresh state on worker idle turns. A turn advances one traversal stage or a 256-instruction layout quantum; a pending job shortens the next worker wait to 1 ms. Tasks/window commands and document publication wait for complete refresh. ui.stats().refreshYields reports cooperative idle returns. Mutating requests first drain the existing job, so they cannot run inside its read-only scope. This is serialized input, not live cancellation/rollback or latest-input coalescing. Initial loads, explicit REPL/event refresh and task callbacks still drain synchronously; native Rust measurement/paint calls remain atomic.