diff --git a/ReactCommon/react/renderer/.clang-tidy b/ReactCommon/react/renderer/.clang-tidy index 224e3d833b..79ff89de94 100644 --- a/ReactCommon/react/renderer/.clang-tidy +++ b/ReactCommon/react/renderer/.clang-tidy @@ -12,5 +12,6 @@ modernize-redundant-void-arg, modernize-return-braced-init-list, modernize-use-auto, modernize-make-unique, +modernize-pass-by-value, ' ... diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 39ef31a50f..294a9d8be3 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -8,6 +8,7 @@ #include "LayoutAnimationKeyFrameManager.h" #include +#include #include #include @@ -96,7 +97,7 @@ LayoutAnimationKeyFrameManager::LayoutAnimationKeyFrameManager( RuntimeExecutor runtimeExecutor, ContextContainer::Shared &contextContainer, LayoutAnimationStatusDelegate *delegate) - : runtimeExecutor_(runtimeExecutor), + : runtimeExecutor_(std::move(runtimeExecutor)), contextContainer_(contextContainer), layoutAnimationStatusDelegate_(delegate), now_([]() { diff --git a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp index a73131c9f5..53c287975c 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp +++ b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp @@ -9,6 +9,8 @@ #include +#include + namespace facebook { namespace react { @@ -22,9 +24,10 @@ AttributedStringBox::AttributedStringBox(AttributedString const &value) value_(std::make_shared(value)), opaquePointer_({}){}; -AttributedStringBox::AttributedStringBox( - std::shared_ptr const &opaquePointer) - : mode_(Mode::OpaquePointer), value_({}), opaquePointer_(opaquePointer) {} +AttributedStringBox::AttributedStringBox(std::shared_ptr opaquePointer) + : mode_(Mode::OpaquePointer), + value_({}), + opaquePointer_(std::move(opaquePointer)) {} AttributedStringBox::AttributedStringBox(AttributedStringBox &&other) noexcept : mode_(other.mode_), diff --git a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h index b8bd96c9ca..4223b0b618 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h @@ -35,7 +35,7 @@ class AttributedStringBox final { * Custom explicit constructors. */ explicit AttributedStringBox(AttributedString const &value); - explicit AttributedStringBox(std::shared_ptr const &opaquePointer); + explicit AttributedStringBox(std::shared_ptr opaquePointer); /* * Movable, Copyable, Assignable. diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp index 35cd6b328c..8748301991 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp @@ -14,16 +14,18 @@ #include #include +#include + namespace facebook { namespace react { ComponentDescriptorRegistry::ComponentDescriptorRegistry( - ComponentDescriptorParameters const ¶meters, + ComponentDescriptorParameters parameters, ComponentDescriptorProviderRegistry const &providerRegistry, ContextContainer::Shared contextContainer) - : parameters_(parameters), + : parameters_(std::move(parameters)), providerRegistry_(providerRegistry), - contextContainer_(contextContainer) {} + contextContainer_(std::move(contextContainer)) {} void ComponentDescriptorRegistry::add( ComponentDescriptorProvider componentDescriptorProvider) const { diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h index c35f3528e7..f41180b0fd 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h @@ -37,7 +37,7 @@ class ComponentDescriptorRegistry { * be used later to create `ComponentDescriptor`s. */ ComponentDescriptorRegistry( - ComponentDescriptorParameters const ¶meters, + ComponentDescriptorParameters parameters, ComponentDescriptorProviderRegistry const &providerRegistry, ContextContainer::Shared contextContainer); diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp index 4e51cf0cee..d52c31d1c0 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp @@ -10,27 +10,29 @@ #include #include +#include + namespace facebook { namespace react { AndroidTextInputState::AndroidTextInputState( int64_t mostRecentEventCount, - AttributedString const &attributedString, - AttributedString const &reactTreeAttributedString, - ParagraphAttributes const ¶graphAttributes, - TextAttributes const &defaultTextAttributes, - ShadowView const &defaultParentShadowView, + AttributedString attributedString, + AttributedString reactTreeAttributedString, + ParagraphAttributes paragraphAttributes, + TextAttributes defaultTextAttributes, + ShadowView defaultParentShadowView, float defaultThemePaddingStart, float defaultThemePaddingEnd, float defaultThemePaddingTop, float defaultThemePaddingBottom) : mostRecentEventCount(mostRecentEventCount), cachedAttributedStringId(0), - attributedString(attributedString), - reactTreeAttributedString(reactTreeAttributedString), - paragraphAttributes(paragraphAttributes), - defaultTextAttributes(defaultTextAttributes), - defaultParentShadowView(defaultParentShadowView), + attributedString(std::move(attributedString)), + reactTreeAttributedString(std::move(reactTreeAttributedString)), + paragraphAttributes(std::move(paragraphAttributes)), + defaultTextAttributes(std::move(defaultTextAttributes)), + defaultParentShadowView(std::move(defaultParentShadowView)), defaultThemePaddingStart(defaultThemePaddingStart), defaultThemePaddingEnd(defaultThemePaddingEnd), defaultThemePaddingTop(defaultThemePaddingTop), diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h index 4d3d41ac7a..79cc4a1f54 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h @@ -79,11 +79,11 @@ class AndroidTextInputState final { AndroidTextInputState( int64_t mostRecentEventCount, - AttributedString const &attributedString, - AttributedString const &reactTreeAttributedString, - ParagraphAttributes const ¶graphAttributes, - TextAttributes const &defaultTextAttributes, - ShadowView const &defaultParentShadowView, + AttributedString attributedString, + AttributedString reactTreeAttributedString, + ParagraphAttributes paragraphAttributes, + TextAttributes defaultTextAttributes, + ShadowView defaultParentShadowView, float defaultThemePaddingStart, float defaultThemePaddingEnd, float defaultThemePaddingTop, diff --git a/ReactCommon/react/renderer/core/EventBeat.cpp b/ReactCommon/react/renderer/core/EventBeat.cpp index e8bda3da9b..90631297b6 100644 --- a/ReactCommon/react/renderer/core/EventBeat.cpp +++ b/ReactCommon/react/renderer/core/EventBeat.cpp @@ -7,10 +7,13 @@ #include "EventBeat.h" +#include + namespace facebook { namespace react { -EventBeat::EventBeat(SharedOwnerBox const &ownerBox) : ownerBox_(ownerBox) {} +EventBeat::EventBeat(SharedOwnerBox ownerBox) + : ownerBox_(std::move(ownerBox)) {} void EventBeat::request() const { isRequested_ = true; diff --git a/ReactCommon/react/renderer/core/EventBeat.h b/ReactCommon/react/renderer/core/EventBeat.h index a72b1c778c..73b1440717 100644 --- a/ReactCommon/react/renderer/core/EventBeat.h +++ b/ReactCommon/react/renderer/core/EventBeat.h @@ -47,7 +47,7 @@ class EventBeat { using BeatCallback = std::function; - EventBeat(SharedOwnerBox const &ownerBox); + EventBeat(SharedOwnerBox ownerBox); virtual ~EventBeat() = default; diff --git a/ReactCommon/react/renderer/core/ShadowNode.cpp b/ReactCommon/react/renderer/core/ShadowNode.cpp index f7e119d766..137c5d87d1 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -17,6 +17,8 @@ #include #include +#include + namespace facebook { namespace react { @@ -58,7 +60,7 @@ bool ShadowNode::sameFamily(const ShadowNode &first, const ShadowNode &second) { ShadowNode::ShadowNode( ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family, + ShadowNodeFamily::Shared family, ShadowNodeTraits traits) : #if RN_DEBUG_STRING_CONVERTIBLE @@ -70,7 +72,7 @@ ShadowNode::ShadowNode( : emptySharedShadowNodeSharedList()), state_(fragment.state), orderIndex_(0), - family_(family), + family_(std::move(family)), traits_(traits) { react_native_assert(props_); react_native_assert(children_); diff --git a/ReactCommon/react/renderer/core/ShadowNode.h b/ReactCommon/react/renderer/core/ShadowNode.h index 71356dc130..a42e7664b5 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.h +++ b/ReactCommon/react/renderer/core/ShadowNode.h @@ -80,7 +80,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible { */ ShadowNode( ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family, + ShadowNodeFamily::Shared family, ShadowNodeTraits traits); /* diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp index 4927c322b8..13ad4751e5 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp @@ -12,6 +12,8 @@ #include #include +#include + namespace facebook { namespace react { @@ -21,7 +23,7 @@ ShadowNodeFamily::ShadowNodeFamily( ShadowNodeFamilyFragment const &fragment, EventDispatcher::Weak eventDispatcher, ComponentDescriptor const &componentDescriptor) - : eventDispatcher_(eventDispatcher), + : eventDispatcher_(std::move(eventDispatcher)), tag_(fragment.tag), surfaceId_(fragment.surfaceId), eventEmitter_(fragment.eventEmitter), diff --git a/ReactCommon/react/renderer/core/State.cpp b/ReactCommon/react/renderer/core/State.cpp index e740557d36..8ed87fe959 100644 --- a/ReactCommon/react/renderer/core/State.cpp +++ b/ReactCommon/react/renderer/core/State.cpp @@ -12,16 +12,20 @@ #include #include +#include + namespace facebook { namespace react { -State::State(StateData::Shared const &data, State const &state) - : family_(state.family_), data_(data), revision_(state.revision_ + 1){}; +State::State(StateData::Shared data, State const &state) + : family_(state.family_), + data_(std::move(data)), + revision_(state.revision_ + 1){}; -State::State( - StateData::Shared const &data, - ShadowNodeFamily::Shared const &family) - : family_(family), data_(data), revision_{State::initialRevisionValue} {}; +State::State(StateData::Shared data, ShadowNodeFamily::Shared const &family) + : family_(family), + data_(std::move(data)), + revision_{State::initialRevisionValue} {}; State::Shared State::getMostRecentState() const { auto family = family_.lock(); diff --git a/ReactCommon/react/renderer/core/State.h b/ReactCommon/react/renderer/core/State.h index ce5b51fe06..f38fc60cb9 100644 --- a/ReactCommon/react/renderer/core/State.h +++ b/ReactCommon/react/renderer/core/State.h @@ -34,9 +34,9 @@ class State { * Constructors are protected to make calling them directly with * type-erasured arguments impossible. */ - explicit State(StateData::Shared const &data, State const &state); + explicit State(StateData::Shared data, State const &state); explicit State( - StateData::Shared const &data, + StateData::Shared data, ShadowNodeFamily::Shared const &family); public: diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp index 73606d8742..7e859f0933 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp +++ b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp @@ -7,17 +7,22 @@ #include "DebugStringConvertibleItem.h" +#include + namespace facebook { namespace react { #if RN_DEBUG_STRING_CONVERTIBLE DebugStringConvertibleItem::DebugStringConvertibleItem( - const std::string &name, - const std::string &value, - const SharedDebugStringConvertibleList &props, - const SharedDebugStringConvertibleList &children) - : name_(name), value_(value), debugProps_(props), children_(children) {} + std::string name, + std::string value, + SharedDebugStringConvertibleList props, + SharedDebugStringConvertibleList children) + : name_(std::move(name)), + value_(std::move(value)), + debugProps_(std::move(props)), + children_(std::move(children)) {} std::string DebugStringConvertibleItem::getDebugName() const { return name_; diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h index 600113d810..de62f8563e 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h +++ b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h @@ -24,10 +24,10 @@ class DebugStringConvertibleItem : public DebugStringConvertible { DebugStringConvertibleItem(const DebugStringConvertibleItem &item) = default; DebugStringConvertibleItem( - const std::string &name = "", - const std::string &value = "", - const SharedDebugStringConvertibleList &props = {}, - const SharedDebugStringConvertibleList &children = {}); + std::string name = "", + std::string value = "", + SharedDebugStringConvertibleList props = {}, + SharedDebugStringConvertibleList children = {}); std::string getDebugName() const override; std::string getDebugValue() const override; diff --git a/ReactCommon/react/renderer/element/ComponentBuilder.cpp b/ReactCommon/react/renderer/element/ComponentBuilder.cpp index c1438bb63a..9fd8e6769a 100644 --- a/ReactCommon/react/renderer/element/ComponentBuilder.cpp +++ b/ReactCommon/react/renderer/element/ComponentBuilder.cpp @@ -7,12 +7,14 @@ #include "ComponentBuilder.h" +#include + namespace facebook { namespace react { ComponentBuilder::ComponentBuilder( - ComponentDescriptorRegistry::Shared const &componentDescriptorRegistry) - : componentDescriptorRegistry_(componentDescriptorRegistry){}; + ComponentDescriptorRegistry::Shared componentDescriptorRegistry) + : componentDescriptorRegistry_(std::move(componentDescriptorRegistry)){}; ShadowNode::Unshared ComponentBuilder::build( ElementFragment const &elementFragment) const { diff --git a/ReactCommon/react/renderer/element/ComponentBuilder.h b/ReactCommon/react/renderer/element/ComponentBuilder.h index b47ba81bd5..c01d106a3b 100644 --- a/ReactCommon/react/renderer/element/ComponentBuilder.h +++ b/ReactCommon/react/renderer/element/ComponentBuilder.h @@ -27,7 +27,7 @@ namespace react { class ComponentBuilder final { public: ComponentBuilder( - ComponentDescriptorRegistry::Shared const &componentDescriptorRegistry); + ComponentDescriptorRegistry::Shared componentDescriptorRegistry); /* * Copyable and movable. diff --git a/ReactCommon/react/renderer/imagemanager/ImageRequest.h b/ReactCommon/react/renderer/imagemanager/ImageRequest.h index 2c181d3b9b..fa018c3f4f 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageRequest.h +++ b/ReactCommon/react/renderer/imagemanager/ImageRequest.h @@ -29,7 +29,7 @@ class ImageRequest final { * The default constructor */ ImageRequest( - const ImageSource &imageSource, + ImageSource imageSource, std::shared_ptr telemetry); /* diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp b/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp index 361e5fe7f8..c832761408 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp +++ b/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp @@ -7,13 +7,15 @@ #include "ImageResponse.h" +#include + namespace facebook { namespace react { ImageResponse::ImageResponse( - const std::shared_ptr &image, - const std::shared_ptr &metadata) - : image_(image), metadata_(metadata) {} + std::shared_ptr image, + std::shared_ptr metadata) + : image_(std::move(image)), metadata_(std::move(metadata)) {} std::shared_ptr ImageResponse::getImage() const { return image_; diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponse.h b/ReactCommon/react/renderer/imagemanager/ImageResponse.h index 23cc49f65b..1012c9aecb 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponse.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponse.h @@ -23,9 +23,7 @@ class ImageResponse final { Failed, }; - ImageResponse( - const std::shared_ptr &image, - const std::shared_ptr &metadata); + ImageResponse(std::shared_ptr image, std::shared_ptr metadata); std::shared_ptr getImage() const; diff --git a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp index 9f811bc4d4..938b90d036 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp +++ b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp @@ -7,13 +7,15 @@ #include "ImageRequest.h" +#include + namespace facebook { namespace react { ImageRequest::ImageRequest( - const ImageSource &imageSource, + ImageSource imageSource, std::shared_ptr telemetry) - : imageSource_(imageSource), telemetry_(telemetry) { + : imageSource_(std::move(imageSource)), telemetry_(std::move(telemetry)) { // Not implemented. } diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp index ac01f5b1c1..1771a154e3 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp @@ -11,9 +11,9 @@ namespace facebook { namespace react { ImageRequest::ImageRequest( - ImageSource const &imageSource, + ImageSource imageSource, std::shared_ptr telemetry) - : imageSource_(imageSource), telemetry_(telemetry) { + : imageSource_(std::move(imageSource)), telemetry_(std::move(telemetry)) { coordinator_ = std::make_shared(); } diff --git a/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp b/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp index a72e485665..482c922834 100644 --- a/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp +++ b/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp @@ -10,11 +10,13 @@ #include #include +#include + namespace facebook { namespace react { -LeakChecker::LeakChecker(RuntimeExecutor const &runtimeExecutor) - : runtimeExecutor_(runtimeExecutor) {} +LeakChecker::LeakChecker(RuntimeExecutor runtimeExecutor) + : runtimeExecutor_(std::move(runtimeExecutor)) {} void LeakChecker::uiManagerDidCreateShadowNodeFamily( ShadowNodeFamily::Shared const &shadowNodeFamily) const { diff --git a/ReactCommon/react/renderer/leakchecker/LeakChecker.h b/ReactCommon/react/renderer/leakchecker/LeakChecker.h index a9bb3dd004..392c631eaf 100644 --- a/ReactCommon/react/renderer/leakchecker/LeakChecker.h +++ b/ReactCommon/react/renderer/leakchecker/LeakChecker.h @@ -20,7 +20,7 @@ using GarbageCollectionTrigger = std::function; class LeakChecker final { public: - LeakChecker(RuntimeExecutor const &runtimeExecutor); + LeakChecker(RuntimeExecutor runtimeExecutor); void uiManagerDidCreateShadowNodeFamily( ShadowNodeFamily::Shared const &shadowNodeFamily) const; diff --git a/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp b/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp index 4a77190dff..18f9dd1bb8 100644 --- a/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp @@ -7,6 +7,8 @@ #include "ShadowViewMutation.h" +#include + namespace facebook { namespace react { @@ -91,9 +93,9 @@ ShadowViewMutation::ShadowViewMutation( ShadowView newChildShadowView, int index) : type(type), - parentShadowView(parentShadowView), - oldChildShadowView(oldChildShadowView), - newChildShadowView(newChildShadowView), + parentShadowView(std::move(parentShadowView)), + oldChildShadowView(std::move(oldChildShadowView)), + newChildShadowView(std::move(newChildShadowView)), index(index) {} #if RN_DEBUG_STRING_CONVERTIBLE diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp index f33324b4b1..8a485eb4e5 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp @@ -6,6 +6,8 @@ */ #include "RuntimeScheduler.h" + +#include #include "ErrorUtils.h" namespace facebook { @@ -14,9 +16,9 @@ namespace react { #pragma mark - Public RuntimeScheduler::RuntimeScheduler( - RuntimeExecutor const &runtimeExecutor, + RuntimeExecutor runtimeExecutor, std::function now) - : runtimeExecutor_(runtimeExecutor), now_(now) {} + : runtimeExecutor_(std::move(runtimeExecutor)), now_(std::move(now)) {} void RuntimeScheduler::scheduleWork( std::function callback) const { diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h index 4878fbbdbd..09d24e7222 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h @@ -20,7 +20,7 @@ namespace react { class RuntimeScheduler final { public: RuntimeScheduler( - RuntimeExecutor const &runtimeExecutor, + RuntimeExecutor runtimeExecutor, std::function now = RuntimeSchedulerClock::now); /* diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp index e68b479f5e..023697c682 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -57,8 +58,8 @@ std::shared_ptr RuntimeSchedulerBinding::getBinding( } RuntimeSchedulerBinding::RuntimeSchedulerBinding( - std::shared_ptr const &runtimeScheduler) - : runtimeScheduler_(runtimeScheduler) {} + std::shared_ptr runtimeScheduler) + : runtimeScheduler_(std::move(runtimeScheduler)) {} bool RuntimeSchedulerBinding::getIsSynchronous() const { return runtimeScheduler_->getIsSynchronous(); diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h index ccb3fb7f26..843a35363b 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h @@ -18,8 +18,7 @@ namespace react { */ class RuntimeSchedulerBinding : public jsi::HostObject { public: - RuntimeSchedulerBinding( - std::shared_ptr const &runtimeScheduler); + RuntimeSchedulerBinding(std::shared_ptr runtimeScheduler); /* * Installs RuntimeSchedulerBinding into JavaScript runtime if needed. diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp index 70f02ca132..8fb4d78ecf 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp @@ -7,12 +7,14 @@ #include "RuntimeSchedulerCallInvoker.h" +#include + namespace facebook { namespace react { RuntimeSchedulerCallInvoker::RuntimeSchedulerCallInvoker( std::weak_ptr runtimeScheduler) - : runtimeScheduler_(runtimeScheduler) {} + : runtimeScheduler_(std::move(runtimeScheduler)) {} void RuntimeSchedulerCallInvoker::invokeAsync(std::function &&func) { if (auto runtimeScheduler = runtimeScheduler_.lock()) { diff --git a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp index 66d6c8c8a0..a1cd2b8cd6 100644 --- a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp +++ b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp @@ -9,17 +9,19 @@ #include +#include + namespace facebook { namespace react { SynchronousEventBeat::SynchronousEventBeat( RunLoopObserver::Unique uiRunLoopObserver, RuntimeExecutor runtimeExecutor, - std::shared_ptr const &runtimeScheduler) + std::shared_ptr runtimeScheduler) : EventBeat({}), uiRunLoopObserver_(std::move(uiRunLoopObserver)), runtimeExecutor_(std::move(runtimeExecutor)), - runtimeScheduler_(runtimeScheduler) { + runtimeScheduler_(std::move(runtimeScheduler)) { uiRunLoopObserver_->setDelegate(this); uiRunLoopObserver_->enable(); } diff --git a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h index a3e2d6489d..c6b19c8209 100644 --- a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h +++ b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h @@ -25,7 +25,7 @@ class SynchronousEventBeat final : public EventBeat, SynchronousEventBeat( RunLoopObserver::Unique uiRunLoopObserver, RuntimeExecutor runtimeExecutor, - std::shared_ptr const &runtimeScheduler); + std::shared_ptr runtimeScheduler); void induce() const override; diff --git a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp index b7b5fe37c0..274cb3d4a7 100644 --- a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp +++ b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp @@ -9,6 +9,8 @@ #include +#include + namespace facebook { namespace react { @@ -19,7 +21,7 @@ TransactionTelemetry::TransactionTelemetry() TransactionTelemetry::TransactionTelemetry( std::function now) - : now_{now} {} + : now_{std::move(now)} {} TransactionTelemetry *TransactionTelemetry::threadLocalTelemetry() { return threadLocalTransactionTelemetry; diff --git a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp index 76bbc45c96..966047929e 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp @@ -7,6 +7,8 @@ #include "TextMeasureCache.h" +#include + namespace facebook { namespace react { @@ -30,7 +32,7 @@ LineMeasurement::LineMeasurement( Float capHeight, Float ascender, Float xHeight) - : text(text), + : text(std::move(text)), frame(frame), descender(descender), capHeight(capHeight), diff --git a/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp b/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp index fd460b1ef2..d30a0a6fdb 100644 --- a/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp @@ -9,13 +9,15 @@ #include +#include + namespace facebook { namespace react { TimelineSnapshot::TimelineSnapshot( - RootShadowNode::Shared const &rootShadowNode, + RootShadowNode::Shared rootShadowNode, int index) noexcept - : rootShadowNode_(rootShadowNode), + : rootShadowNode_(std::move(rootShadowNode)), frame_(TimelineFrame{index, telemetryTimePointNow()}) {} RootShadowNode::Shared TimelineSnapshot::getRootShadowNode() const noexcept { diff --git a/ReactCommon/react/renderer/timeline/TimelineSnapshot.h b/ReactCommon/react/renderer/timeline/TimelineSnapshot.h index 59d022b3f1..c9d3f68cc8 100644 --- a/ReactCommon/react/renderer/timeline/TimelineSnapshot.h +++ b/ReactCommon/react/renderer/timeline/TimelineSnapshot.h @@ -20,9 +20,7 @@ class TimelineSnapshot final { public: using List = std::vector; - TimelineSnapshot( - RootShadowNode::Shared const &rootShadowNode, - int index) noexcept; + TimelineSnapshot(RootShadowNode::Shared rootShadowNode, int index) noexcept; TimelineFrame getFrame() const noexcept; RootShadowNode::Shared getRootShadowNode() const noexcept; diff --git a/ReactCommon/react/renderer/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp index 0628cd376a..885e1b1faa 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -18,6 +18,8 @@ #include +#include + namespace facebook::react { static std::unique_ptr constructLeakCheckerIfNeeded( @@ -31,10 +33,10 @@ static std::unique_ptr constructLeakCheckerIfNeeded( UIManager::UIManager( RuntimeExecutor const &runtimeExecutor, - BackgroundExecutor const &backgroundExecutor, + BackgroundExecutor backgroundExecutor, ContextContainer::Shared contextContainer) : runtimeExecutor_(runtimeExecutor), - backgroundExecutor_(backgroundExecutor), + backgroundExecutor_(std::move(backgroundExecutor)), contextContainer_(std::move(contextContainer)), leakChecker_(constructLeakCheckerIfNeeded(runtimeExecutor)) {} diff --git a/ReactCommon/react/renderer/uimanager/UIManager.h b/ReactCommon/react/renderer/uimanager/UIManager.h index a83aa516a3..3025f5868e 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.h +++ b/ReactCommon/react/renderer/uimanager/UIManager.h @@ -34,7 +34,7 @@ class UIManager final : public ShadowTreeDelegate { public: UIManager( RuntimeExecutor const &runtimeExecutor, - BackgroundExecutor const &backgroundExecutor, + BackgroundExecutor backgroundExecutor, ContextContainer::Shared contextContainer); ~UIManager(); diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index 4b314adf37..f22592d55f 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -15,6 +15,8 @@ #include #include +#include + #include "bindingUtils.h" namespace facebook::react { @@ -53,9 +55,10 @@ std::shared_ptr UIManagerBinding::getBinding( } UIManagerBinding::UIManagerBinding( - std::shared_ptr const &uiManager, - RuntimeExecutor const &runtimeExecutor) - : uiManager_(uiManager), runtimeExecutor_(runtimeExecutor) {} + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor) + : uiManager_(std::move(uiManager)), + runtimeExecutor_(std::move(runtimeExecutor)) {} UIManagerBinding::~UIManagerBinding() { LOG(WARNING) << "UIManagerBinding::~UIManagerBinding() was called (address: " diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.h b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h index d93808ba1a..f1970175e1 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h @@ -38,8 +38,8 @@ class UIManagerBinding : public jsi::HostObject { static std::shared_ptr getBinding(jsi::Runtime &runtime); UIManagerBinding( - std::shared_ptr const &uiManager, - RuntimeExecutor const &runtimeExecutor); + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor); ~UIManagerBinding();