Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ff9931a

Browse files
author
Jonah Williams
authored
[Impeller] prevent no-op backend from throwing exceptions during image decoding (#56522)
This preveents errors reported in some g3 test cases.
1 parent 0d61080 commit ff9931a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/ui/painting/image_decoder_impeller.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,13 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
519519
result,
520520
supports_wide_gamut = supports_wide_gamut_, //
521521
gpu_disabled_switch = gpu_disabled_switch_]() {
522+
#if FML_OS_IOS_SIMULATOR
523+
// No-op backend.
524+
if (!context) {
525+
return;
526+
}
527+
#endif // FML_OS_IOS_SIMULATOR
528+
522529
if (!context) {
523530
result(nullptr, "No Impeller context is available");
524531
return;

lib/ui/painting/multi_frame_codec.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ void MultiFrameCodec::State::GetNextFrameAndInvokeCallback(
190190
const std::shared_ptr<const fml::SyncSwitch>& gpu_disable_sync_switch,
191191
size_t trace_id,
192192
const std::shared_ptr<impeller::Context>& impeller_context) {
193+
#if FML_OS_IOS_SIMULATOR
194+
// Noop backend.
195+
if (!resourceContext && !impeller_context) {
196+
ui_task_runner->PostTask(
197+
fml::MakeCopyable([callback = std::move(callback)]() {
198+
// must be destroyed on UI thread.
199+
}));
200+
return;
201+
}
202+
#endif // FML_OS_IOS_SIMULATOR
203+
193204
fml::RefPtr<CanvasImage> image = nullptr;
194205
int duration = 0;
195206
sk_sp<DlImage> dlImage;

0 commit comments

Comments
 (0)