Truly independent web browser
LibWeb: Count AudioBuffer sample storage toward GC pressure
Zaggy1024827beb41621d
diff --git a/Libraries/LibWeb/WebAudio/AudioBuffer.cpp b/Libraries/LibWeb/WebAudio/AudioBuffer.cppindex 59d5c6f0270..468d2342942 100644--- a/Libraries/LibWeb/WebAudio/AudioBuffer.cpp+++ b/Libraries/LibWeb/WebAudio/AudioBuffer.cpp@@ -100,6 +100,7 @@ ErrorOr<GC::Ref<AudioBuffer>> AudioBuffer::create(WebIDL::UnsignedLong number_ofTRY(buffer->m_channels.try_ensure_capacity(options.number_of_channels));for (WebIDL::UnsignedLong i = 0; i < options.number_of_channels; ++i)buffer->m_channels.unchecked_append({ TRY(JS::DataBlock::OwnedBackingStore::create_zeroed(channel_byte_length)) });+ GC::Heap::the().did_allocate_external_memory(buffer->external_memory_size());return buffer;}@@ -147,6 +148,7 @@ RefPtr<Rendering::AudioBufferContents> AudioBuffer::acquire_contents()}}m_contents = make_ref_counted<Rendering::AudioBufferContents>(move(channels), m_sample_rate);+ GC::Heap::the().did_allocate_external_memory(m_channels.size() * m_length * sizeof(float));// 4. Attach ArrayBuffers containing copies of the data to the AudioBuffer, to be returned by the next call to// getChannelData().