auto merge of #1797 : Ms2ger/servo/IDL-debris, r=jdm

This commit is contained in:
bors-servo 2014-03-03 14:25:29 -05:00
commit 411892484b
3 changed files with 13 additions and 68 deletions

View file

@ -910,8 +910,7 @@ for (uint32_t i = 0; i < length; ++i) {
# This is an interface that we implement as a concrete class # This is an interface that we implement as a concrete class
# or an XPCOM interface. # or an XPCOM interface.
# Allow null pointers for nullable types and old-binding classes argIsPointer = type.nullable()
argIsPointer = type.nullable() or type.unroll().inner.isExternal()
# Sequences and callbacks have to hold a strong ref to the thing being # Sequences and callbacks have to hold a strong ref to the thing being
# passed down. # passed down.
@ -1539,8 +1538,7 @@ for (uint32_t i = 0; i < length; ++i) {
"let mut %s = %s.unwrap();\n" % (result, result)) "let mut %s = %s.unwrap();\n" % (result, result))
else: else:
wrappingCode = "" wrappingCode = ""
if (not descriptor.interface.isExternal() and if not descriptor.interface.isCallback():
not descriptor.interface.isCallback()):
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
# Non-prefable bindings can only fail to wrap as a new-binding object # Non-prefable bindings can only fail to wrap as a new-binding object
# if they already threw an exception. Same thing for # if they already threw an exception. Same thing for
@ -2398,9 +2396,6 @@ def UnionTypes(descriptors):
declarations = set() declarations = set()
unionStructs = dict() unionStructs = dict()
for d in descriptors: for d in descriptors:
if d.interface.isExternal():
continue
for t in getTypes(d): for t in getTypes(d):
t = t.unroll() t = t.unroll()
if t.isUnion(): if t.isUnion():
@ -2430,9 +2425,6 @@ def UnionConversions(descriptors):
# need to unwrap them. # need to unwrap them.
unionConversions = dict() unionConversions = dict()
for d in descriptors: for d in descriptors:
if d.interface.isExternal():
continue
def addUnionTypes(type): def addUnionTypes(type):
if type.isUnion(): if type.isUnion():
type = type.unroll() type = type.unroll()
@ -3592,8 +3584,7 @@ def getUnionAccessorSignatureType(type, descriptorProvider):
descriptor = descriptorProvider.getDescriptor( descriptor = descriptorProvider.getDescriptor(
type.unroll().inner.identifier.name) type.unroll().inner.identifier.name)
typeName = CGGeneric(descriptor.nativeType) typeName = CGGeneric(descriptor.nativeType)
# Allow null pointers for nullable types and old-binding classes if type.nullable():
if type.nullable() or type.unroll().inner.isExternal():
typeName = CGWrapper(typeName, pre="Option<", post=">") typeName = CGWrapper(typeName, pre="Option<", post=">")
else: else:
typeName = CGWrapper(typeName, pre="&'a ") typeName = CGWrapper(typeName, pre="&'a ")
@ -4919,8 +4910,7 @@ class CGDescriptor(CGThing):
if descriptor.interface.hasInterfaceObject(): if descriptor.interface.hasInterfaceObject():
cgThings.append(CGDefineDOMInterfaceMethod(descriptor)) cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
if (not descriptor.interface.isExternal() and if (descriptor.interface.getExtendedAttribute("PrefControlled") is not None):
descriptor.interface.getExtendedAttribute("PrefControlled") is not None):
#cgThings.append(CGPrefEnabled(descriptor)) #cgThings.append(CGPrefEnabled(descriptor))
pass pass
@ -5253,7 +5243,6 @@ class CGRegisterProtos(CGAbstractMethod):
def _registerProtos(self): def _registerProtos(self):
lines = [" assert!(codegen::%sBinding::DefineDOMInterface(js_info));" % (desc.name) lines = [" assert!(codegen::%sBinding::DefineDOMInterface(js_info));" % (desc.name)
for desc in self.config.getDescriptors(hasInterfaceObject=True, for desc in self.config.getDescriptors(hasInterfaceObject=True,
isExternal=False,
register=True)] register=True)]
return '\n'.join(lines) + '\n' return '\n'.join(lines) + '\n'
def definition_body(self): def definition_body(self):
@ -5587,7 +5576,7 @@ class CGNativeMember(ClassMethod):
if type.isGeckoInterface() and not type.isCallbackInterface(): if type.isGeckoInterface() and not type.isCallbackInterface():
iface = type.unroll().inner iface = type.unroll().inner
argIsPointer = type.nullable() or iface.isExternal() argIsPointer = type.nullable()
forceOwningType = iface.isCallback() or isMember forceOwningType = iface.isCallback() or isMember
if argIsPointer: if argIsPointer:
if (optional or isMember) and forceOwningType: if (optional or isMember) and forceOwningType:

View file

