Files
react-native/ReactCommon
Valentin Shergin ebdd59aff8 Fabric: Initializing EventBeat::OwnerBox with non-null value ahead of time
Summary:
We use `EventBeat::OwnerBox` in the `EventBeat` infra to represent weak ownership of classes that contain that, so those classes can ensure own life-time at some critical points.
Before this diff, we stored a pointer to EventDispatcher right after we create it. However, some components that we build require to have a valid pointer from the beginning (even before the EventDispatcher is created). To satisfy this requirement, we create a dummy pointer first and use it as an owner, then we merge (share control block) the pointer to an EventDispatcher into that. It works because the owner pointer never gets dereferenced (it's `void *`), so it does not matter which object it represents while it represents correct ownership.

In the future, this approach will allow us to remove the concept of `OwnerBox` completely and use just `std::weak_ptr<void>` instead.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21441109

fbshipit-source-id: 7457c77bd31cd577f38a26e28e27eb7e33b6ad24
2020-05-11 09:01:32 -07:00
..
2020-05-08 00:36:17 -07:00
2020-05-08 00:36:17 -07:00
2020-05-08 00:36:17 -07:00
2020-05-07 04:15:14 -07:00
2020-05-08 00:36:17 -07:00
2020-04-07 19:07:19 -07:00