AK+Everywhere: Make FixedArray OOM-safe

FixedArray now doesn't expose any infallible constructors anymore.
Rather, it exposes fallible methods. Therefore, it can be used for
OOM-safe code.
This commit also converts the rest of the system to use the new API.
However, as an example, VMObject can't take advantage of this yet,
as we would have to endow VMObject with a fallible static
construction method, which would require a very fundamental change
to VMObject's whole inheritance hierarchy.
This commit is contained in:
creator1creeper1 2022-01-08 20:06:03 +01:00 committed by Linus Groh
commit 3c05261611
Notes: sideshowbarker 2024-07-17 21:24:30 +09:00
5 changed files with 62 additions and 34 deletions

View file

@ -197,7 +197,7 @@ LoaderSamples FlacLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_i
return Buffer::create_empty();
size_t samples_to_read = min(max_bytes_to_read_from_input, remaining_samples);
auto samples = FixedArray<Sample>(samples_to_read);
auto samples = FixedArray<Sample>::must_create_but_fixme_should_propagate_errors(samples_to_read);
size_t sample_index = 0;
if (m_unread_data.size() > 0) {