diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp index bbd02b4cdc9..88242a74cb5 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp @@ -33,7 +33,7 @@ SurfaceId MountingCoordinator::getSurfaceId() const { return surfaceId_; } -void MountingCoordinator::push(ShadowTreeRevision const &revision) const { +void MountingCoordinator::push(ShadowTreeRevision revision) const { { std::lock_guard lock(mutex_); @@ -41,7 +41,7 @@ void MountingCoordinator::push(ShadowTreeRevision const &revision) const { !lastRevision_.has_value() || revision.number != lastRevision_->number); if (!lastRevision_.has_value() || lastRevision_->number < revision.number) { - lastRevision_ = revision; + lastRevision_ = std::move(revision); } } diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.h b/ReactCommon/react/renderer/mounting/MountingCoordinator.h index d2685185660..188c6fb02b7 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.h +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.h @@ -88,7 +88,7 @@ class MountingCoordinator final { private: friend class ShadowTree; - void push(ShadowTreeRevision const &revision) const; + void push(ShadowTreeRevision revision) const; /* * Revokes the last pushed `ShadowTreeRevision`. diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp index c1b66df770e..109cada60db 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -393,8 +393,8 @@ CommitStatus ShadowTree::tryCommit( telemetry.didCommit(); telemetry.setRevisionNumber(static_cast(newRevisionNumber)); - newRevision = - ShadowTreeRevision{newRootShadowNode, newRevisionNumber, telemetry}; + newRevision = ShadowTreeRevision{ + std::move(newRootShadowNode), newRevisionNumber, telemetry}; currentRevision_ = newRevision; } @@ -402,7 +402,7 @@ CommitStatus ShadowTree::tryCommit( emitLayoutEvents(affectedLayoutableNodes); if (commitMode == CommitMode::Normal) { - mount(newRevision, commitOptions.mountSynchronously); + mount(std::move(newRevision), commitOptions.mountSynchronously); } return CommitStatus::Succeeded; @@ -413,10 +413,9 @@ ShadowTreeRevision ShadowTree::getCurrentRevision() const { return currentRevision_; } -void ShadowTree::mount( - ShadowTreeRevision const &revision, - bool mountSynchronously) const { - mountingCoordinator_->push(revision); +void ShadowTree::mount(ShadowTreeRevision revision, bool mountSynchronously) + const { + mountingCoordinator_->push(std::move(revision)); delegate_.shadowTreeDidFinishTransaction( mountingCoordinator_, mountSynchronously); } diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h index b750a1a2fcf..0e8d5f32486 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -134,7 +134,7 @@ class ShadowTree final { private: constexpr static ShadowTreeRevision::Number INITIAL_REVISION{0}; - void mount(ShadowTreeRevision const &revision, bool mountSynchronously) const; + void mount(ShadowTreeRevision revision, bool mountSynchronously) const; void emitLayoutEvents( std::vector &affectedLayoutableNodes) const;