From 1edbe36ce92fef2c4d427f5c4e104f2758f4b692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20B=C5=82oniarz?= Date: Tue, 25 Jun 2024 18:11:47 -0700 Subject: [PATCH] Add missing `WithRuntimeDecorator` methods 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. X-link: https://github.com/facebook/react-native/pull/45042 Reviewed By: fbmal7 Differential Revision: D58744051 Pulled By: neildhar fbshipit-source-id: 3f5c85d0bf7cd6445d0c434ac4ae7ed54df203ba --- API/jsi/jsi/decorator.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/API/jsi/jsi/decorator.h b/API/jsi/jsi/decorator.h index 6f4351a420d..738804b07bd 100644 --- a/API/jsi/jsi/decorator.h +++ b/API/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);