Skip to content

Commit 07420ea

Browse files
bartlomiejbloniarzcortinico
authored andcommitted
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: #45042 Reviewed By: fbmal7 Differential Revision: D58744051 Pulled By: neildhar fbshipit-source-id: 3f5c85d0bf7cd6445d0c434ac4ae7ed54df203ba
1 parent 173587f commit 07420ea

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/react-native/ReactCommon/jsi/jsi/decorator.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,20 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
654654
return RD::getHostFunction(f);
655655
};
656656

657+
bool hasNativeState(const Object& o) override {
658+
Around around{with_};
659+
return RD::hasNativeState(o);
660+
};
661+
std::shared_ptr<NativeState> getNativeState(const Object& o) override {
662+
Around around{with_};
663+
return RD::getNativeState(o);
664+
};
665+
void setNativeState(const Object& o, std::shared_ptr<NativeState> state)
666+
override {
667+
Around around{with_};
668+
RD::setNativeState(o, state);
669+
};
670+
657671
Value getProperty(const Object& o, const PropNameID& name) override {
658672
Around around{with_};
659673
return RD::getProperty(o, name);

0 commit comments

Comments
 (0)