mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-12 05:40:04 +00:00
ipc_helpers: Make PushStaticBuffer take std::vector by value
Allows interfaces to move the vector into the calls, avoiding any reallocations. Many existing call sites already std::move into the parameter, expecting a move to occur. Only a few remain where this wasn't already being done, which we can convert over.
This commit is contained in:
parent
397bd1bb73
commit
a6e37b48e9
8 changed files with 52 additions and 51 deletions
|
@ -93,7 +93,7 @@ public:
|
|||
template <typename... O>
|
||||
void PushMoveObjects(std::shared_ptr<O>... pointers);
|
||||
|
||||
void PushStaticBuffer(const std::vector<u8>& buffer, u8 buffer_id);
|
||||
void PushStaticBuffer(std::vector<u8> buffer, u8 buffer_id);
|
||||
|
||||
/// Pushes an HLE MappedBuffer interface back to unmapped the buffer.
|
||||
void PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer);
|
||||
|
@ -193,14 +193,14 @@ inline void RequestBuilder::PushMoveObjects(std::shared_ptr<O>... pointers) {
|
|||
PushMoveHLEHandles(context->AddOutgoingHandle(std::move(pointers))...);
|
||||
}
|
||||
|
||||
inline void RequestBuilder::PushStaticBuffer(const std::vector<u8>& buffer, u8 buffer_id) {
|
||||
inline void RequestBuilder::PushStaticBuffer(std::vector<u8> buffer, u8 buffer_id) {
|
||||
ASSERT_MSG(buffer_id < MAX_STATIC_BUFFERS, "Invalid static buffer id");
|
||||
|
||||
Push(StaticBufferDesc(buffer.size(), buffer_id));
|
||||
// This address will be replaced by the correct static buffer address during IPC translation.
|
||||
Push<VAddr>(0xDEADC0DE);
|
||||
|
||||
context->AddStaticBuffer(buffer_id, buffer);
|
||||
context->AddStaticBuffer(buffer_id, std::move(buffer));
|
||||
}
|
||||
|
||||
inline void RequestBuilder::PushMappedBuffer(const Kernel::MappedBuffer& mapped_buffer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue