Skip to content

Commit

Permalink
Add missing WithRuntimeDecorator methods
Browse files Browse the repository at this point in the history
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: facebook/react-native#45042

Reviewed By: fbmal7

Differential Revision: D58744051

Pulled By: neildhar

fbshipit-source-id: 3f5c85d0bf7cd6445d0c434ac4ae7ed54df203ba
  • Loading branch information
bartlomiejbloniarz authored and cortinico committed Jul 1, 2024
1 parent c2c4ee7 commit 1edbe36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions API/jsi/jsi/decorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1edbe36

Please sign in to comment.