Tidy the bridgeless runtime executor plumbing (#58325) - #58325
Open
javache wants to merge 1 commit into
Open
Conversation
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118616045. |
Summary: Follow-ups to the buffered CallInvoker, kept out of that diff so the behavioural change stays reviewable on its own. No behaviour change intended here. - `BufferedRuntimeExecutor` gains `asRuntimeExecutor()` and `asWeakRuntimeExecutor()`. RuntimeExecutor is a std::function, so callers cannot hand it the object and instead each hand-rolled the same capturing lambda; the ownership question now has one answer per lifetime policy. The weak form is what `getBufferedRuntimeExecutor` needs, which must not keep the instance alive. - `BufferedWork` becomes private. It was only ever an implementation detail, and being public put its fields in the C++ API snapshot. - The buffer holds a `std::vector` sorted once at flush rather than a `std::priority_queue`. Indices are handed out before the lock, so arrival order can differ from submission order and something has to restore it — but a heap is the expensive way. `std::priority_queue::top()` returns a const reference, so every flushed item copied its `std::function` on the way out; that copy is now a move, and nothing sifts on the way in. - `runtimeExecutorThatGoesThroughRuntimeScheduler` was a second copy of `getUnbufferedRuntimeExecutor()`; it now calls it. - `RuntimeSchedulerCallInvoker` is marked deprecated. Its remaining users are migrated: `ReactCxxPlatform` holds a `ReactInstance` and can use `createJSCallInvoker()`, and four other files only `#include`d it without ever constructing one. The single remaining use is the flag-off branch, which is suppressed locally and goes when the flag is cleaned up. - Drops a null check on `bufferedRuntimeExecutor_` in `callFunctionOnModule` that the constructor makes unreachable. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D118616045
javache
force-pushed
the
export-D118616045
branch
from
September 7, 2026 14:56
64b60c2 to
8910783
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Follow-ups to the buffered CallInvoker, kept out of that diff so the behavioural
change stays reviewable on its own. No behaviour change intended here.
BufferedRuntimeExecutorgainsasRuntimeExecutor()andasWeakRuntimeExecutor(). RuntimeExecutor is a std::function, so callerscannot hand it the object and instead each hand-rolled the same capturing
lambda; the ownership question now has one answer per lifetime policy. The
weak form is what
getBufferedRuntimeExecutorneeds, which must not keep theinstance alive.
BufferedWorkbecomes private. It was only ever an implementation detail, andbeing public put its fields in the C++ API snapshot.
std::vectorsorted once at flush rather than astd::priority_queue. Indices are handed out before the lock, so arrivalorder can differ from submission order and something has to restore it — but a
heap is the expensive way.
std::priority_queue::top()returns a constreference, so every flushed item copied its
std::functionon the way out;that copy is now a move, and nothing sifts on the way in.
runtimeExecutorThatGoesThroughRuntimeSchedulerwas a second copy ofgetUnbufferedRuntimeExecutor(); it now calls it.RuntimeSchedulerCallInvokeris marked deprecated. Its remaining users aremigrated:
ReactCxxPlatformholds aReactInstanceand can usecreateJSCallInvoker(), and four other files only#included it without everconstructing one. The single remaining use is the flag-off branch, which is
suppressed locally and goes when the flag is cleaned up.
bufferedRuntimeExecutor_incallFunctionOnModulethat the constructor makes unreachable.
Changelog:
[Internal]
Reviewed By: christophpurrer
Differential Revision: D118616045