mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 17:47:18 +00:00
LibWeb: Convert callers of ImageCodecPlugin to the async API
The HTMLLinkElement caller is a bit hairy, so we shove an await() in there temporarily. This is sure to cause fun times for anyone debugging task/microtask execution order.
This commit is contained in:
committed by
Andrew Kaster
parent
39dfb659cf
commit
651e78fedb
@@ -182,11 +182,14 @@ WebIDL::ExceptionOr<void> HTMLVideoElement::determine_element_poster_frame(Optio
|
||||
m_fetch_controller = nullptr;
|
||||
|
||||
// 6. If an image is thus obtained, the poster frame is that image. Otherwise, there is no poster frame.
|
||||
auto image = Platform::ImageCodecPlugin::the().decode_image(image_data);
|
||||
if (!image.has_value() || image->frames.is_empty())
|
||||
return;
|
||||
|
||||
m_poster_frame = move(image.release_value().frames[0].bitmap);
|
||||
(void)Platform::ImageCodecPlugin::the().decode_image(
|
||||
image_data,
|
||||
[strong_this = JS::Handle(*this)](Web::Platform::DecodedImage& image) -> ErrorOr<void> {
|
||||
if (!image.frames.is_empty())
|
||||
strong_this->m_poster_frame = move(image.frames[0].bitmap);
|
||||
return {};
|
||||
},
|
||||
[](auto&) {});
|
||||
});
|
||||
|
||||
VERIFY(response->body());
|
||||
|
||||
Reference in New Issue
Block a user