diff options
author | Ms2ger <Ms2ger@gmail.com> | 2017-02-14 14:42:35 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2017-02-16 11:03:22 +0100 |
commit | 3613e8f231a06142abb726a28bcd8847e768708c (patch) | |
tree | d5f627d7faf8490ad624709e5572cd3bd8607f89 /components/script/dom | |
parent | 8ce9ca624367c8e5737b8673548b230b69f4558b (diff) | |
download | servo-3613e8f231a06142abb726a28bcd8847e768708c.tar.gz servo-3613e8f231a06142abb726a28bcd8847e768708c.zip |
Implement JSTraceable for more types.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/mozmap.rs | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index c47cf185bf2..444d52d3ae6 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -4103,6 +4103,7 @@ class CGUnionStruct(CGThing): % (self.type, v["name"]) for v in templateVars ] return ("""\ +#[derive(JSTraceable)] pub enum %s { %s } @@ -5881,6 +5882,7 @@ class CGDictionary(CGThing): for m in self.memberInfo] return (string.Template( + "#[derive(JSTraceable)]\n" "pub struct ${selfName} {\n" + "${inheritance}" + "\n".join(memberDecls) + "\n" + diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index bdd2b81ce37..e63177e3bd8 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -642,3 +642,9 @@ impl<T: DomObject> Drop for Root<T> { } } } + +unsafe impl<T: DomObject> JSTraceable for Root<T> { + unsafe fn trace(&self, _: *mut JSTracer) { + // Already traced. + } +} diff --git a/components/script/dom/bindings/mozmap.rs b/components/script/dom/bindings/mozmap.rs index 5ef102539b7..abfedf02caf 100644 --- a/components/script/dom/bindings/mozmap.rs +++ b/components/script/dom/bindings/mozmap.rs @@ -23,7 +23,7 @@ use std::collections::HashMap; use std::ops::Deref; /// The `MozMap` (open-ended dictionary) type. -#[derive(Clone)] +#[derive(Clone, JSTraceable)] pub struct MozMap<T> { map: HashMap<DOMString, T>, } |