Skip to content

Commit

Permalink
Implement JSTraceable for more types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Feb 16, 2017
1 parent 8ce9ca6 commit 3613e8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -4103,6 +4103,7 @@ def define(self):
% (self.type, v["name"]) for v in templateVars
]
return ("""\
#[derive(JSTraceable)]
pub enum %s {
%s
}
Expand Down Expand Up @@ -5881,6 +5882,7 @@ def struct(self):
for m in self.memberInfo]

return (string.Template(
"#[derive(JSTraceable)]\n"
"pub struct ${selfName} {\n" +
"${inheritance}" +
"\n".join(memberDecls) + "\n" +
Expand Down
6 changes: 6 additions & 0 deletions components/script/dom/bindings/js.rs
Expand Up @@ -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.
}
}
2 changes: 1 addition & 1 deletion components/script/dom/bindings/mozmap.rs
Expand Up @@ -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>,
}
Expand Down

0 comments on commit 3613e8f

Please sign in to comment.