-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor(Worklets): move serializable factories #8560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| jsi::Value makeSerializableString(jsi::Runtime &rt, const jsi::String &string) { | ||
| const auto serializable = std::make_shared<SerializableString>(string.utf8(rt)); | ||
| return SerializableJSRef::newNativeStateObject(rt, serializable); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about converting these function into several makeSerializable static methods with different argument types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my long-term plan but for the atomic PRs and ease of review I decided to move it to a separate file for now.
| : BaseClass(rt, std::forward<Args>(args)...), primaryRuntime_(&rt) {} | ||
|
|
||
| jsi::Value toJSValue(jsi::Runtime &rt); | ||
| jsi::Value toJSValue(jsi::Runtime &rt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for having this function inlined? It makes debugging more challenging and historically we had a serious bug right in this place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a method of a generic class so it must be available for the compilation units which need it. Previously the only compilation units that needed the definition were in Serializable.cpp so they had access to the template. Now that the functions were moved to SerializableFactory.h/cpp they need to have access to the template through the header file.
Summary
Granular PR for the ease of review of refactor of some of Serializables native code, extracted from #8555.
Test plan
CI