refactor: add CanGc as argument to create_buffer_source (#35597)

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-02-21 21:42:55 -08:00 committed by GitHub
parent 35f21e426b
commit 245a39c07e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 169 additions and 96 deletions

View file

@ -250,7 +250,7 @@ impl ReadableStream {
UnderlyingSourceType::Memory(bytes.len()),
can_gc,
)?;
stream.enqueue_native(bytes);
stream.enqueue_native(bytes, can_gc);
stream.controller_close_native();
Ok(stream)
}
@ -375,12 +375,12 @@ impl ReadableStream {
/// Endpoint to enqueue chunks directly from Rust.
/// Note: in other use cases this call happens via the controller.
pub(crate) fn enqueue_native(&self, bytes: Vec<u8>) {
pub(crate) fn enqueue_native(&self, bytes: Vec<u8>, can_gc: CanGc) {
match self.controller {
ControllerType::Default(ref controller) => controller
.get()
.expect("Stream should have controller.")
.enqueue_native(bytes),
.enqueue_native(bytes, can_gc),
_ => unreachable!(
"Enqueueing chunk to a stream from Rust on other than default controller"
),