1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

SpiceAgent: Reduce copying of potentially large byte buffers

This moves buffers around instead of implicitly copying them, and marks
the message types that hold these buffers as move-only.
This commit is contained in:
Timothy Flynn 2023-05-21 13:48:04 -04:00 committed by Andreas Kling
parent b865277275
commit 36d61c01bc
3 changed files with 19 additions and 7 deletions

View file

@ -275,7 +275,7 @@ ErrorOr<FileTransferDataMessage> FileTransferDataMessage::read_from_stream(AK::S
auto contents = TRY(ByteBuffer::create_uninitialized(size));
TRY(stream.read_until_filled(contents));
return FileTransferDataMessage(id, contents);
return FileTransferDataMessage(id, move(contents));
}
ErrorOr<String> FileTransferDataMessage::debug_description()