aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/buffer_source.rs
diff options
context:
space:
mode:
authorYerkebulan Tulibergenov <yerkebulan@gmail.com>2025-02-21 21:42:55 -0800
committerGitHub <noreply@github.com>2025-02-22 05:42:55 +0000
commit245a39c07eb14f1acb03c4d85aaa4901af863a71 (patch)
tree648c6d8de054b198aed81e680685afbce40ca457 /components/script/dom/bindings/buffer_source.rs
parent35f21e426b2fec968ebd0970b743d43ac6fd012f (diff)
downloadservo-245a39c07eb14f1acb03c4d85aaa4901af863a71.tar.gz
servo-245a39c07eb14f1acb03c4d85aaa4901af863a71.zip
refactor: add CanGc as argument to create_buffer_source (#35597)
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
Diffstat (limited to 'components/script/dom/bindings/buffer_source.rs')
-rw-r--r--components/script/dom/bindings/buffer_source.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs
index a319a7e0c2c..071b95cf0a7 100644
--- a/components/script/dom/bindings/buffer_source.rs
+++ b/components/script/dom/bindings/buffer_source.rs
@@ -28,7 +28,7 @@ use js::typedarray::{CreateWith, TypedArray, TypedArrayElement, TypedArrayElemen
#[cfg(feature = "webgpu")]
use crate::dom::globalscope::GlobalScope;
-use crate::script_runtime::JSContext;
+use crate::script_runtime::{CanGc, JSContext};
// Represents a `BufferSource` as defined in the WebIDL specification.
///
@@ -314,9 +314,15 @@ where
Ok(())
}
- pub(crate) fn set_data(&self, cx: JSContext, data: &[T::Element]) -> Result<(), ()> {
+ pub(crate) fn set_data(
+ &self,
+ cx: JSContext,
+ data: &[T::Element],
+ can_gc: CanGc,
+ ) -> Result<(), ()> {
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
- let _: TypedArray<T, *mut JSObject> = create_buffer_source(cx, data, array.handle_mut())?;
+ let _: TypedArray<T, *mut JSObject> =
+ create_buffer_source(cx, data, array.handle_mut(), can_gc)?;
match &self.buffer_source {
BufferSource::ArrayBufferView(buffer) |
@@ -347,6 +353,7 @@ pub(crate) fn create_buffer_source<T>(
cx: JSContext,
data: &[T::Element],
dest: MutableHandleObject,
+ _can_gc: CanGc,
) -> Result<TypedArray<T, *mut JSObject>, ()>
where
T: TypedArrayElement + TypedArrayElementCreator,