mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
Auto merge of #7616 - Ms2ger:js-reflector, r=jdm
Stop implementing Reflectable for JS<T>. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7616) <!-- Reviewable:end -->
This commit is contained in:
commit
e10c5c74cc
2 changed files with 12 additions and 21 deletions
|
@ -88,6 +88,12 @@ impl<T: Reflectable> JS<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> JSTraceable for JS<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
trace_reflector(trc, "", unsafe { (**self.ptr).reflector() });
|
||||
}
|
||||
}
|
||||
|
||||
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
|
||||
/// traits must be implemented on this.
|
||||
#[allow_unrooted_interior]
|
||||
|
@ -148,13 +154,6 @@ impl LayoutJS<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> Reflectable for JS<T> {
|
||||
fn reflector(&self) -> &Reflector {
|
||||
unsafe {
|
||||
(**self.ptr).reflector()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait to be implemented for JS-managed types that can be stored in
|
||||
/// mutable member fields.
|
||||
|
|
|
@ -88,12 +88,6 @@ pub trait JSTraceable {
|
|||
fn trace(&self, trc: *mut JSTracer);
|
||||
}
|
||||
|
||||
impl<T: Reflectable> JSTraceable for JS<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
trace_reflector(trc, "", self.reflector());
|
||||
}
|
||||
}
|
||||
|
||||
no_jsmanaged_fields!(EncodingRef);
|
||||
|
||||
no_jsmanaged_fields!(Reflector);
|
||||
|
@ -455,19 +449,17 @@ impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A vector of items that are rooted for the lifetime
|
||||
/// of this struct.
|
||||
/// Must be a reflectable
|
||||
/// A vector of items that are rooted for the lifetime of this struct.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[no_move]
|
||||
#[derive(JSTraceable)]
|
||||
#[allow_unrooted_interior]
|
||||
pub struct RootedVec<T: JSTraceable + Reflectable> {
|
||||
pub struct RootedVec<T: JSTraceable> {
|
||||
v: Vec<T>
|
||||
}
|
||||
|
||||
|
||||
impl<T: JSTraceable + Reflectable> RootedVec<T> {
|
||||
impl<T: JSTraceable> RootedVec<T> {
|
||||
/// Create a vector of items of type T that is rooted for
|
||||
/// the lifetime of this struct
|
||||
pub fn new() -> RootedVec<T> {
|
||||
|
@ -495,20 +487,20 @@ impl<T: JSTraceable + Reflectable> RootedVec<JS<T>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Reflectable> Drop for RootedVec<T> {
|
||||
impl<T: JSTraceable> Drop for RootedVec<T> {
|
||||
fn drop(&mut self) {
|
||||
RootedTraceableSet::remove(self);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Reflectable> Deref for RootedVec<T> {
|
||||
impl<T: JSTraceable> Deref for RootedVec<T> {
|
||||
type Target = Vec<T>;
|
||||
fn deref(&self) -> &Vec<T> {
|
||||
&self.v
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JSTraceable + Reflectable> DerefMut for RootedVec<T> {
|
||||
impl<T: JSTraceable> DerefMut for RootedVec<T> {
|
||||
fn deref_mut(&mut self) -> &mut Vec<T> {
|
||||
&mut self.v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue