mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 983228. Add a sequence tracer for sequences of unions. r=baku
This commit is contained in:
parent
76e9977396
commit
ec87989351
@ -47,6 +47,12 @@ protected:
|
||||
struct AllTypedArraysBase {
|
||||
};
|
||||
|
||||
// Struct that serves as a base class for all owning unions.
|
||||
// Particularly useful so we can use IsBaseOf to detect owning union
|
||||
// template arguments.
|
||||
struct AllOwningUnionBase {
|
||||
};
|
||||
|
||||
|
||||
struct EnumEntry {
|
||||
const char* value;
|
||||
|
@ -1657,7 +1657,8 @@ public:
|
||||
// sequence types.
|
||||
template<typename T,
|
||||
bool isDictionary=IsBaseOf<DictionaryBase, T>::value,
|
||||
bool isTypedArray=IsBaseOf<AllTypedArraysBase, T>::value>
|
||||
bool isTypedArray=IsBaseOf<AllTypedArraysBase, T>::value,
|
||||
bool isOwningUnion=IsBaseOf<AllOwningUnionBase, T>::value>
|
||||
class SequenceTracer
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
@ -1665,7 +1666,7 @@ class SequenceTracer
|
||||
|
||||
// sequence<object> or sequence<object?>
|
||||
template<>
|
||||
class SequenceTracer<JSObject*, false, false>
|
||||
class SequenceTracer<JSObject*, false, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1679,7 +1680,7 @@ public:
|
||||
|
||||
// sequence<any>
|
||||
template<>
|
||||
class SequenceTracer<JS::Value, false, false>
|
||||
class SequenceTracer<JS::Value, false, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1693,7 +1694,7 @@ public:
|
||||
|
||||
// sequence<sequence<T>>
|
||||
template<typename T>
|
||||
class SequenceTracer<Sequence<T>, false, false>
|
||||
class SequenceTracer<Sequence<T>, false, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1707,7 +1708,7 @@ public:
|
||||
|
||||
// sequence<sequence<T>> as return value
|
||||
template<typename T>
|
||||
class SequenceTracer<nsTArray<T>, false, false>
|
||||
class SequenceTracer<nsTArray<T>, false, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1721,7 +1722,7 @@ public:
|
||||
|
||||
// sequence<someDictionary>
|
||||
template<typename T>
|
||||
class SequenceTracer<T, true, false>
|
||||
class SequenceTracer<T, true, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1735,7 +1736,7 @@ public:
|
||||
|
||||
// sequence<SomeTypedArray>
|
||||
template<typename T>
|
||||
class SequenceTracer<T, false, true>
|
||||
class SequenceTracer<T, false, true, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
@ -1747,9 +1748,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// sequence<SomeOwningUnion>
|
||||
template<typename T>
|
||||
class SequenceTracer<T, false, false, true>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
public:
|
||||
static void TraceSequence(JSTracer* trc, T* arrayp, T* end) {
|
||||
for (; arrayp != end; ++arrayp) {
|
||||
arrayp->TraceUnion(trc);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// sequence<T?> with T? being a Nullable<T>
|
||||
template<typename T>
|
||||
class SequenceTracer<Nullable<T>, false, false>
|
||||
class SequenceTracer<Nullable<T>, false, false, false>
|
||||
{
|
||||
explicit SequenceTracer() MOZ_DELETE; // Should never be instantiated
|
||||
|
||||
|
@ -7201,7 +7201,9 @@ class CGUnionStruct(CGThing):
|
||||
disallowCopyConstruction = True
|
||||
|
||||
friend=" friend class %sArgument;\n" % str(self.type) if not self.ownsMembers else ""
|
||||
bases = [ClassBase("AllOwningUnionBase")] if self.ownsMembers else []
|
||||
return CGClass(selfName,
|
||||
bases=bases,
|
||||
members=members,
|
||||
constructors=constructors,
|
||||
methods=methods,
|
||||
|
@ -567,6 +567,7 @@ public:
|
||||
void PassNullableUnionWithDefaultValue12(const Nullable<UnrestrictedFloatOrString>& arg);
|
||||
|
||||
void PassSequenceOfUnions(const Sequence<OwningCanvasPatternOrCanvasGradient>&);
|
||||
void PassSequenceOfUnions2(JSContext*, const Sequence<OwningObjectOrLong>&);
|
||||
void PassVariadicUnion(const Sequence<OwningCanvasPatternOrCanvasGradient>&);
|
||||
|
||||
void PassSequenceOfNullableUnions(const Sequence<Nullable<OwningCanvasPatternOrCanvasGradient>>&);
|
||||
|
@ -522,6 +522,7 @@ interface TestInterface {
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg);
|
||||
void passSequenceOfUnions2(sequence<(object or long)> arg);
|
||||
void passVariadicUnion((CanvasPattern or CanvasGradient)... arg);
|
||||
|
||||
void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
|
||||
|
@ -415,6 +415,7 @@ interface TestExampleInterface {
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg);
|
||||
void passSequenceOfUnions2(sequence<(object or long)> arg);
|
||||
void passVariadicUnion((CanvasPattern or CanvasGradient)... arg);
|
||||
|
||||
void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
|
||||
|
@ -436,6 +436,7 @@ interface TestJSImplInterface {
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg);
|
||||
void passSequenceOfUnions2(sequence<(object or long)> arg);
|
||||
void passVariadicUnion((CanvasPattern or CanvasGradient)... arg);
|
||||
|
||||
void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg);
|
||||
|
Loading…
Reference in New Issue
Block a user