mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
refactor: add CanGc as argument to create_buffer_source (#35597)
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
parent
35f21e426b
commit
245a39c07e
22 changed files with 169 additions and 96 deletions
|
@ -136,7 +136,7 @@ impl XRRayMethods<crate::DomTypeHolder> for XRRay {
|
|||
}
|
||||
|
||||
/// <https://immersive-web.github.io/hit-test/#dom-xrray-matrix>
|
||||
fn Matrix(&self, _cx: JSContext) -> Float32Array {
|
||||
fn Matrix(&self, _cx: JSContext, can_gc: CanGc) -> Float32Array {
|
||||
// https://immersive-web.github.io/hit-test/#xrray-obtain-the-matrix
|
||||
if !self.matrix.is_initialized() {
|
||||
// Step 1
|
||||
|
@ -163,7 +163,7 @@ impl XRRayMethods<crate::DomTypeHolder> for XRRay {
|
|||
.to_transform()
|
||||
.to_array();
|
||||
self.matrix
|
||||
.set_data(_cx, &arr)
|
||||
.set_data(_cx, &arr, can_gc)
|
||||
.expect("Failed to set matrix data on XRRAy.")
|
||||
}
|
||||
|
||||
|
|
|
@ -167,10 +167,10 @@ impl XRRigidTransformMethods<crate::DomTypeHolder> for XRRigidTransform {
|
|||
})
|
||||
}
|
||||
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-matrix
|
||||
fn Matrix(&self, _cx: JSContext) -> Float32Array {
|
||||
fn Matrix(&self, _cx: JSContext, can_gc: CanGc) -> Float32Array {
|
||||
if !self.matrix.is_initialized() {
|
||||
self.matrix
|
||||
.set_data(_cx, &self.transform.to_transform().to_array())
|
||||
.set_data(_cx, &self.transform.to_transform().to_array(), can_gc)
|
||||
.expect("Failed to set on data on transform's internal matrix.")
|
||||
}
|
||||
|
||||
|
|
|
@ -993,7 +993,7 @@ impl XRSessionMethods<crate::DomTypeHolder> for XRSession {
|
|||
}
|
||||
|
||||
/// <https://www.w3.org/TR/webxr/#dom-xrsession-supportedframerates>
|
||||
fn GetSupportedFrameRates(&self, cx: JSContext) -> Option<Float32Array> {
|
||||
fn GetSupportedFrameRates(&self, cx: JSContext, can_gc: CanGc) -> Option<Float32Array> {
|
||||
let session = self.session.borrow();
|
||||
if self.mode == XRSessionMode::Inline || session.supported_frame_rates().is_empty() {
|
||||
None
|
||||
|
@ -1001,7 +1001,7 @@ impl XRSessionMethods<crate::DomTypeHolder> for XRSession {
|
|||
let framerates = session.supported_frame_rates();
|
||||
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
Some(
|
||||
create_buffer_source(cx, framerates, array.handle_mut())
|
||||
create_buffer_source(cx, framerates, array.handle_mut(), can_gc)
|
||||
.expect("Failed to construct supported frame rates array"),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -95,13 +95,13 @@ impl XRViewMethods<crate::DomTypeHolder> for XRView {
|
|||
}
|
||||
|
||||
/// <https://immersive-web.github.io/webxr/#dom-xrview-projectionmatrix>
|
||||
fn ProjectionMatrix(&self, _cx: JSContext) -> Float32Array {
|
||||
fn ProjectionMatrix(&self, _cx: JSContext, can_gc: CanGc) -> Float32Array {
|
||||
if !self.proj.is_initialized() {
|
||||
let cx = GlobalScope::get_cx();
|
||||
// row_major since euclid uses row vectors
|
||||
let proj = self.view.projection.to_array();
|
||||
self.proj
|
||||
.set_data(cx, &proj)
|
||||
.set_data(cx, &proj, can_gc)
|
||||
.expect("Failed to set projection matrix.")
|
||||
}
|
||||
self.proj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue