| Version 2 (modified by , 17 years ago) ( diff ) |
|---|
WebCore contains a set of ​IDL files which define the public interface that WebCore classes expose to Javascript and ObjectiveC. These IDL files are parsed and code is automatically generated which maintains a "binding" between an external interface (e.g. a Javascript object) and the internal WebCore implementations.
The format of these files are fairly well documented and (mostly) adhere to the syntax described in the ​w3c specification, but there are several differences which are noted below.
The interface declaration takes an optional set of attributes:
- Conditional=CONDITIONALNAME
- Wraps the generated binding code in "#if ENABLE(CONDITIONALNAME)". Typically used to allow turning off features on certain platforms (or to disable new features while they are under development).
- CustomMarkFunction
- Adds a "virtual void mark()" declaration to the generated header file for the binding class. This allows a custom binding implementation to provide their own mark() function in WebCore/bindings/js/JSClassNameCustom.cpp for doing custom handling of garbage collection.
- CustomToJS
- Does not generate a toJS() function for the binding class. This allows implementors to provide their own toJS() function to create the correct wrapper class for a given implementation class. This is useful whenever you have a class hierarchy in the implementing classes - when given an instance of the base class, the custom toJS() implementation should return a wrapper appropriate to the derived class, not the base class.
- DelegatingGetOwnPropertySlot
- Used when a given instance wants to customize the lookup of properties. Examples are the HTML History object, which needs to enforce restrictions on which attributes are visible cross-domain, or WorkerContext, which wants to delegate lookup to the global object before looking up properties in its own prototype.
- ExtendsDOMGlobalObject
- Does not expose the object prototype externally. Also uses a self-reference internally whenever it needs to access the JSDOMGlobalObject.
- GenerateConstructor
- Generates code to enable the class to be externally instantiated.
- GenerateNativeConverter
- Generates a helper function of the form ClassName* impl() { return static_cast<ClassName>(m_impl); }. Useful when working with a class hierarchy in the binding code, where the base m_impl member is defined to be the base type, not the appropriate derived type.
- LegacyParent=ParentClass
- Allows setting the base class for the generated binding. Otherwise, the base class would be set to DOMObject or the explicitly specified parent class in the interface definition.
- NoStaticTables
- Sharing a single static prototype table only works when a class is guaranteed to be accessed from a single heap, because the lookup code expects the key (attribute name) to have the same address across all instances of the object. For interfaces that are exposed to Workers, a single static table won't work because a given string used to look up a property on the object will lie at a different address in each heap.
Note:
See TracWiki
for help on using the wiki.