mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 908576 part 6. Expose just a NativePropertyHooks pointer, not the object itself, so we can forward-declare it in bindings headers. r=smaug
This commit is contained in:
parent
3e11459a52
commit
1be13ddcad
@ -80,7 +80,7 @@ class CGNativePropertyHooks(CGThing):
|
||||
def declare(self):
|
||||
if self.descriptor.workers:
|
||||
return ""
|
||||
return "extern const NativePropertyHooks sNativePropertyHooks;\n"
|
||||
return "extern const NativePropertyHooks* sNativePropertyHooks;\n"
|
||||
def define(self):
|
||||
if self.descriptor.workers:
|
||||
return ""
|
||||
@ -112,7 +112,7 @@ class CGNativePropertyHooks(CGThing):
|
||||
else:
|
||||
prototypeID += "_ID_Count"
|
||||
parent = self.descriptor.interface.parent
|
||||
parentHooks = ("&" + toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks"
|
||||
parentHooks = (toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks"
|
||||
if parent else 'nullptr')
|
||||
|
||||
return CGWrapper(CGIndenter(CGList([CGGeneric(resolveOwnProperty),
|
||||
@ -125,11 +125,13 @@ class CGNativePropertyHooks(CGThing):
|
||||
CGGeneric(constructorID),
|
||||
CGGeneric(parentHooks)],
|
||||
",\n")),
|
||||
pre="const NativePropertyHooks sNativePropertyHooks = {\n",
|
||||
post="\n};\n").define()
|
||||
pre="static const NativePropertyHooks sNativePropertyHooksStruct = {\n",
|
||||
post=("\n"
|
||||
"};\n"
|
||||
"const NativePropertyHooks* sNativePropertyHooks = &sNativePropertyHooksStruct;\n")).define()
|
||||
|
||||
def NativePropertyHooks(descriptor):
|
||||
return "&sWorkerNativePropertyHooks" if descriptor.workers else "&sNativePropertyHooks"
|
||||
return "&sWorkerNativePropertyHooks" if descriptor.workers else "sNativePropertyHooks"
|
||||
|
||||
def DOMClass(descriptor):
|
||||
protoList = ['prototypes::id::' + proto for proto in descriptor.prototypeChain]
|
||||
@ -8549,6 +8551,9 @@ class CGForwardDeclarations(CGWrapper):
|
||||
for d in descriptors:
|
||||
builder.add(d.nativeType)
|
||||
|
||||
# We just about always need NativePropertyHooks
|
||||
builder.addInMozillaDom("NativePropertyHooks")
|
||||
|
||||
for callback in mainCallbacks:
|
||||
forwardDeclareForType(callback)
|
||||
for t in getTypesFromCallback(callback):
|
||||
@ -8691,12 +8696,12 @@ class CGBindingRoot(CGThing):
|
||||
callbackDescriptors,
|
||||
['mozilla/dom/BindingDeclarations.h',
|
||||
'mozilla/ErrorResult.h',
|
||||
'mozilla/dom/DOMJSClass.h',
|
||||
'mozilla/dom/DOMJSProxyHandler.h'],
|
||||
['mozilla/dom/BindingUtils.h',
|
||||
'mozilla/dom/Nullable.h',
|
||||
'PrimitiveConversions.h',
|
||||
'WrapperFactory.h',
|
||||
'mozilla/dom/DOMJSClass.h',
|
||||
] + (['WorkerPrivate.h',
|
||||
'nsThreadUtils.h'] if hasWorkerStuff else [])
|
||||
+ (['mozilla/Preferences.h'] if requiresPreferences else [])
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_dom_workers_dombindinginlines_h__
|
||||
|
||||
#include "mozilla/dom/FileReaderSyncBinding.h"
|
||||
#include "mozilla/dom/JSSlots.h"
|
||||
#include "mozilla/dom/XMLHttpRequestBinding.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/dom/WorkerLocationBinding.h"
|
||||
|
@ -151,5 +151,5 @@ customMethodCalls = {
|
||||
newBindingProperties = {
|
||||
# Once the last entry here goes away, we can make the sNativePropertyHooks
|
||||
# of bindings static.
|
||||
'nsIDOMEventTarget': 'mozilla::dom::EventTargetBinding::sNativePropertyHooks.mNativeProperties.regular',
|
||||
'nsIDOMEventTarget': 'mozilla::dom::EventTargetBinding::sNativePropertyHooks->mNativeProperties.regular',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user