mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Add AsHandleValue trait to Heap<Value> and make Heap values rooted (#38024)
Encapsulates the unsafe conversion from Heap<Value> to HandleValue<'a>, and reducing repetitive unsafe code at call. fix #37258
This commit is contained in:
parent
9416251cab
commit
04ec710e60
17 changed files with 204 additions and 146 deletions
|
@ -154,7 +154,7 @@ pub(crate) struct PipeTo {
|
|||
/// The error potentially passed to shutdown,
|
||||
/// stored here because we must keep it across a microtask.
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
shutdown_error: Rc<RefCell<Option<Heap<JSVal>>>>,
|
||||
shutdown_error: Rc<RefCell<Option<RootedTraceableBox<Heap<JSVal>>>>>,
|
||||
|
||||
/// The promise returned by a shutdown action.
|
||||
/// We keep it to only continue when it is not pending anymore.
|
||||
|
@ -376,7 +376,7 @@ impl PipeTo {
|
|||
/// Setting shutdown error in a way that ensures it isn't
|
||||
/// moved after it has been set.
|
||||
fn set_shutdown_error(&self, error: SafeHandleValue) {
|
||||
*self.shutdown_error.borrow_mut() = Some(Heap::default());
|
||||
*self.shutdown_error.borrow_mut() = Some(RootedTraceableBox::new(Heap::default()));
|
||||
let Some(ref heap) = *self.shutdown_error.borrow() else {
|
||||
unreachable!("Option set to Some(heap) above.");
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue