зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1007878 part 5. Implement callback codegen for MozMap. r=khuey
This commit is contained in:
Родитель
e7ef8d309c
Коммит
c61e88da09
|
@ -3874,19 +3874,25 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
"${declName}.SetNull();\n",
|
||||
notMozMap)
|
||||
|
||||
declType = typeName
|
||||
declArgs = None
|
||||
holderType = None
|
||||
holderArgs = None
|
||||
# MozMap arguments that might contain traceable things need
|
||||
# to get traced
|
||||
if not isMember and typeNeedsRooting(valueType):
|
||||
if not isMember and isCallbackReturnValue:
|
||||
# Go ahead and just convert directly into our actual return value
|
||||
declType = CGWrapper(declType, post="&")
|
||||
declArgs = "aRetVal"
|
||||
elif not isMember and typeNeedsRooting(valueType):
|
||||
holderType = CGTemplatedType("MozMapRooter", valueInfo.declType)
|
||||
# If our MozMap is nullable, this will set the Nullable to be
|
||||
# not-null, but that's ok because we make an explicit SetNull() call
|
||||
# on it as needed if our JS value is actually null.
|
||||
holderArgs = "cx, &%s" % mozMapRef
|
||||
else:
|
||||
holderType = None
|
||||
holderArgs = None
|
||||
|
||||
return JSToNativeConversionInfo(templateBody, declType=typeName,
|
||||
return JSToNativeConversionInfo(templateBody, declType=declType,
|
||||
declArgs=declArgs,
|
||||
holderType=holderType,
|
||||
dealWithOptional=isOptional,
|
||||
holderArgs=holderArgs)
|
||||
|
@ -11534,6 +11540,13 @@ class CGNativeMember(ClassMethod):
|
|||
else:
|
||||
returnCode = "aRetVal.SwapElements(${declName});\n"
|
||||
return "void", "", returnCode
|
||||
if type.isMozMap():
|
||||
# If we want to handle MozMap-of-MozMap return values, we're
|
||||
# going to need to fix example codegen to not produce MozMap<void>
|
||||
# for the relevant argument...
|
||||
assert not isMember
|
||||
# In this case we convert directly into our outparam to start with
|
||||
return "void", "", ""
|
||||
if type.isDate():
|
||||
result = CGGeneric("Date")
|
||||
if type.nullable():
|
||||
|
@ -11628,7 +11641,8 @@ class CGNativeMember(ClassMethod):
|
|||
is a const ref, as well as whether the type should be wrapped in
|
||||
Nullable as needed.
|
||||
|
||||
isMember can be false or one of the strings "Sequence" or "Variadic"
|
||||
isMember can be false or one of the strings "Sequence", "Variadic",
|
||||
"MozMap"
|
||||
"""
|
||||
if type.isArray():
|
||||
raise TypeError("Can't handle array arguments yet")
|
||||
|
@ -11642,6 +11656,15 @@ class CGNativeMember(ClassMethod):
|
|||
decl = CGTemplatedType("Sequence", argType)
|
||||
return decl.define(), True, True
|
||||
|
||||
if type.isMozMap():
|
||||
nullable = type.nullable()
|
||||
if nullable:
|
||||
type = type.inner
|
||||
elementType = type.inner
|
||||
argType = self.getArgType(elementType, False, "MozMap")[0]
|
||||
decl = CGTemplatedType("MozMap", argType)
|
||||
return decl.define(), True, True
|
||||
|
||||
if type.isUnion():
|
||||
# unionTypeDecl will handle nullable types, so return False for
|
||||
# auto-wrapping in Nullable
|
||||
|
|
|
@ -21,6 +21,7 @@ callback interface TestCallbackInterface {
|
|||
long doSomethingElse(DOMString arg, TestInterface otherArg);
|
||||
void doSequenceLongArg(sequence<long> arg);
|
||||
void doSequenceStringArg(sequence<DOMString> arg);
|
||||
void doMozMapLongArg(MozMap<long> arg);
|
||||
sequence<long> getSequenceOfLong();
|
||||
sequence<TestInterface> getSequenceOfInterfaces();
|
||||
sequence<TestInterface>? getNullableSequenceOfInterfaces();
|
||||
|
@ -30,6 +31,7 @@ callback interface TestCallbackInterface {
|
|||
sequence<TestCallbackInterface>? getNullableSequenceOfCallbackInterfaces();
|
||||
sequence<TestCallbackInterface?> getSequenceOfNullableCallbackInterfaces();
|
||||
sequence<TestCallbackInterface?>? getNullableSequenceOfNullableCallbackInterfaces();
|
||||
MozMap<long> getMozMapOfLong();
|
||||
Dict? getDictionary();
|
||||
};
|
||||
|
||||
|
|
|
@ -255,6 +255,33 @@ interface TestExampleInterface {
|
|||
//XXXbz No support for sequence of sequence return values yet.
|
||||
//sequence<sequence<long>> receiveSequenceOfSequences();
|
||||
|
||||
// MozMap types
|
||||
void passMozMap(MozMap<long> arg);
|
||||
void passNullableMozMap(MozMap<long>? arg);
|
||||
void passMozMapOfNullableInts(MozMap<long?> arg);
|
||||
void passOptionalMozMapOfNullableInts(optional MozMap<long?> arg);
|
||||
void passOptionalNullableMozMapOfNullableInts(optional MozMap<long?>? arg);
|
||||
void passCastableObjectMozMap(MozMap<TestInterface> arg);
|
||||
void passNullableCastableObjectMozMap(MozMap<TestInterface?> arg);
|
||||
void passCastableObjectNullableMozMap(MozMap<TestInterface>? arg);
|
||||
void passNullableCastableObjectNullableMozMap(MozMap<TestInterface?>? arg);
|
||||
void passOptionalMozMap(optional MozMap<long> arg);
|
||||
void passOptionalNullableMozMap(optional MozMap<long>? arg);
|
||||
void passOptionalNullableMozMapWithDefaultValue(optional MozMap<long>? arg = null);
|
||||
void passOptionalObjectMozMap(optional MozMap<TestInterface> arg);
|
||||
void passExternalInterfaceMozMap(MozMap<TestExternalInterface> arg);
|
||||
void passNullableExternalInterfaceMozMap(MozMap<TestExternalInterface?> arg);
|
||||
void passStringMozMap(MozMap<DOMString> arg);
|
||||
void passByteStringMozMap(MozMap<ByteString> arg);
|
||||
void passMozMapOfMozMaps(MozMap<MozMap<long>> arg);
|
||||
MozMap<long> receiveMozMap();
|
||||
MozMap<long>? receiveNullableMozMap();
|
||||
MozMap<long?> receiveMozMapOfNullableInts();
|
||||
MozMap<long?>? receiveNullableMozMapOfNullableInts();
|
||||
//XXXbz No support for MozMap of MozMaps return values yet.
|
||||
//MozMap<MozMap<long>> receiveMozMapOfMozMaps();
|
||||
MozMap<any> receiveAnyMozMap();
|
||||
|
||||
// Typed array types
|
||||
void passArrayBuffer(ArrayBuffer arg);
|
||||
void passNullableArrayBuffer(ArrayBuffer? arg);
|
||||
|
@ -273,6 +300,8 @@ interface TestExampleInterface {
|
|||
void passFloat64Array(Float64Array arg);
|
||||
void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
|
||||
void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
|
||||
void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
|
||||
void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> arg);
|
||||
void passVariadicTypedArray(Float32Array... arg);
|
||||
void passVariadicNullableTypedArray(Float32Array?... arg);
|
||||
Uint8Array receiveUint8Array();
|
||||
|
@ -332,6 +361,17 @@ interface TestExampleInterface {
|
|||
void passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
|
||||
void passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
|
||||
void passMozMapOfAny(MozMap<any> arg);
|
||||
void passNullableMozMapOfAny(MozMap<any>? arg);
|
||||
void passOptionalMozMapOfAny(optional MozMap<any> arg);
|
||||
void passOptionalNullableMozMapOfAny(optional MozMap<any>? arg);
|
||||
void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap<any>? arg = null);
|
||||
void passMozMapOfMozMapOfAny(MozMap<MozMap<any>> arg);
|
||||
void passMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?> arg);
|
||||
void passNullableMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?>? arg);
|
||||
void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap<MozMap<any>?>? arg);
|
||||
void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap<sequence<any>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence<MozMap<any>?>? arg);
|
||||
any receiveAny();
|
||||
|
||||
// object types
|
||||
|
@ -347,6 +387,7 @@ interface TestExampleInterface {
|
|||
void passNullableSequenceOfObject(sequence<object>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
|
||||
void passMozMapOfObject(MozMap<object> arg);
|
||||
object receiveObject();
|
||||
object? receiveNullableObject();
|
||||
|
||||
|
@ -420,6 +461,9 @@ interface TestExampleInterface {
|
|||
|
||||
void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
|
||||
void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg);
|
||||
void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg);
|
||||
// XXXbz no move constructor on some unions
|
||||
// void passMozMapOfUnions2(MozMap<(object or long)> arg);
|
||||
|
||||
//(CanvasPattern or CanvasGradient) receiveUnion();
|
||||
//(object or long) receiveUnion2();
|
||||
|
@ -439,6 +483,7 @@ interface TestExampleInterface {
|
|||
void passOptionalNullableDateWithDefaultValue(optional Date? arg = null);
|
||||
void passDateSequence(sequence<Date> arg);
|
||||
void passNullableDateSequence(sequence<Date?> arg);
|
||||
void passDateMozMap(MozMap<Date> arg);
|
||||
Date receiveDate();
|
||||
Date? receiveNullableDate();
|
||||
|
||||
|
@ -465,6 +510,7 @@ interface TestExampleInterface {
|
|||
Dict? receiveNullableDictionary();
|
||||
void passOtherDictionary(optional GrandparentDict x);
|
||||
void passSequenceOfDictionaries(sequence<Dict> x);
|
||||
void passMozMapOfDictionaries(MozMap<GrandparentDict> x);
|
||||
// No support for nullable dictionaries inside a sequence (nor should there be)
|
||||
// void passSequenceOfNullableDictionaries(sequence<Dict?> x);
|
||||
void passDictionaryOrLong(optional Dict x);
|
||||
|
|
|
@ -271,8 +271,36 @@ interface TestJSImplInterface {
|
|||
sequence<object?> receiveNullableObjectSequence();
|
||||
|
||||
void passSequenceOfSequences(sequence<sequence<long>> arg);
|
||||
//XXXbz No support for sequence of sequence return values yet.
|
||||
//sequence<sequence<long>> receiveSequenceOfSequences();
|
||||
|
||||
// MozMap types
|
||||
void passMozMap(MozMap<long> arg);
|
||||
void passNullableMozMap(MozMap<long>? arg);
|
||||
void passMozMapOfNullableInts(MozMap<long?> arg);
|
||||
void passOptionalMozMapOfNullableInts(optional MozMap<long?> arg);
|
||||
void passOptionalNullableMozMapOfNullableInts(optional MozMap<long?>? arg);
|
||||
void passCastableObjectMozMap(MozMap<TestJSImplInterface> arg);
|
||||
void passNullableCastableObjectMozMap(MozMap<TestJSImplInterface?> arg);
|
||||
void passCastableObjectNullableMozMap(MozMap<TestJSImplInterface>? arg);
|
||||
void passNullableCastableObjectNullableMozMap(MozMap<TestJSImplInterface?>? arg);
|
||||
void passOptionalMozMap(optional MozMap<long> arg);
|
||||
void passOptionalNullableMozMap(optional MozMap<long>? arg);
|
||||
void passOptionalNullableMozMapWithDefaultValue(optional MozMap<long>? arg = null);
|
||||
void passOptionalObjectMozMap(optional MozMap<TestJSImplInterface> arg);
|
||||
void passExternalInterfaceMozMap(MozMap<TestExternalInterface> arg);
|
||||
void passNullableExternalInterfaceMozMap(MozMap<TestExternalInterface?> arg);
|
||||
void passStringMozMap(MozMap<DOMString> arg);
|
||||
void passByteStringMozMap(MozMap<ByteString> arg);
|
||||
void passMozMapOfMozMaps(MozMap<MozMap<long>> arg);
|
||||
MozMap<long> receiveMozMap();
|
||||
MozMap<long>? receiveNullableMozMap();
|
||||
MozMap<long?> receiveMozMapOfNullableInts();
|
||||
MozMap<long?>? receiveNullableMozMapOfNullableInts();
|
||||
//XXXbz No support for MozMap of MozMaps return values yet.
|
||||
//MozMap<MozMap<long>> receiveMozMapOfMozMaps();
|
||||
MozMap<any> receiveAnyMozMap();
|
||||
|
||||
// ArrayBuffer is handled differently in callback interfaces and the example generator.
|
||||
// Need to figure out what should be done there. Seems like other typed array stuff is
|
||||
// similarly not working in the JS implemented generator. Probably some other issues
|
||||
|
@ -295,6 +323,8 @@ interface TestJSImplInterface {
|
|||
//void passFloat64Array(Float64Array arg);
|
||||
//void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
|
||||
//void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
|
||||
//void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
|
||||
//void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> arg);
|
||||
//void passVariadicTypedArray(Float32Array... arg);
|
||||
//void passVariadicNullableTypedArray(Float32Array?... arg);
|
||||
//Uint8Array receiveUint8Array();
|
||||
|
@ -355,8 +385,20 @@ interface TestJSImplInterface {
|
|||
void passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
|
||||
void passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
|
||||
void passMozMapOfAny(MozMap<any> arg);
|
||||
void passNullableMozMapOfAny(MozMap<any>? arg);
|
||||
void passOptionalMozMapOfAny(optional MozMap<any> arg);
|
||||
void passOptionalNullableMozMapOfAny(optional MozMap<any>? arg);
|
||||
void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap<any>? arg = null);
|
||||
void passMozMapOfMozMapOfAny(MozMap<MozMap<any>> arg);
|
||||
void passMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?> arg);
|
||||
void passNullableMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?>? arg);
|
||||
void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap<MozMap<any>?>? arg);
|
||||
void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap<sequence<any>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence<MozMap<any>?>? arg);
|
||||
any receiveAny();
|
||||
|
||||
// object types
|
||||
void passObject(object arg);
|
||||
void passVariadicObject(object... arg);
|
||||
void passNullableObject(object? arg);
|
||||
|
@ -369,6 +411,7 @@ interface TestJSImplInterface {
|
|||
void passNullableSequenceOfObject(sequence<object>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
|
||||
void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
|
||||
void passMozMapOfObject(MozMap<object> arg);
|
||||
object receiveObject();
|
||||
object? receiveNullableObject();
|
||||
|
||||
|
@ -442,6 +485,9 @@ interface TestJSImplInterface {
|
|||
|
||||
void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
|
||||
void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg);
|
||||
void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg);
|
||||
// XXXbz no move constructor on some unions
|
||||
// void passMozMapOfUnions2(MozMap<(object or long)> arg);
|
||||
|
||||
//(CanvasPattern or CanvasGradient) receiveUnion();
|
||||
//(object or long) receiveUnion2();
|
||||
|
@ -461,6 +507,7 @@ interface TestJSImplInterface {
|
|||
void passOptionalNullableDateWithDefaultValue(optional Date? arg = null);
|
||||
void passDateSequence(sequence<Date> arg);
|
||||
void passNullableDateSequence(sequence<Date?> arg);
|
||||
void passDateMozMap(MozMap<Date> arg);
|
||||
Date receiveDate();
|
||||
Date? receiveNullableDate();
|
||||
|
||||
|
@ -487,6 +534,7 @@ interface TestJSImplInterface {
|
|||
Dict? receiveNullableDictionary();
|
||||
void passOtherDictionary(optional GrandparentDict x);
|
||||
void passSequenceOfDictionaries(sequence<Dict> x);
|
||||
void passMozMapOfDictionaries(MozMap<GrandparentDict> x);
|
||||
// No support for nullable dictionaries inside a sequence (nor should there be)
|
||||
// void passSequenceOfNullableDictionaries(sequence<Dict?> x);
|
||||
void passDictionaryOrLong(optional Dict x);
|
||||
|
|
Загрузка…
Ссылка в новой задаче