From 2873f11baa80054da5ee510d713d35ad6641cd9e Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Fri, 15 Apr 2022 12:19:48 +0100 Subject: [PATCH] Pass shared pointers by value in applet infrastructure This is more optimal than crefs when used together with std::move --- app/src/main/cpp/skyline/applet/applet_creator.cpp | 6 +++--- app/src/main/cpp/skyline/applet/applet_creator.h | 6 +++--- app/src/main/cpp/skyline/services/am/applet/IApplet.cpp | 8 ++++---- app/src/main/cpp/skyline/services/am/applet/IApplet.h | 4 ++-- .../skyline/services/am/storage/TransferMemoryIStorage.h | 2 +- .../main/cpp/skyline/services/am/storage/VectorIStorage.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/cpp/skyline/applet/applet_creator.cpp b/app/src/main/cpp/skyline/applet/applet_creator.cpp index 0ed73fe1..b7d97cad 100644 --- a/app/src/main/cpp/skyline/applet/applet_creator.cpp +++ b/app/src/main/cpp/skyline/applet/applet_creator.cpp @@ -6,9 +6,9 @@ namespace skyline::applet { std::shared_ptr CreateApplet( const DeviceState &state, service::ServiceManager &manager, - applet::AppletId appletId, const std::shared_ptr &onAppletStateChanged, - const std::shared_ptr &onNormalDataPushFromApplet, - const std::shared_ptr &onInteractiveDataPushFromApplet, + applet::AppletId appletId, std::shared_ptr onAppletStateChanged, + std::shared_ptr onNormalDataPushFromApplet, + std::shared_ptr onInteractiveDataPushFromApplet, service::applet::LibraryAppletMode appletMode) { switch (appletId) { default: diff --git a/app/src/main/cpp/skyline/applet/applet_creator.h b/app/src/main/cpp/skyline/applet/applet_creator.h index 736dca8f..f85629df 100644 --- a/app/src/main/cpp/skyline/applet/applet_creator.h +++ b/app/src/main/cpp/skyline/applet/applet_creator.h @@ -74,8 +74,8 @@ namespace skyline::applet { */ std::shared_ptr CreateApplet( const DeviceState &state, service::ServiceManager &manager, - applet::AppletId appletId, const std::shared_ptr &onAppletStateChanged, - const std::shared_ptr &onNormalDataPushFromApplet, - const std::shared_ptr &onInteractiveDataPushFromApplet, + applet::AppletId appletId, std::shared_ptr onAppletStateChanged, + std::shared_ptr onNormalDataPushFromApplet, + std::shared_ptr onInteractiveDataPushFromApplet, service::applet::LibraryAppletMode appletMode); } diff --git a/app/src/main/cpp/skyline/services/am/applet/IApplet.cpp b/app/src/main/cpp/skyline/services/am/applet/IApplet.cpp index c7382d27..ad8a3476 100644 --- a/app/src/main/cpp/skyline/services/am/applet/IApplet.cpp +++ b/app/src/main/cpp/skyline/services/am/applet/IApplet.cpp @@ -12,13 +12,13 @@ namespace skyline::service::am { IApplet::~IApplet() = default; - void IApplet::PushNormalDataAndSignal(const std::shared_ptr &data) { - normalOutputData.emplace(data); + void IApplet::PushNormalDataAndSignal(std::shared_ptr data) { + normalOutputData.emplace(std::move(data)); onNormalDataPushFromApplet->Signal(); } - void IApplet::PushInteractiveDataAndSignal(const std::shared_ptr &data) { - interactiveOutputData.emplace(data); + void IApplet::PushInteractiveDataAndSignal(std::shared_ptr data) { + interactiveOutputData.emplace(std::move(data)); onInteractiveDataPushFromApplet->Signal(); } diff --git a/app/src/main/cpp/skyline/services/am/applet/IApplet.h b/app/src/main/cpp/skyline/services/am/applet/IApplet.h index 3d0c382a..5d285f1e 100644 --- a/app/src/main/cpp/skyline/services/am/applet/IApplet.h +++ b/app/src/main/cpp/skyline/services/am/applet/IApplet.h @@ -26,12 +26,12 @@ namespace skyline::service::am { /** * @brief Utility to send data to the guest and trigger the onNormalDataPushFromApplet event */ - void PushNormalDataAndSignal(const std::shared_ptr &data); + void PushNormalDataAndSignal(std::shared_ptr data); /** * @brief Utility to send data to the guest and trigger the onInteractiveDataPushFromApplet event */ - void PushInteractiveDataAndSignal(const std::shared_ptr &data); + void PushInteractiveDataAndSignal(std::shared_ptr data); public: IApplet(const DeviceState &state, ServiceManager &manager, std::shared_ptr onAppletStateChanged, std::shared_ptr onNormalDataPushFromApplet, std::shared_ptr onInteractiveDataPushFromApplet, applet::LibraryAppletMode appletMode); diff --git a/app/src/main/cpp/skyline/services/am/storage/TransferMemoryIStorage.h b/app/src/main/cpp/skyline/services/am/storage/TransferMemoryIStorage.h index 609c2b24..bcd7b6b7 100644 --- a/app/src/main/cpp/skyline/services/am/storage/TransferMemoryIStorage.h +++ b/app/src/main/cpp/skyline/services/am/storage/TransferMemoryIStorage.h @@ -21,6 +21,6 @@ namespace skyline::service::am { ~TransferMemoryIStorage() override; - virtual span GetSpan() override; + span GetSpan() override; }; } diff --git a/app/src/main/cpp/skyline/services/am/storage/VectorIStorage.h b/app/src/main/cpp/skyline/services/am/storage/VectorIStorage.h index e5b20cf9..022a21e7 100644 --- a/app/src/main/cpp/skyline/services/am/storage/VectorIStorage.h +++ b/app/src/main/cpp/skyline/services/am/storage/VectorIStorage.h @@ -21,6 +21,6 @@ namespace skyline::service::am { ~VectorIStorage() override; - virtual span GetSpan() override; + span GetSpan() override; }; }