ComponentTreeRegistry
Thread-safe singleton registry that holds weak references to all ComponentTree instances that are still in memory, including released ones that have not been garbage collected yet.
Gated by enabled so it is zero-cost when disabled. The flag is set by com.facebook.litho.hotreload.LithoHotReloadHandler.install and by Litho Observability in debug and perf builds.
Types
Functions
Counts registered trees by state. Takes no ComponentTree lock, so it is cheap to sample.
Forces a re-resolve on every registered ComponentTree by setting a new root with a fresh component ID via Component.makeShallowCopyWithNewId. This causes every component's render() to be called again (picking up hot-swapped bytecode) while preserving hook state.
Iterates over a snapshot of all unreleased ComponentTree instances.
Marks tree as released. The tree stays in the registry until it is garbage collected, so a released tree that is still reachable can be reported as a leak.
Returns the state of every registered tree. Reads root names under each tree's lock, so use countByState for frequent sampling.