mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibIPC+Everywhere: Always pass ownership of transferred data to clients
This has been a longstanding ergonomic issue with our IPC compiler. Non- trivial types were previously passed by const&. So if we wanted to avoid expensive copies, we would have to const_cast and move the data. We now pass ownership of all transferred data to the client subclasses. This allows us to remove const_cast from these methods, and allows us to avoid some trivial expensive copies that we didn't bother to const_cast.
This commit is contained in:
parent
0f05aac290
commit
cf69f52d53
Notes:
github-actions[bot]
2025-03-09 15:15:22 +00:00
Author: https://github.com/trflynn89
Commit: cf69f52d53
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3865
23 changed files with 395 additions and 399 deletions
|
@ -57,9 +57,9 @@ NonnullRefPtr<Core::Promise<DecodedImage>> Client::decode_image(ReadonlyBytes en
|
|||
return promise;
|
||||
}
|
||||
|
||||
void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence const& bitmap_sequence, Vector<u32> const& durations, Gfx::FloatPoint scale, Gfx::ColorSpace const& color_space)
|
||||
void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence bitmap_sequence, Vector<u32> durations, Gfx::FloatPoint scale, Gfx::ColorSpace color_space)
|
||||
{
|
||||
auto const& bitmaps = bitmap_sequence.bitmaps;
|
||||
auto bitmaps = move(bitmap_sequence.bitmaps);
|
||||
VERIFY(!bitmaps.is_empty());
|
||||
|
||||
auto maybe_promise = m_pending_decoded_images.take(image_id);
|
||||
|
@ -82,13 +82,13 @@ void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gf
|
|||
return;
|
||||
}
|
||||
|
||||
image.frames.empend(*bitmaps[i], durations[i]);
|
||||
image.frames.empend(bitmaps[i].release_value(), durations[i]);
|
||||
}
|
||||
|
||||
promise->resolve(move(image));
|
||||
}
|
||||
|
||||
void Client::did_fail_to_decode_image(i64 image_id, String const& error_message)
|
||||
void Client::did_fail_to_decode_image(i64 image_id, String error_message)
|
||||
{
|
||||
auto maybe_promise = m_pending_decoded_images.take(image_id);
|
||||
if (!maybe_promise.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue