mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 00:34:25 +00:00
The services the pipeline touches on every run live in one PassState with a RefCell field each. The begin hook of a context's outermost pass on a thread moves it out of context data into the thread; the end hook moves it back. Inside a pass a service access is a borrow of a plain field: no TypeId map probe, no Arc handle, no mutex. Access outside a pass holds the state for that one call. PerViewport types say where their records live through the Stored trait: a context service by default, a PassState field for the pass-local ones. The thread-local handle map (HANDLES, ContextToken, open_handles) goes; Service::run is a context-data lookup for the services that stay there. A testing counter of those lookups backs a trial: a settled pass of forty leaves makes as many lookups as one of ten.