mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 10:45:28 +03:00
Pass shared pointers by value in applet infrastructure
This is more optimal than crefs when used together with std::move
This commit is contained in:
parent
8ccef733ff
commit
2873f11baa
@ -6,9 +6,9 @@
|
||||
namespace skyline::applet {
|
||||
std::shared_ptr<service::am::IApplet> CreateApplet(
|
||||
const DeviceState &state, service::ServiceManager &manager,
|
||||
applet::AppletId appletId, const std::shared_ptr<kernel::type::KEvent> &onAppletStateChanged,
|
||||
const std::shared_ptr<kernel::type::KEvent> &onNormalDataPushFromApplet,
|
||||
const std::shared_ptr<kernel::type::KEvent> &onInteractiveDataPushFromApplet,
|
||||
applet::AppletId appletId, std::shared_ptr<kernel::type::KEvent> onAppletStateChanged,
|
||||
std::shared_ptr<kernel::type::KEvent> onNormalDataPushFromApplet,
|
||||
std::shared_ptr<kernel::type::KEvent> onInteractiveDataPushFromApplet,
|
||||
service::applet::LibraryAppletMode appletMode) {
|
||||
switch (appletId) {
|
||||
default:
|
||||
|
@ -74,8 +74,8 @@ namespace skyline::applet {
|
||||
*/
|
||||
std::shared_ptr<service::am::IApplet> CreateApplet(
|
||||
const DeviceState &state, service::ServiceManager &manager,
|
||||
applet::AppletId appletId, const std::shared_ptr<kernel::type::KEvent> &onAppletStateChanged,
|
||||
const std::shared_ptr<kernel::type::KEvent> &onNormalDataPushFromApplet,
|
||||
const std::shared_ptr<kernel::type::KEvent> &onInteractiveDataPushFromApplet,
|
||||
applet::AppletId appletId, std::shared_ptr<kernel::type::KEvent> onAppletStateChanged,
|
||||
std::shared_ptr<kernel::type::KEvent> onNormalDataPushFromApplet,
|
||||
std::shared_ptr<kernel::type::KEvent> onInteractiveDataPushFromApplet,
|
||||
service::applet::LibraryAppletMode appletMode);
|
||||
}
|
||||
|
@ -12,13 +12,13 @@ namespace skyline::service::am {
|
||||
|
||||
IApplet::~IApplet() = default;
|
||||
|
||||
void IApplet::PushNormalDataAndSignal(const std::shared_ptr<IStorage> &data) {
|
||||
normalOutputData.emplace(data);
|
||||
void IApplet::PushNormalDataAndSignal(std::shared_ptr<IStorage> data) {
|
||||
normalOutputData.emplace(std::move(data));
|
||||
onNormalDataPushFromApplet->Signal();
|
||||
}
|
||||
|
||||
void IApplet::PushInteractiveDataAndSignal(const std::shared_ptr<IStorage> &data) {
|
||||
interactiveOutputData.emplace(data);
|
||||
void IApplet::PushInteractiveDataAndSignal(std::shared_ptr<IStorage> data) {
|
||||
interactiveOutputData.emplace(std::move(data));
|
||||
onInteractiveDataPushFromApplet->Signal();
|
||||
}
|
||||
|
||||
|
@ -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<IStorage> &data);
|
||||
void PushNormalDataAndSignal(std::shared_ptr<IStorage> data);
|
||||
|
||||
/**
|
||||
* @brief Utility to send data to the guest and trigger the onInteractiveDataPushFromApplet event
|
||||
*/
|
||||
void PushInteractiveDataAndSignal(const std::shared_ptr<IStorage> &data);
|
||||
void PushInteractiveDataAndSignal(std::shared_ptr<IStorage> data);
|
||||
|
||||
public:
|
||||
IApplet(const DeviceState &state, ServiceManager &manager, std::shared_ptr<kernel::type::KEvent> onAppletStateChanged, std::shared_ptr<kernel::type::KEvent> onNormalDataPushFromApplet, std::shared_ptr<kernel::type::KEvent> onInteractiveDataPushFromApplet, applet::LibraryAppletMode appletMode);
|
||||
|
@ -21,6 +21,6 @@ namespace skyline::service::am {
|
||||
|
||||
~TransferMemoryIStorage() override;
|
||||
|
||||
virtual span<u8> GetSpan() override;
|
||||
span<u8> GetSpan() override;
|
||||
};
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ namespace skyline::service::am {
|
||||
|
||||
~VectorIStorage() override;
|
||||
|
||||
virtual span<u8> GetSpan() override;
|
||||
span<u8> GetSpan() override;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user