@ -57,17 +57,13 @@ class Configuration:
if key == 'webIDLFile': if key == 'webIDLFile':
getter = lambda x: x.interface.filename() getter = lambda x: x.interface.filename()
elif key == 'hasInterfaceObject': elif key == 'hasInterfaceObject':
getter = lambda x: (not x.interface.isExternal() and getter = lambda x: x.interface.hasInterfaceObject()
x.interface.hasInterfaceObject())
elif key == 'hasInterfacePrototypeObject': elif key == 'hasInterfacePrototypeObject':
getter = lambda x: (not x.interface.isExternal() and getter = lambda x: x.interface.hasInterfacePrototypeObject()
x.interface.hasInterfacePrototypeObject())
elif key == 'hasInterfaceOrInterfacePrototypeObject': elif key == 'hasInterfaceOrInterfacePrototypeObject':
getter = lambda x: x.hasInterfaceOrInterfacePrototypeObject() getter = lambda x: x.hasInterfaceOrInterfacePrototypeObject()
elif key == 'isCallback': elif key == 'isCallback':
getter = lambda x: x.interface.isCallback() getter = lambda x: x.interface.isCallback()
elif key == 'isExternal':
getter = lambda x: x.interface.isExternal()
elif key == 'isJSImplemented': elif key == 'isJSImplemented':
getter = lambda x: x.interface.isJSImplemented() getter = lambda x: x.interface.isJSImplemented()
else: else:
@ -132,7 +128,7 @@ class Descriptor(DescriptorProvider):
# Read the desc, and fill in the relevant defaults. # Read the desc, and fill in the relevant defaults.
ifaceName = self.interface.identifier.name ifaceName = self.interface.identifier.name
if self.interface.isExternal() or self.interface.isCallback(): if self.interface.isCallback():
nativeTypeDefault = "nsIDOM" + ifaceName nativeTypeDefault = "nsIDOM" + ifaceName
else: else:
nativeTypeDefault = 'JS<%s>' % ifaceName nativeTypeDefault = 'JS<%s>' % ifaceName
@ -142,9 +138,9 @@ class Descriptor(DescriptorProvider):
self.needsAbstract = desc.get('needsAbstract', []) self.needsAbstract = desc.get('needsAbstract', [])
self.createGlobal = desc.get('createGlobal', False) self.createGlobal = desc.get('createGlobal', False)
if self.interface.isCallback() or self.interface.isExternal(): if self.interface.isCallback():
if 'castable' in desc: if 'castable' in desc:
raise TypeError("%s is external or callback but has a castable " raise TypeError("%s is callback but has a castable "
"setting" % self.interface.identifier.name) "setting" % self.interface.identifier.name)
self.castable = False self.castable = False
else: else:
@ -154,7 +150,7 @@ class Descriptor(DescriptorProvider):
# If we're concrete, we need to crawl our ancestor interfaces and mark # If we're concrete, we need to crawl our ancestor interfaces and mark
# them as having a concrete descendant. # them as having a concrete descendant.
self.concrete = desc.get('concrete', not self.interface.isExternal()) self.concrete = desc.get('concrete', True)
if self.concrete: if self.concrete:
self.proxy = False self.proxy = False
operations = { operations = {
@ -248,13 +244,6 @@ class Descriptor(DescriptorProvider):
len(self.prototypeChain)) len(self.prototypeChain))
def hasInterfaceOrInterfacePrototypeObject(self): def hasInterfaceOrInterfacePrototypeObject(self):
# Forward-declared interfaces don't need either interface object or
# interface prototype object as they're going to use QI (on main thread)
# or be passed as a JSObject (on worker threads).
if self.interface.isExternal():
return False
return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject() return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject()
def getExtendedAttributes(self, member, getter=False, setter=False): def getExtendedAttributes(self, member, getter=False, setter=False):

View file

@ -450,41 +450,8 @@ class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
class IDLExternalInterface(IDLObjectWithIdentifier): class IDLExternalInterface(IDLObjectWithIdentifier):
def __init__(self, location, parentScope, identifier): def __init__(self, location, parentScope, identifier):
assert isinstance(identifier, IDLUnresolvedIdentifier) raise WebIDLError("Servo does not support external interfaces.",
assert isinstance(parentScope, IDLScope) [self.location])
self.parent = None
IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
IDLObjectWithIdentifier.resolve(self, parentScope)
def finish(self, scope):
pass
def validate(self):
pass
def isExternal(self):
return True
def isInterface(self):
return True
def isConsequential(self):
return False
def addExtendedAttributes(self, attrs):
assert len(attrs) == 0
def resolve(self, parentScope):
pass
def getJSImplementation(self):
return None
def isJSImplemented(self):
return False
def _getDependentObjects(self):
return set()
class IDLInterface(IDLObjectWithScope): class IDLInterface(IDLObjectWithScope):
def __init__(self, location, parentScope, name, parent, members, def __init__(self, location, parentScope, name, parent, members,