mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
feat: add can_gc argument to to_frozen_array (#36043)
* feat: add can_gc argument to to_frozen_array Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * feat: add can_gc in binding.conf Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> --------- Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
This commit is contained in:
parent
0917e080df
commit
cb56ac8561
21 changed files with 97 additions and 43 deletions
|
@ -9,7 +9,7 @@ use js::rust::MutableHandleValue;
|
|||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::utils::to_frozen_array;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
pub(crate) struct CachedFrozenArray {
|
||||
|
@ -28,6 +28,7 @@ impl CachedFrozenArray {
|
|||
f: F,
|
||||
cx: JSContext,
|
||||
mut retval: MutableHandleValue,
|
||||
can_gc: CanGc,
|
||||
) {
|
||||
if let Some(inner) = &*self.frozen_value.borrow() {
|
||||
retval.set(inner.get());
|
||||
|
@ -35,7 +36,7 @@ impl CachedFrozenArray {
|
|||
}
|
||||
|
||||
let array = f();
|
||||
to_frozen_array(array.as_slice(), cx, retval);
|
||||
to_frozen_array(array.as_slice(), cx, retval, can_gc);
|
||||
|
||||
// Safety: need to create the Heap value in its final memory location before setting it.
|
||||
*self.frozen_value.borrow_mut() = Some(Heap::default());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue