| 10 | namespace Web::Encoding { |
| 11 | |
| 12 | ErrorOr<void> TextDecoderOutputQueue::push(String output) |
| 13 | { |
| 14 | if (output.is_empty()) |
| 15 | return {}; |
| 16 | |
| 17 | if (m_has_builder) |
| 18 | return m_builder.try_append(output.bytes_as_string_view()); |
| 19 | |
| 20 | if (!m_single_output.has_value()) { |
| 21 | m_single_output = move(output); |
| 22 | return {}; |
| 23 | } |
| 24 | |
| 25 | m_has_builder = true; |
| 26 | TRY(m_builder.try_append(m_single_output->bytes_as_string_view())); |
| 27 | m_single_output.clear(); |
| 28 | return m_builder.try_append(output.bytes_as_string_view()); |
| 29 | } |
| 30 | |
| 31 | ErrorOr<Utf16String> TextDecoderOutputQueue::serialize() |
| 32 | { |