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

LibAudio: Stop passing Bytes by reference

`Bytes` is very slim, so the memory and/or performance gains from
passing it by reference isn't that big, and it passing it by value is
more compatible with xvalues, which is handy for things like
`::try_create(buffer.bytes())`.
This commit is contained in:
Tim Schumacher 2022-12-05 01:46:15 +01:00 committed by Andreas Kling
parent 385ba1280b
commit 3cf93d0dd2
2 changed files with 3 additions and 3 deletions

View file

@ -72,7 +72,7 @@ protected:
class Loader : public RefCounted<Loader> {
public:
static Result<NonnullRefPtr<Loader>, LoaderError> create(StringView path) { return adopt_ref(*new Loader(TRY(try_create(path)))); }
static Result<NonnullRefPtr<Loader>, LoaderError> create(Bytes& buffer) { return adopt_ref(*new Loader(TRY(try_create(buffer)))); }
static Result<NonnullRefPtr<Loader>, LoaderError> create(Bytes buffer) { return adopt_ref(*new Loader(TRY(try_create(buffer)))); }
LoaderSamples get_more_samples(size_t max_samples_to_read_from_input = 128 * KiB) const { return m_plugin->get_more_samples(max_samples_to_read_from_input); }
@ -89,7 +89,7 @@ public:
private:
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(StringView path);
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(Bytes& buffer);
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(Bytes buffer);
explicit Loader(NonnullOwnPtr<LoaderPlugin>);