Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,19 @@ void ShadowNode::setRuntimeShadowNodeReference(
runtimeShadowNodeReference_ = runtimeShadowNodeReference;
}

void ShadowNode::updateRuntimeShadowNodeReference(
const Shared& destinationShadowNode) const {
if (auto reference = runtimeShadowNodeReference_.lock()) {
reference->shadowNode = destinationShadowNode;
}
}

void ShadowNode::transferRuntimeShadowNodeReference(
const Shared& destinationShadowNode) const {
destinationShadowNode->runtimeShadowNodeReference_ =
runtimeShadowNodeReference_;

if (auto reference = runtimeShadowNodeReference_.lock()) {
reference->shadowNode = destinationShadowNode;
}
updateRuntimeShadowNodeReference(destinationShadowNode);
}

void ShadowNode::transferRuntimeShadowNodeReference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ class ShadowNode : public Sealable,
void setRuntimeShadowNodeReference(const std::shared_ptr<ShadowNodeWrapper>&
runtimeShadowNodeReference) const;

/*
* Update the runtime reference to point to the provided shadow node.
*/
void updateRuntimeShadowNodeReference(
const Shared& destinationShadowNode) const;

/*
* Transfer the runtime reference to this `ShadowNode` to a new instance,
* updating the reference to point to the new `ShadowNode` referencing it.
Expand Down
Loading