From 4f600a235e6618ea98dc8a2630f9db2cc4437007 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Thu, 26 Apr 2012 23:44:28 +0200 Subject: [PATCH] Fix for bug 756231 (Remove NativeToSupports, replace with reinterpret_cast). r=bz. --HG-- extra : rebase_source : b7a2e204b9db7457312af6179aa516f4849c7f92 --- dom/bindings/Codegen.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 71b258f94b2d..8ad407b99c3a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -509,7 +509,7 @@ class CGClassFinalizeHook(CGAbstractClassHook): release = """ XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance(); if (rt) { - rt->DeferredRelease(NativeToSupports(self)); + rt->DeferredRelease(reinterpret_cast(self)); } else { NS_RELEASE(self); }""" @@ -1014,24 +1014,6 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod): *aEnabled = true; return !!%s(aCx, global, aReceiver);""" % (getter)) -class CGNativeToSupportsMethod(CGAbstractStaticMethod): - """ - A method to cast our native to an nsISupports. We do it by casting up the - interface chain in hopes of getting to something that singly-inherits from - nsISupports. - """ - def __init__(self, descriptor): - args = [Argument(descriptor.nativeType + '*', 'aNative')] - CGAbstractStaticMethod.__init__(self, descriptor, 'NativeToSupports', 'nsISupports*', args) - - def definition_body(self): - cur = CGGeneric("aNative") - for proto in reversed(self.descriptor.prototypeChain[:-1]): - d = self.descriptor.getDescriptor(proto) - cast = "static_cast<%s*>(\n" % d.nativeType; - cur = CGWrapper(CGIndenter(cur), pre=cast, post=")") - return CGIndenter(CGWrapper(cur, pre="return ", post=";")).define(); - class CGWrapMethod(CGAbstractMethod): def __init__(self, descriptor): # XXX can we wrap if we don't have an interface prototype object? @@ -2944,8 +2926,6 @@ class CGDescriptor(CGThing): # Always have a finalize hook, regardless of whether the class wants a # custom hook. - if descriptor.nativeIsISupports: - cgThings.append(CGNativeToSupportsMethod(descriptor)) cgThings.append(CGClassFinalizeHook(descriptor)) # Only generate a trace hook if the class wants a custom hook.