Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Side by Side Diff: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Blink IDL Extended Attributes 1 # Blink IDL Extended Attributes
2 2
3 [TOC] 3 [TOC]
4 4
5 ## Introduction 5 ## Introduction
6 6
7 The main interest in extended attributes are their _semantics_: Blink implements many more extended attributes than the Web IDL standard, to specify various beh avior. 7 The main interest in extended attributes are their _semantics_: Blink implements many more extended attributes than the Web IDL standard, to specify various beh avior.
8 8
9 The authoritative list of allowed extended attributes and values is [bindings/ID LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/ src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl ete but not necessarily precise (there may be unused extended attributes or valu es), since validation is run on build, but coverage isn't checked. 9 The authoritative list of allowed extended attributes and values is [bindings/ID LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/ src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl ete but not necessarily precise (there may be unused extended attributes or valu es), since validation is run on build, but coverage isn't checked.
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * `[ImplementedAs]` is only necessary for these legacy files: otherwise the clas s (C++) implementing (IDL) implemented interfaces does not need to be specified, as this is handled in Blink C++. 123 * `[ImplementedAs]` is only necessary for these legacy files: otherwise the clas s (C++) implementing (IDL) implemented interfaces does not need to be specified, as this is handled in Blink C++.
124 124
125 * `[OriginTrialEnabled]` behaves as for partial interfaces. 125 * `[OriginTrialEnabled]` behaves as for partial interfaces.
126 126
127 * `[RuntimeEnabled]` behaves as for partial interfaces. 127 * `[RuntimeEnabled]` behaves as for partial interfaces.
128 128
129 * `[NoInterfaceObject]` is _always_ specified on implemented interfaces. 129 * `[NoInterfaceObject]` is _always_ specified on implemented interfaces.
130 130
131 ### Inheritance 131 ### Inheritance
132 132
133 Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attrib utes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, a nd currently consists of `[DependentLifetime]`; the up-to-date list is [compute_ dependencies.INHERITED_EXTENDED_ATTRIBUTES](https://code.google.com/p/chromium/c odesearch#chromium/src/third_party/WebKit/Source/bindings/scripts/compute_depend encies.py&q=INHERITED_EXTENDED_ATTRIBUTES). 133 Extended attributes are generally not inherited: only extended attributes on the interface itself are consulted. However, there are a handful of extended attrib utes that are inherited (applying them to an ancestor interface applies them to the descendants). These are extended attributes that affect memory management, a nd currently consists of `[DependentLifetime]` and `[RequiresFinalizer]`; the up -to-date list is [compute_dependencies.INHERITED_EXTENDED_ATTRIBUTES](https://co de.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindi ngs/scripts/compute_dependencies.py&q=INHERITED_EXTENDED_ATTRIBUTES).
134 134
135 ## Standard Web IDL Extended Attributes 135 ## Standard Web IDL Extended Attributes
136 136
137 These are defined in the [ECMAScript-specific extended attributes](http://heycam .github.io/webidl/#es-extended-attributes) section of the [Web IDL spec](http:// heycam.github.io/webidl/), and alter the binding behavior. 137 These are defined in the [ECMAScript-specific extended attributes](http://heycam .github.io/webidl/#es-extended-attributes) section of the [Web IDL spec](http:// heycam.github.io/webidl/), and alter the binding behavior.
138 138
139 *** note 139 *** note
140 Unsupported: `[ArrayClass]`, `[ImplicitThis]`, `[LenientThis]`, `[NamedPropertie sObject]`, `[TreatNonCallableAsNull]` 140 Unsupported: `[ArrayClass]`, `[ImplicitThis]`, `[LenientThis]`, `[NamedPropertie sObject]`, `[TreatNonCallableAsNull]`
141 *** 141 ***
142 142
143 ### [Clamp] _(a, p)_ 143 ### [Clamp] _(a, p)_
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 [ 861 [
862 DependentLifetime, 862 DependentLifetime,
863 ] interface Foo { ... }; 863 ] interface Foo { ... };
864 864
865 interface Bar : Foo { ... }; // inherits [DependentLifetime] 865 interface Bar : Foo { ... }; // inherits [DependentLifetime]
866 ``` 866 ```
867 867
868 If a DOM object does not have `[DependentLifetime]`, V8's GC collects the wrappe r of the DOM object 868 If a DOM object does not have `[DependentLifetime]`, V8's GC collects the wrappe r of the DOM object
869 if the wrapper is unreachable on the JS side (i.e., V8's GC assumes that the wra pper should not be 869 if the wrapper is unreachable on the JS side (i.e., V8's GC assumes that the wra pper should not be
870 reachable in the DOM side). Use `[DependentLifetime]` to relax the assumption. 870 reachable in the DOM side). Use `[DependentLifetime]` to relax the assumption.
871 For example, if the DOM object implements hasPendingActivity(), it must be annot ated with 871 For example, if the DOM object has `[RequiresFinalizer]` and implements hasPendi ngActivity(), it must be annotated with
872 `[DependentLifetime]`. Otherwise, the wrapper will be collected regardless of th e returned value 872 `[DependentLifetime]`. Otherwise, the wrapper will be collected regardless of th e returned value
873 of the hasPendingActivity(). DOM objects that are pointed to by `[SetWrapperRefe renceFrom]` and 873 of the hasPendingActivity(). DOM objects that are pointed to by `[SetWrapperRefe renceFrom]` and
874 `[SetWrapperReferenceTo]` must be annotated with `[DependentLifetime]`. 874 `[SetWrapperReferenceTo]` must be annotated with `[DependentLifetime]`.
875 875
876 ### [DeprecateAs] _(m, a, c)_ 876 ### [DeprecateAs] _(m, a, c)_
877 877
878 Summary: Measures usage of a deprecated feature via UseCounter, and notifies dev elopers about deprecation via a console warning. 878 Summary: Measures usage of a deprecated feature via UseCounter, and notifies dev elopers about deprecation via a console warning.
879 879
880 `[DeprecateAs]` can be considered an extended form of `[MeasureAs]`: it both mea sures the feature's usage via the same UseCounter mechanism, and also sends out a warning to the console (optionally with a message) in order to inform develope rs that the code they've written will stop working at some point in the relative ly near future. 880 `[DeprecateAs]` can be considered an extended form of `[MeasureAs]`: it both mea sures the feature's usage via the same UseCounter mechanism, and also sends out a warning to the console (optionally with a message) in order to inform develope rs that the code they've written will stop working at some point in the relative ly near future.
881 881
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 [Reflect=q, ReflectOnly="first"|"second"|"third"|"fourth"] attribute DOMStri ng quarter; 1189 [Reflect=q, ReflectOnly="first"|"second"|"third"|"fourth"] attribute DOMStri ng quarter;
1190 }; 1190 };
1191 ``` 1191 ```
1192 1192
1193 The ReflectOnly attribute limits the range of values that the attribute getter c an return from its reflected attribute. If the content attribute has a value tha t is a case-insensitive match for one of the values given in the `ReflectOnly`'s list (using "`|`" as separator), then it will be returned. To allow attribute v alues that use characters that go beyond what IDL identifiers may contain, strin g literals are used. This is a Blink syntactic extension to extended attributes. 1193 The ReflectOnly attribute limits the range of values that the attribute getter c an return from its reflected attribute. If the content attribute has a value tha t is a case-insensitive match for one of the values given in the `ReflectOnly`'s list (using "`|`" as separator), then it will be returned. To allow attribute v alues that use characters that go beyond what IDL identifiers may contain, strin g literals are used. This is a Blink syntactic extension to extended attributes.
1194 1194
1195 If there is no match, the empty string will be returned. As required by the spec ification, no such checking is performed when the reflected IDL attribute is set . 1195 If there is no match, the empty string will be returned. As required by the spec ification, no such checking is performed when the reflected IDL attribute is set .
1196 1196
1197 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a ttribute says it is _"limited to only known values"_. 1197 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a ttribute says it is _"limited to only known values"_.
1198 1198
1199 ### [RequiresFinalizer] _(i)_
haraken 2016/03/18 08:07:28 "RequiresFinalizer" sounds a bit confusing, since
1200
1201 Summary: `[RequiresFinalizer]` indicates that a given DOM object should be kept alive as long as the DOM object has pending activities.
1202
1203 Usage: `[RequiresFinalizer]` can be specified on interfaces, and **is inherited* *:
1204
1205 ```webidl
1206 [
1207 RequiresFinalizer,
1208 ] interface Foo {
1209 ...
1210 };
1211 ```
1212
1213 If an interface X has `[RequiresFinalizer]` and an interface Y inherits the inte rface X, then the interface Y will also have `[RequiresFinalizer]`. For example
1214
1215 ```webidl
1216 [
1217 RequiresFinalizer,
1218 ] interface Foo {};
1219 ```
1220
1221 interface Bar : Foo {}; // inherits [RequiresFinalizer] from Foo
1222 If a given DOM object needs to be kept alive as long as the DOM object has pendi ng activitiesi, yoiu need to specify `[RequiresFinalizer]` and `[DependentLifeti me]`. For example, `[RequiresFinalizer]` can be used when the DOM object is expe cting events ot be raised in the future.
Marcel Hlopko 2016/03/18 08:34:40 typo ot
Marcel Hlopko 2016/03/18 08:34:40 typo activitiesi, yoiu
jochen (gone - plz use gerrit) 2016/03/18 13:18:01 done
1223
1224 If you use `[RequiresFinalizer]`, the corresponding Blink class needs to inherit ActiveScriptWrappable. For example, in case of XMLHttpRequest, core/xml/XMLHttp Request.h would look like this:
1225
1226 ```c++
1227 class XMLHttpRequest : public ActiveScriptWrappable
1228 {
1229 ...;
1230 }
1231 ```
1232
1199 ### [RuntimeEnabled] _(i, m, a, c)_ 1233 ### [RuntimeEnabled] _(i, m, a, c)_
1200 1234
1201 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea tures::FeatureNameEnabled) { ...code... }`. 1235 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea tures::FeatureNameEnabled) { ...code... }`.
1202 1236
1203 Usage: `[RuntimeEnabled=FeatureName]`. FeatureName must be included in [RuntimeE nabledFeatures.in](https://code.google.com/p/chromium/codesearch#chromium/src/th ird_party/WebKit/Source/platform/RuntimeEnabledFeatures.in). 1237 Usage: `[RuntimeEnabled=FeatureName]`. FeatureName must be included in [RuntimeE nabledFeatures.in](https://code.google.com/p/chromium/codesearch#chromium/src/th ird_party/WebKit/Source/platform/RuntimeEnabledFeatures.in).
1204 1238
1205 ```webidl 1239 ```webidl
1206 [ 1240 [
1207 RuntimeEnabled=MediaSession 1241 RuntimeEnabled=MediaSession
1208 ] interface MediaSession { ... }; 1242 ] interface MediaSession { ... };
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 Copyright (C) 2009 Apple Inc. All rights reserved. 1591 Copyright (C) 2009 Apple Inc. All rights reserved.
1558 1592
1559 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1593 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1560 1594
1561 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer. 1595 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer.
1562 1596
1563 2. Redistributions in binary form must reproduce the above copyright notice, thi s list of conditions and the following disclaimer in the documentation and/or ot her materials provided with the distribution. 1597 2. Redistributions in binary form must reproduce the above copyright notice, thi s list of conditions and the following disclaimer in the documentation and/or ot her materials provided with the distribution.
1564 1598
1565 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI BILITY OF SUCH DAMAGE. 1599 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI BILITY OF SUCH DAMAGE.
1566 *** 1600 ***
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698