mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +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`
|
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
|
||||||
/// traits must be implemented on this.
|
/// traits must be implemented on this.
|
||||||
#[allow_unrooted_interior]
|
#[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
|
/// A trait to be implemented for JS-managed types that can be stored in
|
||||||
/// mutable member fields.
|
/// mutable member fields.
|
||||||
|
|
|
@ -88,12 +88,6 @@ pub trait JSTraceable {
|
||||||
fn trace(&self, trc: *mut JSTracer);
|
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!(EncodingRef);
|
||||||
|
|
||||||
no_jsmanaged_fields!(Reflector);
|
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
|
/// A vector of items that are rooted for the lifetime of this struct.
|
||||||
/// of this struct.
|
|
||||||
/// Must be a reflectable
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[no_move]
|
#[no_move]
|
||||||
#[derive(JSTraceable)]
|
#[derive(JSTraceable)]
|
||||||
#[allow_unrooted_interior]
|
#[allow_unrooted_interior]
|
||||||
pub struct RootedVec<T: JSTraceable + Reflectable> {
|
pub struct RootedVec<T: JSTraceable> {
|
||||||
v: Vec<T>
|
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
|
/// Create a vector of items of type T that is rooted for
|
||||||
/// the lifetime of this struct
|
/// the lifetime of this struct
|
||||||
pub fn new() -> RootedVec<T> {
|
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) {
|
fn drop(&mut self) {
|
||||||
RootedTraceableSet::remove(self);
|
RootedTraceableSet::remove(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: JSTraceable + Reflectable> Deref for RootedVec<T> {
|
impl<T: JSTraceable> Deref for RootedVec<T> {
|
||||||
type Target = Vec<T>;
|
type Target = Vec<T>;
|
||||||
fn deref(&self) -> &Vec<T> {
|
fn deref(&self) -> &Vec<T> {
|
||||||
&self.v
|
&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> {
|
fn deref_mut(&mut self) -> &mut Vec<T> {
|
||||||
&mut self.v
|
&mut self.v
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue