mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Root any
members in dictionaries
This commit is contained in:
parent
760e0a5b57
commit
64dc0c4b9e
4 changed files with 39 additions and 19 deletions
|
@ -1084,13 +1084,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
assert isMember != "Union"
|
||||
|
||||
if isMember == "Dictionary" or isAutoRooted:
|
||||
# TODO: Need to properly root dictionaries
|
||||
# https://github.com/servo/servo/issues/6381
|
||||
if isMember == "Dictionary":
|
||||
declType = CGGeneric("Heap<JSVal>")
|
||||
# AutoRooter can trace properly inner raw GC thing pointers
|
||||
else:
|
||||
declType = CGGeneric("JSVal")
|
||||
templateBody = "${val}.get()"
|
||||
|
||||
if defaultValue is None:
|
||||
default = None
|
||||
|
@ -1100,7 +1094,17 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
default = "UndefinedValue()"
|
||||
else:
|
||||
raise TypeError("Can't handle non-null, non-undefined default value here")
|
||||
return handleOptional("${val}.get()", declType, default)
|
||||
|
||||
if isMember == "Dictionary":
|
||||
templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody
|
||||
if default is not None:
|
||||
default = "RootedTraceableBox::from_box(Heap::boxed(%s))" % default
|
||||
declType = CGGeneric("RootedTraceableBox<Heap<JSVal>>")
|
||||
# AutoRooter can trace properly inner raw GC thing pointers
|
||||
else:
|
||||
declType = CGGeneric("JSVal")
|
||||
|
||||
return handleOptional(templateBody, declType, default)
|
||||
|
||||
declType = CGGeneric("HandleValue")
|
||||
|
||||
|
@ -6165,9 +6169,6 @@ class CGDictionary(CGThing):
|
|||
conversion = self.getMemberConversion(memberInfo, member.type)
|
||||
if isInitial:
|
||||
return CGGeneric("%s: %s,\n" % (name, conversion.define()))
|
||||
# TODO: Root Heap<JSVal> using RootedTraceableBox
|
||||
if member.type.isAny():
|
||||
return CGGeneric("dictionary.%s.set(%s);\n" % (name, conversion.define()))
|
||||
return CGGeneric("dictionary.%s = %s;\n" % (name, conversion.define()))
|
||||
|
||||
def varInsert(varName, dictionaryName):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue