mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Mark JSTraceable and its method as unsafe
This commit is contained in:
parent
73b6e705b4
commit
620a67ff14
16 changed files with 191 additions and 185 deletions
|
@ -133,7 +133,7 @@ impl<T: WeakReferenceable> PartialEq<T> for WeakRef<T> {
|
|||
}
|
||||
}
|
||||
|
||||
no_jsmanaged_fields!(WeakRef<T: WeakReferenceable>);
|
||||
unsafe_no_jsmanaged_fields!(WeakRef<T: WeakReferenceable>);
|
||||
|
||||
impl<T: WeakReferenceable> Drop for WeakRef<T> {
|
||||
fn drop(&mut self) {
|
||||
|
@ -188,17 +188,15 @@ impl<T: WeakReferenceable> HeapSizeOf for MutableWeakRef<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
|
||||
fn trace(&self, _: *mut JSTracer) {
|
||||
unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
|
||||
unsafe fn trace(&self, _: *mut JSTracer) {
|
||||
let ptr = self.cell.get();
|
||||
unsafe {
|
||||
let should_drop = match *ptr {
|
||||
Some(ref value) => !value.is_alive(),
|
||||
None => false,
|
||||
};
|
||||
if should_drop {
|
||||
mem::drop((*ptr).take().unwrap());
|
||||
}
|
||||
let should_drop = match *ptr {
|
||||
Some(ref value) => !value.is_alive(),
|
||||
None => false,
|
||||
};
|
||||
if should_drop {
|
||||
mem::drop((*ptr).take().unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue