diff --git a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.cpp b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.cpp index 67bf3c5f9e1..63c293f38ce 100644 --- a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.cpp +++ b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.cpp @@ -7,6 +7,9 @@ #include "BufferedRuntimeExecutor.h" +#include +#include + namespace facebook::react { BufferedRuntimeExecutor::BufferedRuntimeExecutor(Executor executor) @@ -14,10 +17,6 @@ BufferedRuntimeExecutor::BufferedRuntimeExecutor(Executor executor) isBufferingEnabled_(true), lastIndex_(0) {} -void BufferedRuntimeExecutor::execute(Work&& callback) { - execute(SchedulerPriority::ImmediatePriority, std::move(callback)); -} - void BufferedRuntimeExecutor::execute( SchedulerPriority priority, Work&& callback) { @@ -35,7 +34,7 @@ void BufferedRuntimeExecutor::execute( uint64_t newIndex = lastIndex_++; std::scoped_lock guard(lock_); if (isBufferingEnabled_) { - queue_.push( + queue_.push_back( {.index_ = newIndex, .work_ = std::move(callback), .priority_ = priority}); @@ -48,6 +47,20 @@ void BufferedRuntimeExecutor::execute( executor_(priority, std::move(callback)); } +RuntimeExecutor BufferedRuntimeExecutor::asRuntimeExecutor() { + return [self = shared_from_this()](Work&& callback) { + self->execute(SchedulerPriority::ImmediatePriority, std::move(callback)); + }; +} + +RuntimeExecutor BufferedRuntimeExecutor::asWeakRuntimeExecutor() { + return [weakSelf = weak_from_this()](Work&& callback) { + if (auto self = weakSelf.lock()) { + self->execute(SchedulerPriority::ImmediatePriority, std::move(callback)); + } + }; +} + void BufferedRuntimeExecutor::flush() { std::scoped_lock guard(lock_); unsafeFlush(); @@ -55,11 +68,20 @@ void BufferedRuntimeExecutor::flush() { } void BufferedRuntimeExecutor::unsafeFlush() { - while (!queue_.empty()) { - const BufferedWork& bufferedWork = queue_.top(); - Work work = bufferedWork.work_; - executor_(bufferedWork.priority_, std::move(work)); - queue_.pop(); + // Indices are handed out before the lock is taken, so arrival order can + // differ from submission order. Sorting once here restores it, and costs less + // than a heap did: nothing sifts on the way in, and each callback is moved + // out rather than copied. + auto batch = std::move(queue_); + queue_.clear(); + std::sort( + batch.begin(), + batch.end(), + [](const BufferedWork& lhs, const BufferedWork& rhs) { + return lhs.index_ < rhs.index_; + }); + for (auto& bufferedWork : batch) { + executor_(bufferedWork.priority_, std::move(bufferedWork.work_)); } } diff --git a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h index c5809f679e3..a29b3fc702c 100644 --- a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h +++ b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h @@ -13,39 +13,26 @@ #include #include #include +#include #include -#include +#include namespace facebook::react { -class BufferedRuntimeExecutor { +class BufferedRuntimeExecutor : public std::enable_shared_from_this { public: using Work = std::function; - /** - * Drains one piece of buffered work. Always given a priority; an executor - * that sits below the RuntimeScheduler, and so has no notion of one, ignores - * it. - */ + // Drains one piece of buffered work, priority may be ignored using Executor = std::function; - // A utility structure to track pending work in the order of when they arrive. - struct BufferedWork { - uint64_t index_; - Work work_; - SchedulerPriority priority_; - bool operator<(const BufferedWork &rhs) const - { - // Higher index has lower priority, so this inverted comparison puts - // the smaller index on top of the queue. - return index_ > rhs.index_; - } - }; - + // Must be constructed as a shared_ptr, or as(Weak)RuntimeExecutor will not work correctly BufferedRuntimeExecutor(Executor executor); - /** Equivalent to `execute(SchedulerPriority::ImmediatePriority, ...)`. */ - void execute(Work &&callback); + void execute(Work &&callback) + { + execute(SchedulerPriority::ImmediatePriority, std::move(callback)); + } /** * Buffers [callback] alongside work submitted through the other overload, @@ -54,6 +41,18 @@ class BufferedRuntimeExecutor { */ void execute(SchedulerPriority priority, Work &&callback); + /** + * RuntimeExecutor, keeping this class alive for as long as the result is + * held. + */ + RuntimeExecutor asRuntimeExecutor(); + + /** + * RuntimeExecutor, keeping a weak reference to this class, so it does not + * keep the runtime alive unnecessarily. + */ + RuntimeExecutor asWeakRuntimeExecutor(); + // Flush buffered JS calls and then diable JS buffering void flush(); @@ -61,11 +60,18 @@ class BufferedRuntimeExecutor { // Perform flushing without locking mechanism void unsafeFlush(); + // A utility structure to track pending work in the order of when they arrive. + struct BufferedWork { + uint64_t index_; + Work work_; + SchedulerPriority priority_; + }; + Executor executor_; std::atomic isBufferingEnabled_; std::mutex lock_; std::atomic lastIndex_; - std::priority_queue queue_; + std::vector queue_; }; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp b/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp index 97a4a6eec34..3dd07272d1c 100644 --- a/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp +++ b/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp @@ -115,8 +115,8 @@ ReactInstance::ReactInstance( // This buffer sits *below* the RuntimeScheduler — it is what feeds it — so // there is nothing here that could act on a priority, and passing one // through would have nowhere to go. Its only caller is - // `runtimeExecutorThatExecutesAfterInspectorSetup` below, a plain - // RuntimeExecutor, so in practice everything arrives at the default. + // `runtimeScheduler` below, a plain RuntimeExecutor, so in practice + // everything arrives at the default priority. auto bufferedRuntimeExecutorThatWaitsForInspectorSetup = std::make_shared( [runtimeExecutor]( @@ -124,32 +124,18 @@ ReactInstance::ReactInstance( std::function&& callback) { runtimeExecutor(std::move(callback)); }); - auto runtimeExecutorThatExecutesAfterInspectorSetup = - [bufferedRuntimeExecutorThatWaitsForInspectorSetup]( - std::function&& callback) { - bufferedRuntimeExecutorThatWaitsForInspectorSetup->execute( - std::move(callback)); - }; runtimeScheduler_ = createRuntimeScheduler( - runtimeExecutorThatExecutesAfterInspectorSetup, + bufferedRuntimeExecutorThatWaitsForInspectorSetup->asRuntimeExecutor(), [jsErrorHandler = jsErrorHandler_]( jsi::Runtime& runtime, jsi::JSError& error) { jsErrorHandler->handleError(runtime, error, true); }); - auto runtimeExecutorThatGoesThroughRuntimeScheduler = - [runtimeScheduler = runtimeScheduler_.get()]( - std::function&& callback) { - runtimeScheduler->scheduleWork(std::move(callback)); - }; - // This code can execute from any thread, so we need to make sure we set up // the inspector logic in the right one. The callback executes immediately // if we are already in the right thread. - executor([this, - runtimeExecutorThatGoesThroughRuntimeScheduler, - bufferedRuntimeExecutorThatWaitsForInspectorSetup]( + executor([this, bufferedRuntimeExecutorThatWaitsForInspectorSetup]( jsinspector_modern::HostTarget& hostTarget) { // Callbacks scheduled through the page target executor are generally // not guaranteed to run (e.g.: if the page target is destroyed) @@ -160,8 +146,7 @@ ReactInstance::ReactInstance( // creation task to finish before starting the destruction. inspectorTarget_ = &hostTarget.registerInstance(*this); runtimeInspectorTarget_ = &inspectorTarget_->registerRuntime( - runtime_->getRuntimeTargetDelegate(), - runtimeExecutorThatGoesThroughRuntimeScheduler); + runtime_->getRuntimeTargetDelegate(), getUnbufferedRuntimeExecutor()); bufferedRuntimeExecutorThatWaitsForInspectorSetup->flush(); }); } else { @@ -178,9 +163,9 @@ ReactInstance::ReactInstance( setHermesEventLoopControl(runtime, runtimeScheduler); }); - // `scheduleWork` is `scheduleTask(ImmediatePriority)` on the modern - // scheduler, which is the only one bridgeless uses, so routing everything - // through `scheduleTask` leaves unprioritised callers where they were. + // Note that bufferedRuntimeExecutor_ only has a raw pointer to + // RuntimeScheduler It should always be retained weakly, as it should be + // destroyed when the runtime is. bufferedRuntimeExecutor_ = std::make_shared( [runtimeScheduler = runtimeScheduler_.get()]( SchedulerPriority priority, @@ -214,7 +199,8 @@ void ReactInstance::unregisterFromInspector() { RuntimeExecutor ReactInstance::getUnbufferedRuntimeExecutor() noexcept { return [runtimeScheduler = runtimeScheduler_.get()]( std::function&& callback) { - runtimeScheduler->scheduleWork(std::move(callback)); + runtimeScheduler->scheduleTask( + SchedulerPriority::ImmediatePriority, std::move(callback)); }; } @@ -223,14 +209,7 @@ RuntimeExecutor ReactInstance::getUnbufferedRuntimeExecutor() noexcept { // getUnbufferedRuntimeExecutor() instead if you do not need the main JS // bundle to have finished. e.g. setting global variables into JS runtime. RuntimeExecutor ReactInstance::getBufferedRuntimeExecutor() noexcept { - return [weakBufferedRuntimeExecutor_ = - std::weak_ptr(bufferedRuntimeExecutor_)]( - std::function&& callback) { - if (auto strongBufferedRuntimeExecutor_ = - weakBufferedRuntimeExecutor_.lock()) { - strongBufferedRuntimeExecutor_->execute(std::move(callback)); - } - }; + return bufferedRuntimeExecutor_->asWeakRuntimeExecutor(); } // TODO(T184010230): Should the RuntimeScheduler returned from this method be diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index dbc39b765f3..18a38828470 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -1901,8 +1901,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1910,13 +1912,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index 2e0f57b2235..7f0630ec73e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -1895,8 +1895,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1904,13 +1906,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index c057c28b79b..03820149151 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -1899,8 +1899,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1908,13 +1910,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index c23703c476a..3cbcef3a37a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -4484,8 +4484,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -4493,13 +4495,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 95f5e8b375f..4e2375cba07 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -4471,8 +4471,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -4480,13 +4482,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 9e9d12b2d5f..4bab7ec6174 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -4482,8 +4482,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -4491,13 +4493,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api index 97903e19cc4..55a96221e96 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api @@ -1207,8 +1207,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1216,13 +1218,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api index 48a176dc704..e508925f854 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api @@ -1202,8 +1202,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1211,13 +1213,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default; diff --git a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api index 3eef4b97c94..51b13882572 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api @@ -1205,8 +1205,10 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac public virtual void invokeSync(const std::string& methodName, facebook::react::NativeMethodCallFunc&& func) override; } -class facebook::react::BufferedRuntimeExecutor { +class facebook::react::BufferedRuntimeExecutor : public std::enable_shared_from_this { public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor); + public facebook::react::RuntimeExecutor asRuntimeExecutor(); + public facebook::react::RuntimeExecutor asWeakRuntimeExecutor(); public using Executor = std::function; public using Work = std::function; public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback); @@ -1214,13 +1216,6 @@ class facebook::react::BufferedRuntimeExecutor { public void flush(); } -struct facebook::react::BufferedRuntimeExecutor::BufferedWork { - public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const; - public facebook::react::BufferedRuntimeExecutor::Work work_; - public facebook::react::SchedulerPriority priority_; - public uint64_t index_; -} - class facebook::react::CSSSyntaxParser { public constexpr CSSSyntaxParser(const facebook::react::CSSSyntaxParser&) = default; public constexpr CSSSyntaxParser(facebook::react::CSSSyntaxParser&&) = default;