mirror of
https://github.com/status-im/react-native.git
synced 2025-02-14 10:26:33 +00:00
Summary: Previously, we used special JSI bindings method to release an event handler (`JSIReleaseFabricEventHandler`). Now we expose this ownership model as a regular `std::shared_ptr`, so when the owner got deallocated, the event handler will be released automatically. Why not use `unique_ptr`? `unique_ptr` is faster (and simpler) indeed, but it does not provide `type erasure` functionality that we need; to use `unique_ptr` we would have to make JSI an explicit Fabric dependency (we will probably end up with it eventually, but I this particular case is not a good reason for that). All interactions with `eventHandler_` are done in a non-owning manner, so it's as performant as unique_ptr anyway. (Please ignore all changes in JSCFabricUIManager.h/cpp files, we will delete them soon.) Reviewed By: mdvacca Differential Revision: D9756732 fbshipit-source-id: bffdee0c724dc95855ced7c35e7c13cf1554796e