Fix for bug 560462 (Use fast unwrapping for more quickstubs) - add support for non-templated custom quickstubs for an interface. r=jst.

This commit is contained in:
Peter Van der Beken 2010-05-06 14:16:32 +02:00
Родитель b3668213b6
Коммит 86ecf361a5
2 изменённых файлов: 32 добавлений и 15 удалений

Просмотреть файл

@ -680,9 +680,9 @@ def writeResultConv(f, type, jsvalPtr, jsvalRef):
% jsvalPtr)
return
else:
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, result, "
"xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), "
"&interfaces[k_%s], %s);\n"
f.write(" return xpc_qsXPCOMObjectToJsval(lccx, "
"ToSupports(result), xpc_qsGetWrapperCache(result), "
"&NS_GET_IID(%s), &interfaces[k_%s], %s);\n"
% (type.name, type.name, jsvalPtr))
return
@ -742,6 +742,16 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
if customMethodCall is None:
customMethodCall = customMethodCalls.get(member.iface.name + '_', None)
if customMethodCall is not None:
if isMethod:
code = customMethodCall.get('code', None)
elif isGetter:
code = customMethodCall.get('getter_code', None)
else:
code = customMethodCall.get('setter_code', None)
else:
code = None
if code is not None:
templateName = member.iface.name
if isGetter:
templateName += '_Get'
@ -775,15 +785,9 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
return
customMethodCall[templateGenerated] = True
if isMethod:
code = customMethodCall['code']
elif isGetter:
code = customMethodCall['getter_code']
else:
code = customMethodCall['setter_code']
stubName = templateName
else:
code = None
callTemplate = ""
else:
callTemplate = ""
code = customMethodCall.get('code', None)
@ -903,7 +907,8 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
if debugGetter:
f.write("#ifdef DEBUG\n")
f.write(" nsresult debug_rv;\n")
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
f.write(" nsCOMPtr<%s> debug_self;\n"
" CallQueryInterface(self, getter_AddRefs(debug_self));\n"
% member.iface.name);
prefix = 'debug_'
else:
@ -1196,10 +1201,10 @@ def writeTraceableResultConv(f, type):
f.write(" JSBool ok = xpc_qsVariantToJsval(lccx, result, "
"&vp.array[0]);\n")
else:
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, result, "
"xpc_qsGetWrapperCache(result), &NS_GET_IID(%s), "
"&interfaces[k_%s], &vp.array[0]);"
"\n" % (type.name, type.name))
f.write(" JSBool ok = xpc_qsXPCOMObjectToJsval(lccx, "
"ToSupports(result), xpc_qsGetWrapperCache(result), "
"&NS_GET_IID(%s), &interfaces[k_%s], &vp.array[0]);\n"
% (type.name, type.name))
f.write(" if (!ok) {\n");
writeFailure(f, getTraceInfoDefaultReturn(type), 2)
f.write(" return vp.array[0];\n")
@ -1221,6 +1226,12 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
customMethodCall = customMethodCalls.get(stubName, None)
if customMethodCall is None:
customMethodCall = customMethodCalls.get(member.iface.name + '_', None)
if customMethodCall is not None:
# We don't support traceable templated quickstubs yet
assert not 'code' in customMethodCall
if customMethodCall is not None and customMethodCall.get('skipgen', False):
return

Просмотреть файл

@ -560,6 +560,12 @@ xpc_qsVariantToJsval(XPCLazyCallContext &ccx,
nsIVariant *p,
jsval *rval);
inline nsISupports*
ToSupports(nsISupports *p)
{
return p;
}
#ifdef DEBUG
void
xpc_qsAssertContextOK(JSContext *cx);