зеркало из https://github.com/mozilla/gecko-dev.git
Bug 908576 part 2. Move DOMClass/DOMJSClass declarations out of binding headers. r=smaug
This commit is contained in:
Родитель
631e0772b7
Коммит
ec79efc344
|
@ -166,7 +166,7 @@ class CGDOMJSClass(CGThing):
|
|||
# Our current reserved slot situation is unsafe for globals. Fix bug 760095!
|
||||
assert "Window" not in descriptor.interface.identifier.name
|
||||
def declare(self):
|
||||
return "extern DOMJSClass Class;\n"
|
||||
return ""
|
||||
def define(self):
|
||||
traceHook = TRACE_HOOK_NAME if self.descriptor.customTrace else 'nullptr'
|
||||
callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
|
||||
|
@ -179,7 +179,7 @@ class CGDOMJSClass(CGThing):
|
|||
newResolveHook = "JS_ResolveStub"
|
||||
enumerateHook = "JS_EnumerateStub"
|
||||
return """
|
||||
DOMJSClass Class = {
|
||||
static DOMJSClass Class = {
|
||||
{ "%s",
|
||||
%s,
|
||||
%s, /* addProperty */
|
||||
|
@ -962,6 +962,14 @@ class CGAbstractClassHook(CGAbstractStaticMethod):
|
|||
# Override me
|
||||
assert(False)
|
||||
|
||||
class CGGetJSClassMethod(CGAbstractMethod):
|
||||
def __init__(self, descriptor):
|
||||
CGAbstractMethod.__init__(self, descriptor, 'GetJSClass', 'JSClass*',
|
||||
[])
|
||||
|
||||
def definition_body(self):
|
||||
return " return Class.ToJSClass();"
|
||||
|
||||
class CGAddPropertyHook(CGAbstractClassHook):
|
||||
"""
|
||||
A hook for addProperty, used to preserve our wrapper from GC.
|
||||
|
@ -7114,10 +7122,10 @@ class CGDOMJSProxyHandlerDOMClass(CGThing):
|
|||
CGThing.__init__(self)
|
||||
self.descriptor = descriptor
|
||||
def declare(self):
|
||||
return "extern const DOMClass Class;\n"
|
||||
return ""
|
||||
def define(self):
|
||||
return """
|
||||
const DOMClass Class = """ + DOMClass(self.descriptor) + """;
|
||||
static const DOMClass Class = """ + DOMClass(self.descriptor) + """;
|
||||
|
||||
"""
|
||||
|
||||
|
@ -7839,12 +7847,6 @@ class CGDescriptor(CGThing):
|
|||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
cgThings.append(CGPrototypeJSClass(descriptor, properties))
|
||||
|
||||
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
|
||||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
cgThings.append(CGGetProtoObjectMethod(descriptor))
|
||||
if descriptor.interface.hasInterfaceObject():
|
||||
cgThings.append(CGGetConstructorObjectMethod(descriptor))
|
||||
|
||||
if descriptor.interface.hasInterfaceObject():
|
||||
cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
|
||||
|
||||
|
@ -7887,6 +7889,7 @@ class CGDescriptor(CGThing):
|
|||
cgThings.append(CGDOMJSProxyHandler(descriptor))
|
||||
else:
|
||||
cgThings.append(CGDOMJSClass(descriptor))
|
||||
cgThings.append(CGGetJSClassMethod(descriptor))
|
||||
|
||||
if descriptor.wrapperCache:
|
||||
cgThings.append(CGWrapWithCacheMethod(descriptor, properties))
|
||||
|
@ -7895,6 +7898,17 @@ class CGDescriptor(CGThing):
|
|||
cgThings.append(CGWrapNonWrapperCacheMethod(descriptor,
|
||||
properties))
|
||||
|
||||
# CGCreateInterfaceObjectsMethod needs to come after our
|
||||
# CGDOMJSClass, if any.
|
||||
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
|
||||
|
||||
# CGGetProtoObjectMethod and CGGetConstructorObjectMethod need
|
||||
# to come after CGCreateInterfaceObjectsMethod.
|
||||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
cgThings.append(CGGetProtoObjectMethod(descriptor))
|
||||
if descriptor.interface.hasInterfaceObject():
|
||||
cgThings.append(CGGetConstructorObjectMethod(descriptor))
|
||||
|
||||
cgThings = CGList((CGIndenter(t, declareOnly=True) for t in cgThings), "\n")
|
||||
cgThings = CGWrapper(cgThings, pre='\n', post='\n')
|
||||
self.cgRoot = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name),
|
||||
|
|
|
@ -36,7 +36,7 @@ struct WrapPrototypeTraits
|
|||
GetJSClass() \
|
||||
{ \
|
||||
using namespace mozilla::dom; \
|
||||
return _class##Binding_workers::Class.ToJSClass(); \
|
||||
return _class##Binding_workers::GetJSClass(); \
|
||||
} \
|
||||
\
|
||||
static inline JSObject* \
|
||||
|
|
Загрузка…
Ссылка в новой задаче