Avoid copy in LayoutAnimationDriver

Summary:
changelog: [internal]

Avoid unnecessary copy of `ShadowViewMutation` and `ShadowView`.

Reviewed By: RSNara

Differential Revision: D30756214

fbshipit-source-id: 39c44dd60582e6c111986df482613212e25739d7
This commit is contained in:
Samuel Susla authored and Facebook GitHub Bot committed 2021-09-09 11:57:24 -07:00
1 parent f91974156b
commit 668ce510bd
1 file changed
+3 -10
@@ -55,19 +55,12 @@ void LayoutAnimationDriver::animationMutationsForFrame(
animationInterpolationFactor, baselineShadowView, finalShadowView);
// Create the mutation instruction
auto updateMutation = ShadowViewMutation::UpdateMutation(
keyframe.viewPrev, mutatedShadowView);
mutationsList.emplace_back(ShadowViewMutation::UpdateMutation(
keyframe.viewPrev, mutatedShadowView));
// All generated Update mutations must have an "old" and "new"
// ShadowView. Checking for nonzero tag doesn't guarantee that the views
// are valid/correct, just that something is there.
react_native_assert(updateMutation.oldChildShadowView.tag > 0);
react_native_assert(updateMutation.newChildShadowView.tag > 0);
mutationsList.push_back(updateMutation);
PrintMutationInstruction("Animation Progress:", updateMutation);
keyframe.viewPrev = mutatedShadowView;
keyframe.viewPrev = std::move(mutatedShadowView);
if (animationTimeProgressLinear < 1) {
incompleteAnimations++;