diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp index 15c34793d06..4abc6b79b37 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp @@ -740,7 +740,7 @@ void FabricUIManagerBinding::schedulerDidRequestPreliminaryViewAllocation( // to be destroyed if the ShadowNode is destroyed but it was never mounted // on the screen. if (shadowNode.getTraits().check(ShadowNodeTraits::Trait::FormsView)) { - shadowNode.getFamily().onUnmountedFamilyDestroyed( + shadowNode.getFamilyShared()->onUnmountedFamilyDestroyed( [weakMountingManager = std::weak_ptr(mountingManager)](const ShadowNodeFamily& family) { if (auto mountingManager = weakMountingManager.lock()) { diff --git a/packages/react-native/ReactCommon/react/renderer/animated/AnimatedModule.h b/packages/react-native/ReactCommon/react/renderer/animated/AnimatedModule.h index 858cd95e1b4..64077e82d4e 100644 --- a/packages/react-native/ReactCommon/react/renderer/animated/AnimatedModule.h +++ b/packages/react-native/ReactCommon/react/renderer/animated/AnimatedModule.h @@ -89,7 +89,7 @@ class AnimatedModule : public NativeAnimatedModuleCxxSpec, publi struct ConnectAnimatedNodeToShadowNodeFamilyOp { Tag nodeTag{}; - std::shared_ptr shadowNodeFamily{}; + std::shared_ptr shadowNodeFamily{}; }; struct DisconnectAnimatedNodeFromViewOp { diff --git a/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp b/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp index e270340b160..e9b3ffd7ba5 100644 --- a/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp @@ -236,7 +236,7 @@ void NativeAnimatedNodesManager::connectAnimatedNodeToView( void NativeAnimatedNodesManager::connectAnimatedNodeToShadowNodeFamily( Tag propsNodeTag, - std::shared_ptr family) noexcept { + std::shared_ptr family) noexcept { react_native_assert(propsNodeTag); auto node = getAnimatedNode(propsNodeTag); if (node != nullptr && family != nullptr) { diff --git a/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h b/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h index b525c0a09db..b5cc98af588 100644 --- a/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +++ b/packages/react-native/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h @@ -101,7 +101,7 @@ class NativeAnimatedNodesManager { void connectAnimatedNodeToView(Tag propsNodeTag, Tag viewTag) noexcept; - void connectAnimatedNodeToShadowNodeFamily(Tag propsNodeTag, std::shared_ptr family) noexcept; + void connectAnimatedNodeToShadowNodeFamily(Tag propsNodeTag, std::shared_ptr family) noexcept; void disconnectAnimatedNodes(Tag parentTag, Tag childTag) noexcept; diff --git a/packages/react-native/ReactCommon/react/renderer/components/root/RootShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/root/RootShadowNode.cpp index 27567e38bc3..cf4b05bc10a 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/root/RootShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/root/RootShadowNode.cpp @@ -59,7 +59,7 @@ RootShadowNode::Unshared RootShadowNode::clone( void RootShadowNode::setInstanceHandle( InstanceHandle::Shared instanceHandle) const { - getFamily().setInstanceHandle(instanceHandle); + getFamilyShared()->setInstanceHandle(instanceHandle); } } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp index 68a322bc179..0279fe8f3da 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp @@ -33,7 +33,7 @@ ShadowNodeFamily::ShadowNodeFamily( componentHandle_(componentDescriptor.getComponentHandle()), componentName_(componentDescriptor.getComponentName()) {} -void ShadowNodeFamily::setParent(const ShadowNodeFamily::Shared& parent) const { +void ShadowNodeFamily::setParent(const ShadowNodeFamily::Shared& parent) { react_native_assert(parent_.lock() == nullptr || parent_.lock() == parent); if (hasParent_) { return; @@ -59,7 +59,7 @@ ComponentName ShadowNodeFamily::getComponentName() const { return componentName_; } -void ShadowNodeFamily::setMounted() const { +void ShadowNodeFamily::setMounted() { hasBeenMounted_ = true; } @@ -68,7 +68,7 @@ const ComponentDescriptor& ShadowNodeFamily::getComponentDescriptor() const { } void ShadowNodeFamily::onUnmountedFamilyDestroyed( - std::function callback) const { + std::function callback) { onUnmountedFamilyDestroyedCallback_ = std::move(callback); } @@ -89,7 +89,7 @@ InstanceHandle::Shared ShadowNodeFamily::getInstanceHandle() const { } void ShadowNodeFamily::setInstanceHandle( - InstanceHandle::Shared& instanceHandle) const { + InstanceHandle::Shared& instanceHandle) { instanceHandle_ = instanceHandle; } @@ -144,7 +144,7 @@ State::Shared ShadowNodeFamily::getMostRecentState() const { return mostRecentState_; } -void ShadowNodeFamily::setMostRecentState(const State::Shared& state) const { +void ShadowNodeFamily::setMostRecentState(const State::Shared& state) { std::unique_lock lock(mutex_); /* @@ -175,7 +175,7 @@ std::shared_ptr ShadowNodeFamily::getMostRecentStateIfObsolete( void ShadowNodeFamily::dispatchRawState( StateUpdate&& stateUpdate, - EventQueue::UpdateMode updateMode) const { + EventQueue::UpdateMode updateMode) { auto eventDispatcher = eventDispatcher_.lock(); if (!eventDispatcher) { return; diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.h index f27b59014dc..2b2ad83dd67 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.h @@ -41,8 +41,8 @@ struct ShadowNodeFamilyFragment { */ class ShadowNodeFamily final : public jsi::NativeState { public: - using Shared = std::shared_ptr; - using Weak = std::weak_ptr; + using Shared = std::shared_ptr; + using Weak = std::weak_ptr; using AncestorList = std::vector /* parentNode */, int /* childIndex */>>; @@ -58,7 +58,7 @@ class ShadowNodeFamily final : public jsi::NativeState { * This is not technically thread-safe, but practically it mutates the object * only once (and the model enforces that this first call is not concurrent). */ - void setParent(const ShadowNodeFamily::Shared &parent) const; + void setParent(const ShadowNodeFamily::Shared &parent); /* * Returns a handle (or name) associated with the component. @@ -90,23 +90,23 @@ class ShadowNodeFamily final : public jsi::NativeState { * @param callback will be executed when an unmounted instance of * ShadowNodeFamily is destroyed. */ - void onUnmountedFamilyDestroyed(std::function callback) const; + void onUnmountedFamilyDestroyed(std::function callback); /* * Sets and gets the most recent state. */ std::shared_ptr getMostRecentState() const; - void setMostRecentState(const std::shared_ptr &state) const; + void setMostRecentState(const std::shared_ptr &state); /** * Mark this ShadowNodeFamily as mounted. */ - void setMounted() const; + void setMounted(); /* * Dispatches a state update with given priority. */ - void dispatchRawState(StateUpdate &&stateUpdate, EventQueue::UpdateMode updateMode) const; + void dispatchRawState(StateUpdate &&stateUpdate, EventQueue::UpdateMode updateMode); /* * Holds currently applied native props. `nullptr` if setNativeProps API is @@ -122,7 +122,7 @@ class ShadowNodeFamily final : public jsi::NativeState { jsi::Value getInstanceHandle(jsi::Runtime &runtime) const; InstanceHandle::Shared getInstanceHandle() const; - void setInstanceHandle(InstanceHandle::Shared &instanceHandle) const; + void setInstanceHandle(InstanceHandle::Shared &instanceHandle); /** * Override destructor to call onUnmountedFamilyDestroyedCallback() for @@ -142,10 +142,10 @@ class ShadowNodeFamily final : public jsi::NativeState { std::shared_ptr getMostRecentStateIfObsolete(const State &state) const; EventDispatcher::Weak eventDispatcher_; - mutable std::shared_ptr mostRecentState_; + std::shared_ptr mostRecentState_; mutable std::shared_mutex mutex_; - mutable std::function onUnmountedFamilyDestroyedCallback_ = nullptr; + std::function onUnmountedFamilyDestroyedCallback_ = nullptr; /* * Deprecated. @@ -160,7 +160,7 @@ class ShadowNodeFamily final : public jsi::NativeState { /* * Weak reference to the React instance handle */ - mutable InstanceHandle::Shared instanceHandle_; + InstanceHandle::Shared instanceHandle_; /* * `EventEmitter` associated with all nodes of the family. @@ -184,18 +184,18 @@ class ShadowNodeFamily final : public jsi::NativeState { /* * Points to a family of all parent nodes of all nodes of the family. */ - mutable ShadowNodeFamily::Weak parent_{}; + ShadowNodeFamily::Weak parent_{}; /* * Represents a case where `parent_` is `nullptr`. * For optimization purposes only. */ - mutable bool hasParent_{false}; + bool hasParent_{false}; /* * Determines if the ShadowNodeFamily was ever mounted on the screen. */ - mutable bool hasBeenMounted_{false}; + bool hasBeenMounted_{false}; }; } // namespace facebook::react