mirror of
https://github.com/servo/servo.git
synced 2025-08-01 19:50:30 +01:00
make changes according to code review (#8097)
This commit is contained in:
parent
d9f8f68615
commit
fe59b62db7
1 changed files with 26 additions and 15 deletions
|
@ -251,11 +251,6 @@ impl<T: Reflectable> MutHeap<JS<T>> {
|
|||
ptr::read(self.val.get()).root()
|
||||
}
|
||||
}
|
||||
|
||||
/// Compare this object to an `&T` value.
|
||||
fn eq(&self, other: &T) -> bool {
|
||||
self.get() == Root::from_ref(other)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> {
|
||||
|
@ -267,7 +262,17 @@ impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> {
|
|||
|
||||
impl<T: Reflectable> PartialEq for MutHeap<JS<T>> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.get().eq(&other.get())
|
||||
unsafe {
|
||||
*self.val.get() == *other.val.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> PartialEq<T> for MutHeap<JS<T>> {
|
||||
fn eq(&self, other: &T) -> bool {
|
||||
unsafe {
|
||||
*self.val.get() == JS::from_ref(other)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,9 +336,21 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Compare this object to an `Option<&T>` value.
|
||||
fn equal(&self, other: Option<&T>) -> bool {
|
||||
self.get() == other.map(|p| Root::from_ref(p))
|
||||
}
|
||||
|
||||
impl<T: Reflectable> PartialEq for MutNullableHeap<JS<T>> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
unsafe {
|
||||
*self.ptr.get() == *other.ptr.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Reflectable> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
|
||||
fn eq(&self, other: &Option<&T>) -> bool {
|
||||
unsafe {
|
||||
*self.ptr.get() == other.map(|p| JS::from_ref(p))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,12 +370,6 @@ impl<T: HeapGCValue> HeapSizeOf for MutNullableHeap<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> PartialEq for MutNullableHeap<JS<T>> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.get().eq(&other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> LayoutJS<T> {
|
||||
/// Returns an unsafe pointer to the interior of this JS object. This is
|
||||
/// the only method that be safely accessed from layout. (The fact that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue