aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorDavid Winslow <cdwinslow@gmail.com>2015-07-01 16:31:07 -0400
committerDavid Winslow <cdwinslow@gmail.com>2015-07-01 18:27:06 -0400
commit4cf46bff2d00f33a8866dc6880c8f6178fdf81a4 (patch)
treebfa5da23abf5d88edd40c26486e34b0cf40383d9 /components/script/dom/bindings
parente958d92be6c35234bcffce2d4e74ece585de02e4 (diff)
downloadservo-4cf46bff2d00f33a8866dc6880c8f6178fdf81a4.tar.gz
servo-4cf46bff2d00f33a8866dc6880c8f6178fdf81a4.zip
Refactor #[jstraceable] to #[derive(JSTraceable)]
fixes #6524
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/callback.rs8
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py5
-rw-r--r--components/script/dom/bindings/global.rs2
-rw-r--r--components/script/dom/bindings/js.rs6
-rw-r--r--components/script/dom/bindings/num.rs3
-rw-r--r--components/script/dom/bindings/str.rs3
-rw-r--r--components/script/dom/bindings/trace.rs6
-rw-r--r--components/script/dom/bindings/utils.rs2
8 files changed, 15 insertions, 20 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index dc1bd386afe..905901e3870 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -33,8 +33,7 @@ pub enum ExceptionHandling {
}
/// A common base class for representing IDL callback function types.
-#[derive(PartialEq)]
-#[jstraceable]
+#[derive(JSTraceable, PartialEq)]
pub struct CallbackFunction {
object: CallbackObject
}
@@ -57,8 +56,7 @@ impl CallbackFunction {
}
/// A common base class for representing IDL callback interface types.
-#[derive(PartialEq)]
-#[jstraceable]
+#[derive(JSTraceable, PartialEq)]
pub struct CallbackInterface {
object: CallbackObject
}
@@ -66,7 +64,7 @@ pub struct CallbackInterface {
/// A common base class for representing IDL callback function and
/// callback interface types.
#[allow(raw_pointer_derive)]
-#[jstraceable]
+#[derive(JSTraceable)]
struct CallbackObject {
/// The underlying `JSObject`.
callback: Heap<*mut JSObject>,
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 830dcd51b3e..4bfc1d7b8eb 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -3189,8 +3189,7 @@ class CGEnum(CGThing):
decl = """\
#[repr(usize)]
-#[derive(PartialEq, Copy, Clone)]
-#[jstraceable]
+#[derive(JSTraceable, PartialEq, Copy, Clone)]
pub enum %s {
%s
}
@@ -5181,7 +5180,7 @@ class CGCallback(CGClass):
bases=[ClassBase(baseName)],
constructors=self.getConstructors(),
methods=realMethods+getters+setters,
- decorators="#[derive(PartialEq)]#[jstraceable]")
+ decorators="#[derive(JSTraceable, PartialEq)]")
def getConstructors(self):
return [ClassConstructor(
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index a6924fbb281..60ac197b0bb 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -46,7 +46,7 @@ pub enum GlobalRoot {
/// A traced reference to a global object, for use in fields of traced Rust
/// structures.
-#[jstraceable]
+#[derive(JSTraceable)]
#[must_root]
pub enum GlobalField {
/// A field for a `Window` object.
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index cb02b0d1198..36a3ce19198 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -164,7 +164,7 @@ impl<T: Reflectable> HeapGCValue for JS<T> {
/// Must be used in place of traditional interior mutability to ensure proper
/// GC barriers are enforced.
#[must_root]
-#[jstraceable]
+#[derive(JSTraceable)]
pub struct MutHeapJSVal {
val: UnsafeCell<Heap<JSVal>>,
}
@@ -196,7 +196,7 @@ impl MutHeapJSVal {
/// A holder that provides interior mutability for GC-managed values such as
/// `JS<T>`.
#[must_root]
-#[jstraceable]
+#[derive(JSTraceable)]
pub struct MutHeap<T: HeapGCValue+Copy> {
val: Cell<T>,
}
@@ -225,7 +225,7 @@ impl<T: HeapGCValue+Copy> MutHeap<T> {
/// place of traditional internal mutability to ensure that the proper GC
/// barriers are enforced.
#[must_root]
-#[jstraceable]
+#[derive(JSTraceable)]
pub struct MutNullableHeap<T: HeapGCValue+Copy> {
ptr: Cell<Option<T>>
}
diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs
index d0ceaae89f8..87c5e38a3bb 100644
--- a/components/script/dom/bindings/num.rs
+++ b/components/script/dom/bindings/num.rs
@@ -9,8 +9,7 @@ use num::Float;
use std::ops::Deref;
/// Encapsulates the IDL restricted float type.
-#[derive(Clone,Eq,PartialEq)]
-#[jstraceable]
+#[derive(JSTraceable,Clone,Eq,PartialEq)]
pub struct Finite<T: Float>(T);
unsafe impl<T: Float> Zeroable for Finite<T> {}
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index b8c0af0caa6..5ee26f86543 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -12,8 +12,7 @@ use std::str;
use std::str::FromStr;
/// Encapsulates the IDL `ByteString` type.
-#[derive(Clone,Eq,PartialEq)]
-#[jstraceable]
+#[derive(JSTraceable,Clone,Eq,PartialEq)]
pub struct ByteString(Vec<u8>);
impl ByteString {
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index f401e278498..5c854953f8f 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -12,7 +12,7 @@
//! phase. (This happens through `JSClass.trace` for non-proxy bindings, and
//! through `ProxyTraps.trace` otherwise.)
//! 2. `_trace` calls `Foo::trace()` (an implementation of `JSTraceable`).
-//! This is typically derived via a `#[dom_struct]` (implies `#[jstraceable]`) annotation.
+//! This is typically derived via a `#[dom_struct]` (implies `#[derive(JSTraceable)]`) annotation.
//! Non-JS-managed types have an empty inline `trace()` method,
//! achieved via `no_jsmanaged_fields!` or similar.
//! 3. For all fields, `Foo::trace()`
@@ -410,7 +410,7 @@ impl RootedTraceableSet {
/// If you have GC things like *mut JSObject or JSVal, use jsapi::Rooted.
/// If you have an arbitrary number of Reflectables to root, use RootedVec<JS<T>>
/// If you know what you're doing, use this.
-#[jstraceable]
+#[derive(JSTraceable)]
pub struct RootedTraceable<'a, T: 'a + JSTraceable> {
ptr: &'a T
}
@@ -434,7 +434,7 @@ impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> {
/// Must be a reflectable
#[allow(unrooted_must_root)]
#[no_move]
-#[jstraceable]
+#[derive(JSTraceable)]
pub struct RootedVec<T: JSTraceable + Reflectable> {
v: Vec<T>
}
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index e2db66ac3de..0c47c32f9df 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -65,7 +65,7 @@ use string_cache::{Atom, Namespace};
pub struct WindowProxyHandler(pub *const libc::c_void);
#[allow(raw_pointer_derive)]
-#[jstraceable]
+#[derive(JSTraceable)]
/// Static data associated with a global object.
pub struct GlobalStaticData {
/// The WindowProxy proxy handler for this global.