mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 6f411275b7ec (bug 1068740) for bustage on a CLOSED TREE
This commit is contained in:
parent
6fc8e58fd6
commit
ae2a8cfd8d
@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/HTMLCanvasElementBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/MouseEvent.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLFormControlsCollectionBinding.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsGenericHTMLElement.h" // nsGenericHTMLFormElement
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
@ -22,8 +23,6 @@ class nsIDOMHTMLOptionElement;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLElementOrLong;
|
||||
class HTMLOptionElementOrHTMLOptGroupElement;
|
||||
class HTMLSelectElement;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "mozilla/dom/HTMLOptGroupElement.h"
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
#include "mozilla/dom/HTMLSelectElementBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsError.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsRuleData.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/HTMLCollectionBinding.h"
|
||||
#include "mozilla/dom/HTMLTableElementBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/dom/HTMLAllCollectionBinding.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/dom/HTMLDivElement.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/TextTrack.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/MediaKeySessionBinding.h"
|
||||
#include "mozilla/dom/MediaKeysBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
struct JSContext;
|
||||
|
||||
@ -27,7 +28,6 @@ class CDMProxy;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class ArrayBufferViewOrArrayBuffer;
|
||||
class MediaKeyError;
|
||||
|
||||
class MediaKeySession MOZ_FINAL : public DOMEventTargetHelper
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "mozilla/dom/MediaKeyError.h"
|
||||
#include "mozilla/dom/MediaKeySession.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/CDMProxy.h"
|
||||
#include "mozilla/EMELog.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/MediaKeysBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozIGeckoMediaPluginService.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -25,7 +26,6 @@ class CDMProxy;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class ArrayBufferViewOrArrayBuffer;
|
||||
class MediaKeySession;
|
||||
class HTMLMediaElement;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_dom_Console_h
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/UnionConversions.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
@ -10,13 +10,13 @@
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/CryptoKey.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ObjectOrString;
|
||||
class Promise;
|
||||
|
||||
typedef ArrayBufferViewOrArrayBuffer CryptoOperationData;
|
||||
|
@ -10,8 +10,8 @@ import string
|
||||
import math
|
||||
import textwrap
|
||||
|
||||
from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType, IDLAttribute, IDLUndefinedValue, IDLEmptySequenceValue, IDLDictionary
|
||||
from Configuration import NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, getAllTypes, Descriptor
|
||||
from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType, IDLAttribute, IDLUndefinedValue, IDLEmptySequenceValue
|
||||
from Configuration import NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, Descriptor
|
||||
|
||||
AUTOGENERATED_WARNING_COMMENT = \
|
||||
"/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
|
||||
@ -1009,6 +1009,26 @@ def getRelevantProviders(descriptor, config):
|
||||
]
|
||||
|
||||
|
||||
def getAllTypes(descriptors, dictionaries, callbacks):
|
||||
"""
|
||||
Generate all the types we're dealing with. For each type, a tuple
|
||||
containing type, descriptor, dictionary is yielded. The
|
||||
descriptor and dictionary can be None if the type does not come
|
||||
from a descriptor or dictionary; they will never both be non-None.
|
||||
"""
|
||||
for d in descriptors:
|
||||
if d.interface.isExternal():
|
||||
continue
|
||||
for t in getTypesFromDescriptor(d):
|
||||
yield (t, d, None)
|
||||
for dictionary in dictionaries:
|
||||
for t in getTypesFromDictionary(dictionary):
|
||||
yield (t, None, dictionary)
|
||||
for callback in callbacks:
|
||||
for t in getTypesFromCallback(callback):
|
||||
yield (t, None, None)
|
||||
|
||||
|
||||
class CGHeaders(CGWrapper):
|
||||
"""
|
||||
Generates the appropriate include statements.
|
||||
@ -1086,11 +1106,12 @@ class CGHeaders(CGWrapper):
|
||||
headerSet.add("mozilla/dom/Nullable.h")
|
||||
unrolled = t.unroll()
|
||||
if unrolled.isUnion():
|
||||
if len(config.filenamesPerUnion[unrolled.name]) > 1:
|
||||
headerSet.add("mozilla/dom/UnionTypes.h")
|
||||
# UnionConversions.h includes UnionTypes.h
|
||||
bindingHeaders.add("mozilla/dom/UnionConversions.h")
|
||||
else:
|
||||
headerSet.add(self.getDeclarationFilename(unrolled))
|
||||
if dictionary:
|
||||
# Our dictionary definition is in the header and
|
||||
# needs the union type.
|
||||
declareIncludes.add("mozilla/dom/UnionTypes.h")
|
||||
elif unrolled.isDate():
|
||||
if dictionary or jsImplementedDescriptors:
|
||||
declareIncludes.add("mozilla/dom/Date.h")
|
||||
@ -1236,42 +1257,43 @@ def SortedDictValues(d):
|
||||
"""
|
||||
return [v for k, v in sorted(d.items())]
|
||||
|
||||
def UnionsForFile(config, webIDLFile):
|
||||
"""
|
||||
Returns a list of tuples each containing two elements (type and descriptor)
|
||||
for all union types that are only used in webIDLFile. If webIDLFile is None
|
||||
this will return the list of tuples for union types that are used in more
|
||||
than one WebIDL file.
|
||||
"""
|
||||
return config.unionsPerFilename.get(webIDLFile, [])
|
||||
|
||||
def UnionTypes(unionTypes, config):
|
||||
def UnionTypes(descriptors, dictionaries, callbacks, config):
|
||||
"""
|
||||
The unionTypes argument should be a list of tuples, each containing two
|
||||
elements: a union type and a descriptor. This is typically the list
|
||||
generated by UnionsForFile.
|
||||
|
||||
Returns a tuple containing a set of header filenames to include in
|
||||
the header for the types in unionTypes, a set of header filenames to
|
||||
include in the implementation file for the types in unionTypes, a set
|
||||
UnionTypes.h, a set of header filenames to include in UnionTypes.cpp, a set
|
||||
of tuples containing a type declaration and a boolean if the type is a
|
||||
struct for member types of the union, a list of traverse methods,
|
||||
unlink methods and a list of union types. These last three lists only
|
||||
contain unique union types.
|
||||
struct for member types of the unions and a CGList containing CGUnionStructs
|
||||
for every union.
|
||||
"""
|
||||
|
||||
# Now find all the things we'll need as arguments and return values because
|
||||
# we need to wrap or unwrap them.
|
||||
headers = set()
|
||||
implheaders = set()
|
||||
implheaders = set(["UnionTypes.h"])
|
||||
declarations = set()
|
||||
unionStructs = dict()
|
||||
owningUnionStructs = dict()
|
||||
traverseMethods = dict()
|
||||
unlinkMethods = dict()
|
||||
|
||||
for (t, descriptor) in unionTypes:
|
||||
for t, descriptor, dictionary in getAllTypes(descriptors, dictionaries, callbacks):
|
||||
# Add info for the given type. descriptor and dictionary, if present, are
|
||||
# used to figure out what to do with interface types.
|
||||
assert not descriptor or not dictionary
|
||||
|
||||
t = t.unroll()
|
||||
while t.isMozMap():
|
||||
t = t.inner.unroll()
|
||||
if not t.isUnion():
|
||||
continue
|
||||
name = str(t)
|
||||
if name not in unionStructs:
|
||||
providers = getRelevantProviders(descriptor, config)
|
||||
unionStructs[name] = t
|
||||
# FIXME: Unions are broken in workers. See bug 809899.
|
||||
unionStructs[name] = CGUnionStruct(t, providers[0])
|
||||
owningUnionStructs[name] = CGUnionStruct(t, providers[0],
|
||||
ownsMembers=True)
|
||||
|
||||
def addHeadersForType(f):
|
||||
if f.nullable():
|
||||
@ -1322,10 +1344,6 @@ def UnionTypes(unionTypes, config):
|
||||
# And add headers for the type we're parametrized over
|
||||
addHeadersForType(f.inner)
|
||||
|
||||
if len(config.filenamesPerUnion[t.name]) > 0:
|
||||
implheaders.add("mozilla/dom/UnionTypes.h")
|
||||
else:
|
||||
implheaders.add(CGHeaders.getDeclarationFilename(t))
|
||||
for f in t.flatMemberTypes:
|
||||
assert not f.nullable()
|
||||
addHeadersForType(f)
|
||||
@ -1341,22 +1359,30 @@ def UnionTypes(unionTypes, config):
|
||||
# some compilers treat the friend declaration as a forward-declaration in
|
||||
# the class scope.
|
||||
return (headers, implheaders, declarations,
|
||||
SortedDictValues(traverseMethods), SortedDictValues(unlinkMethods),
|
||||
SortedDictValues(unionStructs))
|
||||
CGList(SortedDictValues(traverseMethods) +
|
||||
SortedDictValues(unlinkMethods) +
|
||||
SortedDictValues(unionStructs) +
|
||||
SortedDictValues(owningUnionStructs),
|
||||
"\n"))
|
||||
|
||||
def UnionConversions(unionTypes, config):
|
||||
"""
|
||||
The unionTypes argument should be a list of tuples, each containing two
|
||||
elements: a union type and a descriptor. This is typically the list
|
||||
generated by UnionsForFile.
|
||||
|
||||
Returns a tuple containing a list of headers and a CGThing to declare all
|
||||
union argument conversion helper structs.
|
||||
def UnionConversions(descriptors, dictionaries, callbacks, config):
|
||||
"""
|
||||
Returns a CGThing to declare all union argument conversion helper structs.
|
||||
"""
|
||||
# Now find all the things we'll need as arguments because we
|
||||
# need to unwrap them.
|
||||
headers = set()
|
||||
unionConversions = dict()
|
||||
|
||||
for (t, descriptor) in unionTypes:
|
||||
for t, descriptor, dictionary in getAllTypes(descriptors, dictionaries, callbacks):
|
||||
# Add info for the given type. descriptor and dictionary, if passed, are
|
||||
# used to figure out what to do with interface types.
|
||||
assert not descriptor or not dictionary
|
||||
|
||||
t = t.unroll()
|
||||
if not t.isUnion():
|
||||
continue
|
||||
name = str(t)
|
||||
if name not in unionConversions:
|
||||
providers = getRelevantProviders(descriptor, config)
|
||||
@ -3570,9 +3596,6 @@ class CGCycleCollectionTraverseForOwningUnionMethod(CGAbstractMethod):
|
||||
Argument("uint32_t", "aFlags", "0")]
|
||||
CGAbstractMethod.__init__(self, None, "ImplCycleCollectionTraverse", "void", args)
|
||||
|
||||
def deps(self):
|
||||
return self.type.getDeps()
|
||||
|
||||
def definition_body(self):
|
||||
memberNames = [getUnionMemberName(t)
|
||||
for t in self.type.flatMemberTypes
|
||||
@ -3594,13 +3617,9 @@ class CGCycleCollectionUnlinkForOwningUnionMethod(CGAbstractMethod):
|
||||
ImplCycleCollectionUnlink for owning union type.
|
||||
"""
|
||||
def __init__(self, type):
|
||||
self.type = type
|
||||
args = [Argument("%s&" % CGUnionStruct.unionTypeName(type, True), "aUnion")]
|
||||
CGAbstractMethod.__init__(self, None, "ImplCycleCollectionUnlink", "void", args)
|
||||
|
||||
def deps(self):
|
||||
return self.type.getDeps()
|
||||
|
||||
def definition_body(self):
|
||||
return "aUnion.Uninit();\n"
|
||||
|
||||
@ -8673,9 +8692,6 @@ class CGUnionStruct(CGThing):
|
||||
def define(self):
|
||||
return self.struct.define()
|
||||
|
||||
def deps(self):
|
||||
return self.type.getDeps()
|
||||
|
||||
def getStruct(self):
|
||||
|
||||
members = [ClassMember("mType", "Type", body="eUninitialized"),
|
||||
@ -9033,9 +9049,7 @@ class CGUnionConversionStruct(CGThing):
|
||||
disallowCopyConstruction=True).declare()
|
||||
|
||||
def define(self):
|
||||
return ""
|
||||
def deps(self):
|
||||
return set()
|
||||
return "\n"
|
||||
|
||||
|
||||
class ClassItem:
|
||||
@ -11845,6 +11859,23 @@ class CGDictionary(CGThing):
|
||||
def makeIdName(name):
|
||||
return IDLToCIdentifier(name) + "_id"
|
||||
|
||||
@staticmethod
|
||||
def getDictionaryDependenciesFromType(type):
|
||||
if type.isDictionary():
|
||||
return set([type.unroll().inner])
|
||||
if type.isSequence() or type.isArray():
|
||||
return CGDictionary.getDictionaryDependenciesFromType(type.unroll())
|
||||
return set()
|
||||
|
||||
@staticmethod
|
||||
def getDictionaryDependencies(dictionary):
|
||||
deps = set()
|
||||
if dictionary.parent:
|
||||
deps.add(dictionary.parent)
|
||||
for member in dictionary.members:
|
||||
deps |= CGDictionary.getDictionaryDependenciesFromType(member.type)
|
||||
return deps
|
||||
|
||||
@staticmethod
|
||||
def isDictionaryCopyConstructible(dictionary):
|
||||
if (dictionary.parent and
|
||||
@ -12138,21 +12169,6 @@ class CGBindingRoot(CGThing):
|
||||
hasInterfaceOrInterfacePrototypeObject=True,
|
||||
skipGen=False)
|
||||
|
||||
unionTypes = UnionsForFile(config, webIDLFile)
|
||||
|
||||
(unionHeaders, unionImplheaders, unionDeclarations, traverseMethods,
|
||||
unlinkMethods, unionStructs) = UnionTypes(unionTypes, config)
|
||||
|
||||
(unionConversionHeaders, unionConversions) = UnionConversions(unionTypes,
|
||||
config)
|
||||
|
||||
bindingDeclareHeaders.update(dict.fromkeys(unionHeaders, True))
|
||||
bindingHeaders.update(dict.fromkeys(unionImplheaders, True))
|
||||
bindingDeclareHeaders.update(dict.fromkeys(unionConversionHeaders, True))
|
||||
|
||||
bindingDeclareHeaders["UnionMember.h"] = len(unionStructs) > 0
|
||||
bindingDeclareHeaders["BindingUtils.h"] = len(unionStructs) > 0
|
||||
|
||||
def descriptorHasCrossOriginProperties(desc):
|
||||
def hasCrossOriginProperty(m):
|
||||
props = memberProperties(m, desc)
|
||||
@ -12264,55 +12280,15 @@ class CGBindingRoot(CGThing):
|
||||
bindingHeaders["mozilla/dom/ScriptSettings.h"] = dictionaries # AutoJSAPI
|
||||
bindingHeaders["xpcpublic.h"] = dictionaries ## xpc::UnprivilegedJunkScope
|
||||
|
||||
cgthings.extend(traverseMethods)
|
||||
cgthings.extend(unlinkMethods)
|
||||
|
||||
# Do codegen for all the dictionaries. We have to be a bit careful
|
||||
# here, because we have to generate these in order from least derived
|
||||
# to most derived so that class inheritance works out. We also have to
|
||||
# generate members before the dictionary that contains them.
|
||||
|
||||
def getDependenciesFromType(type):
|
||||
if type.isDictionary():
|
||||
return set([type.unroll().inner])
|
||||
if type.isSequence() or type.isArray():
|
||||
return getDependenciesFromType(type.unroll())
|
||||
if type.isUnion():
|
||||
return set([type.unroll()])
|
||||
return set()
|
||||
|
||||
def getDependencies(unionTypeOrDictionary):
|
||||
if isinstance(unionTypeOrDictionary, IDLDictionary):
|
||||
deps = set()
|
||||
if unionTypeOrDictionary.parent:
|
||||
deps.add(unionTypeOrDictionary.parent)
|
||||
for member in unionTypeOrDictionary.members:
|
||||
deps |= getDependenciesFromType(member.type)
|
||||
return deps
|
||||
|
||||
assert unionTypeOrDictionary.isType() and unionTypeOrDictionary.isUnion()
|
||||
deps = set()
|
||||
for member in unionTypeOrDictionary.flatMemberTypes:
|
||||
deps |= getDependenciesFromType(member)
|
||||
return deps
|
||||
|
||||
def getName(unionTypeOrDictionary):
|
||||
if isinstance(unionTypeOrDictionary, IDLDictionary):
|
||||
return unionTypeOrDictionary.identifier.name
|
||||
|
||||
assert unionTypeOrDictionary.isType() and unionTypeOrDictionary.isUnion()
|
||||
return unionTypeOrDictionary.name
|
||||
|
||||
for t in dependencySortObjects(dictionaries + unionStructs, getDependencies, getName):
|
||||
if t.isDictionary():
|
||||
cgthings.append(CGDictionary(t, config.getDescriptorProvider(False)))
|
||||
else:
|
||||
assert t.isUnion()
|
||||
# FIXME: Unions are broken in workers. See bug 809899.
|
||||
cgthings.append(CGUnionStruct(t, config.getDescriptorProvider(False)))
|
||||
cgthings.append(CGUnionStruct(t, config.getDescriptorProvider(False), True))
|
||||
|
||||
cgthings.append(unionConversions)
|
||||
cgthings.extend([CGDictionary(d, config.getDescriptorProvider(False))
|
||||
for d in
|
||||
dependencySortObjects(dictionaries,
|
||||
CGDictionary.getDictionaryDependencies,
|
||||
lambda d: d.identifier.name)])
|
||||
|
||||
# Do codegen for all the callbacks.
|
||||
cgthings.extend(CGCallbackFunction(c, config.getDescriptorProvider(False))
|
||||
@ -12345,15 +12321,10 @@ class CGBindingRoot(CGThing):
|
||||
curr = CGNamespace.build(['mozilla', 'dom'],
|
||||
CGWrapper(curr, pre="\n"))
|
||||
|
||||
builder = ForwardDeclarationBuilder()
|
||||
for className, isStruct in unionDeclarations:
|
||||
builder.add(className, isStruct=isStruct)
|
||||
|
||||
curr = CGList([CGForwardDeclarations(config, descriptors,
|
||||
mainCallbacks, workerCallbacks,
|
||||
dictionaries,
|
||||
callbackDescriptors + jsImplemented),
|
||||
builder.build(),
|
||||
curr],
|
||||
"\n")
|
||||
|
||||
@ -14433,17 +14404,12 @@ class GlobalGenRoots():
|
||||
|
||||
@staticmethod
|
||||
def UnionTypes(config):
|
||||
unionTypes = UnionsForFile(config, None)
|
||||
(includes, implincludes, declarations,
|
||||
traverseMethods, unlinkMethods,
|
||||
unionStructs) = UnionTypes(unionTypes, config)
|
||||
|
||||
unions = CGList(traverseMethods +
|
||||
unlinkMethods +
|
||||
[CGUnionStruct(t, config.getDescriptorProvider(False)) for t in unionStructs] +
|
||||
[CGUnionStruct(t, config.getDescriptorProvider(False), True) for t in unionStructs],
|
||||
"\n")
|
||||
|
||||
(includes, implincludes,
|
||||
declarations, unions) = UnionTypes(config.getDescriptors(),
|
||||
config.getDictionaries(),
|
||||
config.getCallbacks(),
|
||||
config)
|
||||
includes.add("mozilla/dom/OwningNonNull.h")
|
||||
includes.add("mozilla/dom/UnionMember.h")
|
||||
includes.add("mozilla/dom/BindingDeclarations.h")
|
||||
@ -14456,11 +14422,34 @@ class GlobalGenRoots():
|
||||
|
||||
curr = CGWrapper(curr, post='\n')
|
||||
|
||||
builder = ForwardDeclarationBuilder()
|
||||
for className, isStruct in declarations:
|
||||
builder.add(className, isStruct=isStruct)
|
||||
namespaces = []
|
||||
stack = [CGList([])]
|
||||
for clazz, isStruct in sorted(declarations):
|
||||
elements = clazz.split("::")
|
||||
clazz = CGClassForwardDeclare(elements.pop(), isStruct=isStruct)
|
||||
i = 0
|
||||
if len(elements) > 0:
|
||||
common = min(len(namespaces), len(elements))
|
||||
while i < common and namespaces[i] == elements[i]:
|
||||
i += 1
|
||||
|
||||
curr = CGList([builder.build(), curr], "\n")
|
||||
# pop all the namespaces that should be closed
|
||||
namespaces = namespaces[:i]
|
||||
|
||||
# add all the namespaces that should be opened
|
||||
for j, namespace in enumerate(elements[i:]):
|
||||
namespaces.append(namespace)
|
||||
# every CGNamespace that we add holds a CGList
|
||||
list = CGList([])
|
||||
# add the new namespace to the list on top of the stack
|
||||
stack[i + j].append(CGNamespace(namespace, list))
|
||||
# set the top of the namespace stack to the list of the new
|
||||
# namespace
|
||||
stack[i + j + 1:] = [list]
|
||||
|
||||
stack[len(elements)].append(clazz)
|
||||
|
||||
curr = CGList([stack[0], curr], "\n")
|
||||
|
||||
curr = CGHeaders([], [], [], [], includes, implincludes, 'UnionTypes',
|
||||
curr)
|
||||
@ -14473,8 +14462,10 @@ class GlobalGenRoots():
|
||||
|
||||
@staticmethod
|
||||
def UnionConversions(config):
|
||||
unionTypes = UnionsForFile(config, None)
|
||||
headers, unions = UnionConversions(unionTypes,
|
||||
|
||||
headers, unions = UnionConversions(config.getDescriptors(),
|
||||
config.getDictionaries(),
|
||||
config.getCallbacks(),
|
||||
config)
|
||||
|
||||
# Wrap all of that in our namespaces.
|
||||
@ -14995,7 +14986,7 @@ class CGEventRoot(CGThing):
|
||||
'mozilla/dom/Nullable.h',
|
||||
'nsDOMQS.h'
|
||||
],
|
||||
"", self.root, config)
|
||||
"", self.root)
|
||||
|
||||
# And now some include guards
|
||||
self.root = CGIncludeGuard(interfaceName, self.root)
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
from WebIDL import IDLInterface, IDLExternalInterface, IDLImplementsStatement
|
||||
import os
|
||||
from collections import defaultdict
|
||||
|
||||
autogenerated_comment = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n"
|
||||
|
||||
@ -118,52 +117,6 @@ class Configuration:
|
||||
self.callbacks = [c for c in parseData if
|
||||
c.isCallback() and not c.isInterface()]
|
||||
|
||||
# Dictionary mapping from a union type name to a set of filenames where
|
||||
# union types with that name are used.
|
||||
self.filenamesPerUnion = defaultdict(set)
|
||||
|
||||
# Dictionary mapping from a filename to a list of tuples containing a
|
||||
# type and descriptor for the union types used in that file. If a union
|
||||
# type is used in multiple files then it will be added to the list
|
||||
# for the None key. Note that the list contains a tuple for every use of
|
||||
# a union type, so there can be multiple tuples with union types that
|
||||
# have the same name.
|
||||
self.unionsPerFilename = defaultdict(list)
|
||||
|
||||
for (t, descriptor, _) in getAllTypes(self.descriptors, self.dictionaries, self.callbacks):
|
||||
if t.isMozMap():
|
||||
t = t.inner
|
||||
t = t.unroll()
|
||||
if t.isUnion():
|
||||
filenamesForUnion = self.filenamesPerUnion[t.name]
|
||||
if t.filename() not in filenamesForUnion:
|
||||
if len(filenamesForUnion) == 0:
|
||||
# This is the first file that we found a union with this
|
||||
# name in, record the union as part of the file.
|
||||
uniqueFilenameForUnion = t.filename()
|
||||
else:
|
||||
# We already found a file that contains a union with
|
||||
# this name.
|
||||
if len(filenamesForUnion) == 1:
|
||||
# This is the first time we found a union with this
|
||||
# name in another file.
|
||||
for f in filenamesForUnion:
|
||||
# Filter out unions with this name from the
|
||||
# unions for the file where we previously found
|
||||
# them.
|
||||
unionsForFilename = self.unionsPerFilename[f]
|
||||
unionsForFilename = filter(lambda u: u[0].name != t.name,
|
||||
unionsForFilename)
|
||||
if len(unionsForFilename) == 0:
|
||||
del self.unionsPerFilename[f]
|
||||
else:
|
||||
self.unionsPerFilename[f] = unionsForFilename
|
||||
# Unions with this name appear in multiple files, record
|
||||
# the filename as None, so that we can detect that.
|
||||
uniqueFilenameForUnion = None
|
||||
self.unionsPerFilename[uniqueFilenameForUnion].append((t, descriptor))
|
||||
filenamesForUnion.add(t.filename())
|
||||
|
||||
def flagWorkerOrMainThread(items, main, worker):
|
||||
for item in items:
|
||||
if item in main:
|
||||
@ -759,22 +712,3 @@ def findCallbacksAndDictionaries(inputTypes):
|
||||
retDictionaries = set()
|
||||
doFindCallbacksAndDictionaries(inputTypes, retCallbacks, retDictionaries)
|
||||
return (retCallbacks, retDictionaries)
|
||||
|
||||
def getAllTypes(descriptors, dictionaries, callbacks):
|
||||
"""
|
||||
Generate all the types we're dealing with. For each type, a tuple
|
||||
containing type, descriptor, dictionary is yielded. The
|
||||
descriptor and dictionary can be None if the type does not come
|
||||
from a descriptor or dictionary; they will never both be non-None.
|
||||
"""
|
||||
for d in descriptors:
|
||||
if d.interface.isExternal():
|
||||
continue
|
||||
for t in getTypesFromDescriptor(d):
|
||||
yield (t, d, None)
|
||||
for dictionary in dictionaries:
|
||||
for t in getTypesFromDictionary(dictionary):
|
||||
yield (t, None, dictionary)
|
||||
for callback in callbacks:
|
||||
for t in getTypesFromCallback(callback):
|
||||
yield (t, None, None)
|
||||
|
@ -2058,10 +2058,6 @@ class IDLUnionType(IDLType):
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, IDLUnionType) and self.memberTypes == other.memberTypes
|
||||
|
||||
def __hash__(self):
|
||||
assert self.isComplete()
|
||||
return self.name.__hash__()
|
||||
|
||||
def isVoid(self):
|
||||
return False
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/Date.h"
|
||||
#include "mozilla/dom/MozMap.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -98,6 +98,7 @@
|
||||
#include "mozilla/dom/HTMLVideoElement.h"
|
||||
#include "mozilla/dom/SVGMatrix.h"
|
||||
#include "mozilla/dom/TextMetrics.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/SVGMatrix.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mozilla/JSEventHandler.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/MessagePortBinding.h"
|
||||
#include "mozilla/dom/MessagePortList.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "jsapi.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsStringStream.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/FetchBinding.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -6,16 +6,13 @@
|
||||
#ifndef mozilla_dom_Fetch_h
|
||||
#define mozilla_dom_Fetch_h
|
||||
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
class nsCString;
|
||||
class nsIInputStream;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class OwningArrayBufferOrArrayBufferViewOrScalarValueStringOrURLSearchParams;
|
||||
|
||||
/*
|
||||
* Creates an nsIInputStream based on the fetch specifications 'extract a byte
|
||||
* stream algorithm' - http://fetch.spec.whatwg.org/#concept-bodyinit-extract.
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/dom/DirectoryBinding.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
// Resolve the name collision of Microsoft's API name with macros defined in
|
||||
// Windows header files. Undefine the macro of CreateDirectory to avoid
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "mozilla/dom/ErrorEventBinding.h"
|
||||
#include "mozilla/dom/IDBOpenDBRequestBinding.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "DOMMobileMessageError.h"
|
||||
#include "mozilla/dom/DOMMobileMessageErrorBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsIDOMMozMmsMessage.h"
|
||||
#include "nsIDOMMozSmsMessage.h"
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_dom_mobilemessage_MobileMessageManager_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
@ -22,7 +23,6 @@ class DOMCursor;
|
||||
struct MmsParameters;
|
||||
struct MmsSendParameters;
|
||||
struct MobileMessageFilter;
|
||||
class OwningLongOrMozSmsMessageOrMozMmsMessage;
|
||||
struct SmsSendParameters;
|
||||
|
||||
class MobileMessageManager MOZ_FINAL : public DOMEventTargetHelper
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/TelephonyBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user