| Index: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
|
| diff --git a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
|
| index 46ace8a1985d35dcabcefe6e80535fc8e1567d75..b828ec2c08219580246b8e571bb70e8b978e2cf3 100644
|
| --- a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
|
| +++ b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
|
| @@ -130,7 +130,7 @@ Extended attributes on members of an implemented interface work as normal. Howev
|
|
|
| ### Inheritance
|
|
|
| -Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attributes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, and currently consists of `[DependentLifetime]`; the up-to-date list is [compute_dependencies.INHERITED_EXTENDED_ATTRIBUTES](https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/scripts/compute_dependencies.py&q=INHERITED_EXTENDED_ATTRIBUTES).
|
| +Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attributes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, and currently consists of `[DependentLifetime]` and `[ActiveScriptWrappable]`; the up-to-date list is [compute_dependencies.INHERITED_EXTENDED_ATTRIBUTES](https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/scripts/compute_dependencies.py&q=INHERITED_EXTENDED_ATTRIBUTES).
|
|
|
| ## Standard Web IDL Extended Attributes
|
|
|
| @@ -478,6 +478,40 @@ Usage: Can be specified on attributes or interfaces.
|
|
|
| These extended attributes are widely used.
|
|
|
| +### [ActiveScriptWrappable] _(i)_
|
| +
|
| +Summary: `[ActiveScriptWrappable]` indicates that a given DOM object should be kept alive as long as the DOM object has pending activities.
|
| +
|
| +Usage: `[ActiveScriptWrappable]` can be specified on interfaces, and **is inherited**:
|
| +
|
| +```webidl
|
| +[
|
| + ActiveScriptWrappable,
|
| +] interface Foo {
|
| + ...
|
| +};
|
| +```
|
| +
|
| +If an interface X has `[ActiveScriptWrappable]` and an interface Y inherits the interface X, then the interface Y will also have `[ActiveScriptWrappable]`. For example
|
| +
|
| +```webidl
|
| +[
|
| + ActiveScriptWrappable,
|
| +] interface Foo {};
|
| +```
|
| +
|
| +interface Bar : Foo {}; // inherits [ActiveScriptWrappable] from Foo
|
| +If a given DOM object needs to be kept alive as long as the DOM object has pending activities, you need to specify `[ActiveScriptWrappable]` and `[DependentLifetime]`. For example, `[ActiveScriptWrappable]` can be used when the DOM object is expecting events to be raised in the future.
|
| +
|
| +If you use `[ActiveScriptWrappable]`, the corresponding Blink class needs to inherit ActiveScriptWrappable. For example, in case of XMLHttpRequest, core/xml/XMLHttpRequest.h would look like this:
|
| +
|
| +```c++
|
| +class XMLHttpRequest : public ActiveScriptWrappable
|
| +{
|
| + ...;
|
| +}
|
| +```
|
| +
|
| ### [PerWorldBindings] _(m, a)_
|
|
|
| Summary: Generates faster bindings code by avoiding check for isMainWorld().
|
| @@ -868,7 +902,7 @@ interface Bar : Foo { ... }; // inherits [DependentLifetime]
|
| If a DOM object does not have `[DependentLifetime]`, V8's GC collects the wrapper of the DOM object
|
| if the wrapper is unreachable on the JS side (i.e., V8's GC assumes that the wrapper should not be
|
| reachable in the DOM side). Use `[DependentLifetime]` to relax the assumption.
|
| -For example, if the DOM object implements hasPendingActivity(), it must be annotated with
|
| +For example, if the DOM object has `[ActiveScriptWrappable]` and implements hasPendingActivity(), it must be annotated with
|
| `[DependentLifetime]`. Otherwise, the wrapper will be collected regardless of the returned value
|
| of the hasPendingActivity(). DOM objects that are pointed to by `[SetWrapperReferenceFrom]` and
|
| `[SetWrapperReferenceTo]` must be annotated with `[DependentLifetime]`.
|
|
|