aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-26 01:53:40 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-26 09:49:10 +0200
commitf87c2a8d7616112ca924e30292db2d244cf87eec (patch)
tree7344afe7ec0ec1ac7d1d13f5385111ee9c4be332 /components/script/dom/bindings/codegen/CodegenRust.py
parent577370746e2ce3da7fa25a20b8e1bbeed319df65 (diff)
downloadservo-f87c2a8d7616112ca924e30292db2d244cf87eec.tar.gz
servo-f87c2a8d7616112ca924e30292db2d244cf87eec.zip
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 888a17a3a8c..8880707f7d5 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2254,7 +2254,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
'dom::bindings::conversions::root_from_handlevalue',
'dom::bindings::error::throw_not_in_union',
'dom::bindings::mozmap::MozMap',
- 'dom::bindings::root::Root',
+ 'dom::bindings::root::DomRoot',
'dom::bindings::str::ByteString',
'dom::bindings::str::DOMString',
'dom::bindings::str::USVString',
@@ -2558,7 +2558,7 @@ class CGWrapMethod(CGAbstractMethod):
args = [Argument('*mut JSContext', 'cx'),
Argument('&GlobalScope', 'scope'),
Argument("Box<%s>" % descriptor.concreteType, 'object')]
- retval = 'Root<%s>' % descriptor.concreteType
+ retval = 'DomRoot<%s>' % descriptor.concreteType
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
pub=True, unsafe=True)
@@ -2580,7 +2580,7 @@ assert!(!proto.is_null());
%(copyUnforgeable)s
(*raw).init_reflector(obj.get());
-Root::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': create})
+DomRoot::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': create})
class CGWrapGlobalMethod(CGAbstractMethod):
@@ -2592,7 +2592,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
assert descriptor.isGlobal()
args = [Argument('*mut JSContext', 'cx'),
Argument("Box<%s>" % descriptor.concreteType, 'object')]
- retval = 'Root<%s>' % descriptor.concreteType
+ retval = 'DomRoot<%s>' % descriptor.concreteType
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
pub=True, unsafe=True)
self.properties = properties
@@ -2638,7 +2638,7 @@ assert!(immutable);
%(unforgeable)s
-Root::from_ref(&*raw)\
+DomRoot::from_ref(&*raw)\
""" % values)
@@ -3421,7 +3421,9 @@ class CGAbstractStaticBindingMethod(CGAbstractMethod):
def definition_body(self):
preamble = "let global = GlobalScope::from_object(JS_CALLEE(cx, vp).to_object());\n"
if len(self.exposureSet) == 1:
- preamble += "let global = Root::downcast::<dom::types::%s>(global).unwrap();\n" % list(self.exposureSet)[0]
+ preamble += """
+let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
+""" % list(self.exposureSet)[0]
return CGList([CGGeneric(preamble), self.generate_code()])
def generate_code(self):
@@ -5352,7 +5354,9 @@ class CGClassConstructHook(CGAbstractExternMethod):
def definition_body(self):
preamble = """let global = GlobalScope::from_object(JS_CALLEE(cx, vp).to_object());\n"""
if len(self.exposureSet) == 1:
- preamble += "let global = Root::downcast::<dom::types::%s>(global).unwrap();\n" % list(self.exposureSet)[0]
+ preamble += """\
+let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
+""" % list(self.exposureSet)[0]
preamble += """let args = CallArgs::from_vp(vp, argc);\n"""
preamble = CGGeneric(preamble)
if self.constructor.isHTMLConstructor():
@@ -5408,7 +5412,7 @@ if !JS_WrapObject(cx, prototype.handle_mut()) {
return false;
}
-let result: Result<Root<%s>, Error> = html_constructor(&global, &args);
+let result: Result<DomRoot<%s>, Error> = html_constructor(&global, &args);
let result = match result {
Ok(result) => result,
Err(e) => {
@@ -5713,8 +5717,8 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::reflector::MutDomObject',
'dom::bindings::reflector::DomObject',
'dom::bindings::root::Dom',
+ 'dom::bindings::root::DomRoot',
'dom::bindings::root::OptionalHeapSetter',
- 'dom::bindings::root::Root',
'dom::bindings::root::RootedReference',
'dom::bindings::utils::AsVoidPtr',
'dom::bindings::utils::DOMClass',
@@ -6281,7 +6285,7 @@ class CGRegisterProxyHandlers(CGThing):
class CGBindingRoot(CGThing):
"""
- Root codegen class for binding generation. Instantiate the class, and call
+ DomRoot codegen class for binding generation. Instantiate the class, and call
declare or define to generate header or cpp code (respectively).
"""
def __init__(self, config, prefix, webIDLFile):
@@ -7195,7 +7199,7 @@ class GlobalGenRoots():
imports = [CGGeneric("use dom::types::*;\n"),
CGGeneric("use dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"),
CGGeneric("use dom::bindings::inheritance::Castable;\n"),
- CGGeneric("use dom::bindings::root::{Dom, LayoutDom, Root};\n"),
+ CGGeneric("use dom::bindings::root::{Dom, DomRoot, LayoutDom};\n"),
CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
CGGeneric("use dom::bindings::reflector::DomObject;\n"),
CGGeneric("use js::jsapi::JSTracer;\n\n"),