Add missing WithRuntimeDecorator methods (#45042)

Summary:
This PR adds missing `WithRuntimeDecorator` methods related to `NativeState`. This pattern is used by reanimated to ensure no concurrent access to the runtime. Without this `override` the `RuntimeDecorator` implementation was used, bypassing our mutex.

Changelog:
[GENERAL] [FIXED] - Add missing `NativeState` methods to the `WithRuntimeDecorator` class.

Pull Request resolved: https://github.com/facebook/react-native/pull/45042

Reviewed By: fbmal7

Differential Revision: D58744051

Pulled By: neildhar

fbshipit-source-id: 3f5c85d0bf7cd6445d0c434ac4ae7ed54df203ba
This commit is contained in:
Bartłomiej Błoniarz
2024-06-25 18:11:47 -07:00
committed by Facebook GitHub Bot
parent 295626bc35
commit 218ea5d44c
@@ -654,6 +654,20 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
return RD::getHostFunction(f);
};
bool hasNativeState(const Object& o) override {
Around around{with_};
return RD::hasNativeState(o);
};
std::shared_ptr<NativeState> getNativeState(const Object& o) override {
Around around{with_};
return RD::getNativeState(o);
};
void setNativeState(const Object& o, std::shared_ptr<NativeState> state)
override {
Around around{with_};
RD::setNativeState(o, state);
};
Value getProperty(const Object& o, const PropNameID& name) override {
Around around{with_};
return RD::getProperty(o, name);