зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 756231 (Remove NativeToSupports, replace with reinterpret_cast). r=bz.
--HG-- extra : rebase_source : b7a2e204b9db7457312af6179aa516f4849c7f92
This commit is contained in:
Родитель
17560044ee
Коммит
4f600a235e
|
@ -509,7 +509,7 @@ class CGClassFinalizeHook(CGAbstractClassHook):
|
||||||
release = """
|
release = """
|
||||||
XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
|
XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
|
||||||
if (rt) {
|
if (rt) {
|
||||||
rt->DeferredRelease(NativeToSupports(self));
|
rt->DeferredRelease(reinterpret_cast<nsISupports*>(self));
|
||||||
} else {
|
} else {
|
||||||
NS_RELEASE(self);
|
NS_RELEASE(self);
|
||||||
}"""
|
}"""
|
||||||
|
@ -1014,24 +1014,6 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||||
*aEnabled = true;
|
*aEnabled = true;
|
||||||
return !!%s(aCx, global, aReceiver);""" % (getter))
|
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):
|
class CGWrapMethod(CGAbstractMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
# XXX can we wrap if we don't have an interface prototype object?
|
# 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
|
# Always have a finalize hook, regardless of whether the class wants a
|
||||||
# custom hook.
|
# custom hook.
|
||||||
if descriptor.nativeIsISupports:
|
|
||||||
cgThings.append(CGNativeToSupportsMethod(descriptor))
|
|
||||||
cgThings.append(CGClassFinalizeHook(descriptor))
|
cgThings.append(CGClassFinalizeHook(descriptor))
|
||||||
|
|
||||||
# Only generate a trace hook if the class wants a custom hook.
|
# Only generate a trace hook if the class wants a custom hook.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче