Skip to main content

Module bridge

Module bridge 

Source
Expand description

The JS↔gpui call boundary: raw &mut App / &mut Window pointers are published for a bounded scope with an RAII guard (so a panic cannot leave a dangling pointer), tagged with a Phase. Host functions reach them only through with_commit / with_app; outside a published scope those return None and the caller must throw a JS error rather than touch gpui.

Enums§

Phase

Functions§

describe_panic
drain_owed
install_panic_hook
owe_drain
A dispatch made under a gpui listener leaves its microtask checkpoint owed; every JS entry settles it first (settle_owed_drain). Call BEFORE the dispatch’s call into JS. Keeps the engine’s API lock until settled (JSC drains microtasks when the outermost lock is released). Returns false and owes nothing when JS is already running below the dispatch: owing there keeps a lock past the heap-access release and JSC aborts.
panic_to_js
poison
poison_reason
poison_with
poison, keeping the first reason given: the panic that broke the runtime, not one that followed.
poisoned
settle_owed_drain
Runs the owed checkpoint, if any, and releases the API lock. Every publication runs it first.
with_app
with_commit
The commit-phase accessor; None outside a Phase::Commit publication: throw, don’t fall back.
with_draw
Runs f, a Window::draw made inside a publication, as Phase::Draw: nothing is reachable until it returns (a forced layout draws from inside Phase::Commit; handing the pointers out again would alias).
with_published
Publishes window + cx for the duration of f, after settling an owed checkpoint.
with_published_app