Remove support for some more obsolete configurations.

This commit is contained in:
Ms2ger 2014-02-25 14:41:17 +01:00
parent 3c7f9832f0
commit 1c49319173
2 changed files with 15 additions and 62 deletions

View file

@ -1680,8 +1680,7 @@ def memberIsCreator(member):
# Returns a tuple consisting of a CGThing containing the type of the return # Returns a tuple consisting of a CGThing containing the type of the return
# value, or None if there is no need for a return value, and a boolean signaling # value, or None if there is no need for a return value, and a boolean signaling
# whether the return value is passed in an out parameter. # whether the return value is passed in an out parameter.
def getRetvalDeclarationForType(returnType, descriptorProvider, def getRetvalDeclarationForType(returnType, descriptorProvider):
resultAlreadyAddRefed):
if returnType is None or returnType.isVoid(): if returnType is None or returnType.isVoid():
# Nothing to declare # Nothing to declare
return None, False return None, False
@ -1721,8 +1720,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
# If our result is already addrefed, use the right type in the # If our result is already addrefed, use the right type in the
# sequence argument here. # sequence argument here.
(result, _) = getRetvalDeclarationForType(returnType.inner, (result, _) = getRetvalDeclarationForType(returnType.inner,
descriptorProvider, descriptorProvider)
resultAlreadyAddRefed)
result = CGWrapper(result, pre="nsTArray< ", post=" >") result = CGWrapper(result, pre="nsTArray< ", post=" >")
if nullable: if nullable:
result = CGWrapper(result, pre="Nullable< ", post=" >") result = CGWrapper(result, pre="Nullable< ", post=" >")
@ -2956,14 +2954,10 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
*aEnabled = true; *aEnabled = true;
return %s(aCx, global, aReceiver).is_not_null();""" % (getter)) return %s(aCx, global, aReceiver).is_not_null();""" % (getter))
def isResultAlreadyAddRefed(extendedAttributes):
return not 'resultNotAddRefed' in extendedAttributes
def needCx(returnType, arguments, extendedAttributes, considerTypes): def needCx(returnType, arguments, extendedAttributes, considerTypes):
return (considerTypes and return (considerTypes and
(typeNeedsCx(returnType, True) or (typeNeedsCx(returnType, True) or
any(typeNeedsCx(a.type) for a in arguments)) or any(typeNeedsCx(a.type) for a in arguments)))
'implicitJSContext' in extendedAttributes)
def needScopeObject(returnType, arguments, extendedAttributes, def needScopeObject(returnType, arguments, extendedAttributes,
isWrapperCached, considerTypes): isWrapperCached, considerTypes):
@ -2988,12 +2982,8 @@ class CGCallGenerator(CGThing):
isFallible = errorReport is not None isFallible = errorReport is not None
#resultAlreadyAddRefed = isResultAlreadyAddRefed(descriptorProvider,
# extendedAttributes)
resultAlreadyAddRefed = True
(result, resultOutParam) = getRetvalDeclarationForType(returnType, (result, resultOutParam) = getRetvalDeclarationForType(returnType,
descriptorProvider, descriptorProvider)
resultAlreadyAddRefed)
args = CGList([CGGeneric(arg) for arg in argsPre], ", ") args = CGList([CGGeneric(arg) for arg in argsPre], ", ")
for (a, name) in arguments: for (a, name) in arguments:
@ -3014,8 +3004,7 @@ class CGCallGenerator(CGThing):
args.append(CGGeneric("result")) args.append(CGGeneric("result"))
needsCx = (typeNeedsCx(returnType, True) or needsCx = (typeNeedsCx(returnType, True) or
any(typeNeedsCx(a.type) for (a, _) in arguments) or any(typeNeedsCx(a.type) for (a, _) in arguments))
'implicitJSContext' in extendedAttributes)
if not "cx" in argsPre and needsCx: if not "cx" in argsPre and needsCx:
args.prepend(CGGeneric("cx")) args.prepend(CGGeneric("cx"))
@ -3127,12 +3116,6 @@ class CGPerSignatureCall(CGThing):
def wrap_return_value(self): def wrap_return_value(self):
isCreator = memberIsCreator(self.idlNode) isCreator = memberIsCreator(self.idlNode)
if isCreator:
# We better be returning addrefed things!
#assert(isResultAlreadyAddRefed(self.descriptor,
# self.extendedAttributes))
pass
resultTemplateValues = { 'jsvalRef': '*vp', 'jsvalPtr': 'vp', resultTemplateValues = { 'jsvalRef': '*vp', 'jsvalPtr': 'vp',
'isCreator': isCreator} 'isCreator': isCreator}
try: try:
@ -3254,7 +3237,7 @@ class CGAbstractBindingMethod(CGAbstractExternMethod):
CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args) CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args)
if unwrapFailureCode is None: if unwrapFailureCode is None:
self.unwrapFailureCode = ("return 0; //XXXjdm return Throw(cx, rv);") self.unwrapFailureCode = "return 0; //XXXjdm return Throw(cx, rv);"
else: else:
self.unwrapFailureCode = unwrapFailureCode self.unwrapFailureCode = unwrapFailureCode
@ -3323,7 +3306,7 @@ class CGSpecializedMethod(CGAbstractExternMethod):
def definition_body(self): def definition_body(self):
name = self.method.identifier.name name = self.method.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name)) nativeName = MakeNativeName(name)
extraPre = '' extraPre = ''
argsPre = [] argsPre = []
if name in self.descriptor.needsAbstract: if name in self.descriptor.needsAbstract:
@ -3378,13 +3361,11 @@ class CGSpecializedGetter(CGAbstractExternMethod):
def definition_body(self): def definition_body(self):
name = self.attr.identifier.name name = self.attr.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name)) nativeName = MakeNativeName(name)
extraPre = '' extraPre = ''
argsPre = [] argsPre = []
# resultOutParam does not depend on whether resultAlreadyAddRefed is set
(_, resultOutParam) = getRetvalDeclarationForType(self.attr.type, (_, resultOutParam) = getRetvalDeclarationForType(self.attr.type,
self.descriptor, self.descriptor)
False)
infallible = ('infallible' in infallible = ('infallible' in
self.descriptor.getExtendedAttributes(self.attr, self.descriptor.getExtendedAttributes(self.attr,
getter=True)) getter=True))
@ -3448,7 +3429,7 @@ class CGSpecializedSetter(CGAbstractExternMethod):
def definition_body(self): def definition_body(self):
name = self.attr.identifier.name name = self.attr.identifier.name
nativeName = "Set" + MakeNativeName(self.descriptor.binaryNames.get(name, name)) nativeName = "Set" + MakeNativeName(name)
argsPre = [] argsPre = []
extraPre = '' extraPre = ''
if name in self.descriptor.needsAbstract: if name in self.descriptor.needsAbstract:
@ -4382,7 +4363,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
(don't use this directly, use the derived classes below). (don't use this directly, use the derived classes below).
""" """
def __init__(self, descriptor, operation): def __init__(self, descriptor, operation):
nativeName = MakeNativeName(descriptor.binaryNames.get(operation, operation)) nativeName = MakeNativeName(operation)
operation = descriptor.operations[operation] operation = descriptor.operations[operation]
assert len(operation.signatures()) == 1 assert len(operation.signatures()) == 1
signature = operation.signatures()[0] signature = operation.signatures()[0]
@ -4745,8 +4726,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
def getBody(self): def getBody(self):
stringifier = self.descriptor.operations['Stringifier'] stringifier = self.descriptor.operations['Stringifier']
if stringifier: if stringifier:
name = stringifier.identifier.name nativeName = MakeNativeName(stringifier.identifier.name)
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
signature = stringifier.signatures()[0] signature = stringifier.signatures()[0]
returnType = signature[0] returnType = signature[0]
extendedAttributes = self.descriptor.getExtendedAttributes(stringifier) extendedAttributes = self.descriptor.getExtendedAttributes(stringifier)
@ -4838,8 +4818,7 @@ class CGClassConstructHook(CGAbstractExternMethod):
let global = (*page).frame.get_ref().window.clone(); let global = (*page).frame.get_ref().window.clone();
let obj = global.reflector().get_jsobject(); let obj = global.reflector().get_jsobject();
""" """
name = self._ctor.identifier.name nativeName = MakeNativeName(self._ctor.identifier.name)
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
callGenerator = CGMethodCall(["&global"], nativeName, True, callGenerator = CGMethodCall(["&global"], nativeName, True,
self.descriptor, self._ctor) self.descriptor, self._ctor)
return preamble + callGenerator.define(); return preamble + callGenerator.define();
@ -5401,13 +5380,11 @@ class CGNativeMember(ClassMethod):
passed as JSObject*. passed as JSObject*.
If passJSBitsAsNeeded is false, we don't automatically pass in a If passJSBitsAsNeeded is false, we don't automatically pass in a
JSContext* or a JSObject* based on the return and argument types. We JSContext* or a JSObject* based on the return and argument types.
can still pass it based on 'implicitJSContext' annotations.
""" """
self.descriptorProvider = descriptorProvider self.descriptorProvider = descriptorProvider
self.member = member self.member = member
self.extendedAttrs = extendedAttrs self.extendedAttrs = extendedAttrs
self.resultAlreadyAddRefed = isResultAlreadyAddRefed(self.extendedAttrs)
self.passJSBitsAsNeeded = passJSBitsAsNeeded self.passJSBitsAsNeeded = passJSBitsAsNeeded
self.jsObjectsArePtr = jsObjectsArePtr self.jsObjectsArePtr = jsObjectsArePtr
self.variadicIsSequence = variadicIsSequence self.variadicIsSequence = variadicIsSequence
@ -5487,21 +5464,7 @@ class CGNativeMember(ClassMethod):
nativeType.pop(0) nativeType.pop(0)
if nativeType[0] == "dom": if nativeType[0] == "dom":
nativeType.pop(0) nativeType.pop(0)
result = CGGeneric("::".join(nativeType)) result = CGWrapper(CGGeneric("::".join(nativeType)), post="*")
if self.resultAlreadyAddRefed:
if isMember:
holder = "nsRefPtr"
else:
holder = "already_AddRefed"
if memberReturnsNewObject(self.member):
warning = ""
else:
warning = "// Mark this as resultNotAddRefed to return raw pointers\n"
result = CGWrapper(result,
pre=("%s%s<" % (warning, holder)),
post=">")
else:
result = CGWrapper(result, post="*")
# Since we always force an owning type for callback return values, # Since we always force an owning type for callback return values,
# our ${declName} is an OwningNonNull or nsRefPtr. So we can just # our ${declName} is an OwningNonNull or nsRefPtr. So we can just
# .forget() to get our already_AddRefed. # .forget() to get our already_AddRefed.
@ -5902,11 +5865,6 @@ class FakeMember():
def isMethod(self): def isMethod(self):
return False return False
def getExtendedAttribute(self, name): def getExtendedAttribute(self, name):
# Claim to be a [NewObject] so we can avoid the "mark this
# resultNotAddRefed" comments CGNativeMember codegen would
# otherwise stick in.
if name == "NewObject":
return True
return None return None
class CallbackMember(CGNativeMember): class CallbackMember(CGNativeMember):

View file

@ -238,11 +238,6 @@ class Descriptor(DescriptorProvider):
else: else:
add('all', [config], attribute) add('all', [config], attribute)
for attribute in ['implicitJSContext', 'resultNotAddRefed']:
addExtendedAttribute(attribute, desc.get(attribute, {}))
self.binaryNames = desc.get('binaryNames', {})
# Build the prototype chain. # Build the prototype chain.
self.prototypeChain = [] self.prototypeChain = []
parent = interface parent = interface