Remove debugging code for setters and methods to avoid weird behaviour from calling the native setters and methods twice.

--HG--
extra : rebase_source : bc087eb4c541411d5adc696b267295d4d172614e
This commit is contained in:
Peter Van der Beken 2009-08-24 08:44:16 -07:00
Родитель 21eeef5922
Коммит 6455108d73
1 изменённых файлов: 45 добавлений и 53 удалений

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

@ -751,40 +751,43 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
if customMethodCall is not None: if customMethodCall is not None:
f.write("%s\n" % customMethodCall['code']) f.write("%s\n" % customMethodCall['code'])
f.write("#ifdef DEBUG\n")
f.write(" nsresult debug_rv;\n")
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
% member.iface.name);
prefix = 'debug_'
else:
prefix = ''
resultname = prefix + 'result' if customMethodCall is None or isGetter:
selfname = prefix + 'self' if customMethodCall is not None:
nsresultname = prefix + 'rv' f.write("#ifdef DEBUG\n")
f.write(" nsresult debug_rv;\n")
# Prepare out-parameter. f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
if isMethod or isGetter: % member.iface.name);
writeResultDecl(f, member.realtype, resultname) prefix = 'debug_'
# Call the method.
if isMethod:
comName = header.methodNativeName(member)
argv = ['arg' + str(i) for i, p in enumerate(member.params)]
if not isVoidType(member.realtype):
argv.append(outParamForm(resultname, member.realtype))
args = ', '.join(argv)
else:
comName = header.attributeNativeName(member, isGetter)
if isGetter:
args = outParamForm(resultname, member.realtype)
else: else:
args = "arg0" prefix = ''
f.write(" %s = %s->%s(%s);\n" % (nsresultname, selfname, comName, args)) resultname = prefix + 'result'
selfname = prefix + 'self'
nsresultname = prefix + 'rv'
if customMethodCall is not None: # Prepare out-parameter.
if isMethod or isGetter: if isMethod or isGetter:
writeResultDecl(f, member.realtype, resultname)
# Call the method.
if isMethod:
comName = header.methodNativeName(member)
argv = ['arg' + str(i) for i, p in enumerate(member.params)]
if not isVoidType(member.realtype):
argv.append(outParamForm(resultname, member.realtype))
args = ', '.join(argv)
else:
comName = header.attributeNativeName(member, isGetter)
if isGetter:
args = outParamForm(resultname, member.realtype)
else:
args = "arg0"
f.write(" %s = %s->%s(%s);\n"
% (nsresultname, selfname, comName, args))
if customMethodCall is not None:
checkSuccess = "NS_SUCCEEDED(debug_rv)" checkSuccess = "NS_SUCCEEDED(debug_rv)"
if canFail: if canFail:
checkSuccess += " == NS_SUCCEEDED(rv)" checkSuccess += " == NS_SUCCEEDED(rv)"
@ -792,7 +795,7 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
"xpc_qsSameResult(debug_result, result),\n" "xpc_qsSameResult(debug_result, result),\n"
" \"Got the wrong answer from the custom " " \"Got the wrong answer from the custom "
"method call!\");\n" % checkSuccess) "method call!\");\n" % checkSuccess)
f.write("#endif\n") f.write("#endif\n")
if canFail: if canFail:
# Check for errors. # Check for errors.
@ -1087,33 +1090,28 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
if customMethodCall is not None: if customMethodCall is not None:
f.write("%s\n" % customMethodCall['code']) f.write("%s\n" % customMethodCall['code'])
f.write("#ifdef DEBUG\n")
f.write(" nsresult debug_rv;\n")
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
% member.iface.name);
prefix = 'debug_'
else: else:
if not rvdeclared: if not rvdeclared:
f.write(" nsresult rv;\n") f.write(" nsresult rv;\n")
rvdeclared = True rvdeclared = True
prefix = '' prefix = ''
resultname = prefix + 'result' resultname = prefix + 'result'
selfname = prefix + 'self' selfname = prefix + 'self'
nsresultname = prefix + 'rv' nsresultname = prefix + 'rv'
# Prepare out-parameter. # Prepare out-parameter.
writeResultDecl(f, member.realtype, resultname) writeResultDecl(f, member.realtype, resultname)
# Call the method. # Call the method.
comName = header.methodNativeName(member) comName = header.methodNativeName(member)
if not isVoidType(member.realtype): if not isVoidType(member.realtype):
argNames.append(outParamForm(resultname, member.realtype)) argNames.append(outParamForm(resultname, member.realtype))
args = ', '.join(argNames) args = ', '.join(argNames)
f.write(" %s = %s->%s(%s);\n" % (nsresultname, selfname, comName, args)) f.write(" %s = %s->%s(%s);\n"
% (nsresultname, selfname, comName, args))
if customMethodCall is None:
# Check for errors. # Check for errors.
f.write(" if (NS_FAILED(rv)) {\n") f.write(" if (NS_FAILED(rv)) {\n")
if haveCcx: if haveCcx:
@ -1123,12 +1121,6 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
f.write(" xpc_qsThrowMethodFailedWithDetails(cx, rv, " f.write(" xpc_qsThrowMethodFailedWithDetails(cx, rv, "
"\"%s\", \"%s\");\n" % (member.iface.name, member.name)) "\"%s\", \"%s\");\n" % (member.iface.name, member.name))
writeFailure(f, getTraceInfoDefaultReturn(member.type), 2) writeFailure(f, getTraceInfoDefaultReturn(member.type), 2)
else:
f.write(" NS_ASSERTION(NS_SUCCEEDED(debug_rv) && "
"xpc_qsSameResult(debug_result, result),\n"
" \"Got the wrong answer from the custom "
"method call!\");\n")
f.write("#endif\n")
# Convert the return value. # Convert the return value.
writeTraceableResultConv(f, member.realtype) writeTraceableResultConv(f, member.realtype)