From 175e725cf948d1a0ba84011eb262839afb30269d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20B=C5=82oniarz?= Date: Mon, 24 Jun 2024 10:40:24 -0700 Subject: [PATCH] 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 Differential Revision: D58744051 Pulled By: neildhar --- .../react-native/ReactCommon/jsi/jsi/decorator.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/react-native/ReactCommon/jsi/jsi/decorator.h b/packages/react-native/ReactCommon/jsi/jsi/decorator.h index 6f4351a420da69..738804b07bdb8e 100644 --- a/packages/react-native/ReactCommon/jsi/jsi/decorator.h +++ b/packages/react-native/ReactCommon/jsi/jsi/decorator.h @@ -654,6 +654,20 @@ class WithRuntimeDecorator : public RuntimeDecorator { return RD::getHostFunction(f); }; + bool hasNativeState(const Object& o) override { + Around around{with_}; + return RD::hasNativeState(o); + }; + std::shared_ptr getNativeState(const Object& o) override { + Around around{with_}; + return RD::getNativeState(o); + }; + void setNativeState(const Object& o, std::shared_ptr 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);