OLD | NEW |
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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 ```webidl | 1262 ```webidl |
1263 [ | 1263 [ |
1264 SetWrapperReferenceTo=targetMethod | 1264 SetWrapperReferenceTo=targetMethod |
1265 ] interface YYY { ... }; | 1265 ] interface YYY { ... }; |
1266 ``` | 1266 ``` |
1267 | 1267 |
1268 The code generates a function called `YYY::visitDOMWrapper` which is called by `
V8GCController` before GC. The function adds implicit references from this objec
t's wrapper to a target object's wrapper to keeps it alive. | 1268 The code generates a function called `YYY::visitDOMWrapper` which is called by `
V8GCController` before GC. The function adds implicit references from this objec
t's wrapper to a target object's wrapper to keeps it alive. |
1269 | 1269 |
1270 The `[SetWrapperReferenceTo]` extended attribute takes a value, which is the met
hod name to call to get the target object. For example, with the above declarati
on a call will be made to `YYY::targetMethod()` to get the target of the referen
ce. | 1270 The `[SetWrapperReferenceTo]` extended attribute takes a value, which is the met
hod name to call to get the target object. For example, with the above declarati
on a call will be made to `YYY::targetMethod()` to get the target of the referen
ce. |
1271 | 1271 |
1272 ### [TraceWrappers=(list)] _(i)_ | |
1273 | |
1274 Summary: This generates code that traces script-wrappable references (which are
used to keep wrappers alive during V8 GC). | |
1275 | |
1276 Usage: `[TraceWrappers=(list)]` can be specified on an interface. | |
1277 | |
1278 ```webidl | |
1279 [ | |
1280 TraceWrappers=(element1, element2) | |
1281 ] interface XXX : YYY { ... }; | |
1282 ``` | |
1283 | |
1284 The generator generates a function called `XXX::traceWrappers` which is called b
y `ScriptWrappableVisitor` during V8 GC. The function adds references from the X
XX instance to this object's element1() and element2() children. | |
1285 | |
1286 The generated code is then: | |
1287 | |
1288 ```c++ | |
1289 DEFINE_TRACE_WRAPPERS(XXX) | |
1290 { | |
1291 visitor->traceWrappers(element1()); | |
1292 visitor->traceWrappers(element2()); | |
1293 | |
1294 YYY::traceWrappers(visitor); | |
1295 } | |
1296 ``` | |
1297 | |
1298 ## Rare Blink-specific IDL Extended Attributes | 1272 ## Rare Blink-specific IDL Extended Attributes |
1299 | 1273 |
1300 These extended attributes are rarely used, generally only in one or two places.
These are often replacements for `[Custom]` bindings, and may be candidates for
deprecation and removal. | 1274 These extended attributes are rarely used, generally only in one or two places.
These are often replacements for `[Custom]` bindings, and may be candidates for
deprecation and removal. |
1301 | 1275 |
1302 ### [CachedAttribute] _(a)_ | 1276 ### [CachedAttribute] _(a)_ |
1303 | 1277 |
1304 Summary: For performance optimization, `[CachedAttribute]` indicates that a wrap
ped object should be cached on a DOM object. Rarely used (only by IndexDB). | 1278 Summary: For performance optimization, `[CachedAttribute]` indicates that a wrap
ped object should be cached on a DOM object. Rarely used (only by IndexDB). |
1305 | 1279 |
1306 Usage: `[CachedAttribute]` can be specified on attributes, and takes a required
value, generally called is*Dirty (esp. isValueDirty): | 1280 Usage: `[CachedAttribute]` can be specified on attributes, and takes a required
value, generally called is*Dirty (esp. isValueDirty): |
1307 | 1281 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 Copyright (C) 2009 Apple Inc. All rights reserved. | 1549 Copyright (C) 2009 Apple Inc. All rights reserved. |
1576 | 1550 |
1577 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1551 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1578 | 1552 |
1579 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1553 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1580 | 1554 |
1581 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. | 1555 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. |
1582 | 1556 |
1583 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. | 1557 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. |
1584 *** | 1558 *** |
OLD | NEW |