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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 These extended attributes are _temporary_ and are only in use while some change
is in progress. Unless you are involved with the change, you can generally ignor
e them, and should not use them. | 1507 These extended attributes are _temporary_ and are only in use while some change
is in progress. Unless you are involved with the change, you can generally ignor
e them, and should not use them. |
1508 | 1508 |
1509 ### [ExperimentalCallbackFunction] | 1509 ### [ExperimentalCallbackFunction] |
1510 | 1510 |
1511 Summary: `[ExperimentalCallbackFunction]` on a callback function is a flag to co
llect callback functions. Currently the code generator doesn't generate bindings
for IDL callback functions (instead, it just uses `ScriptValue`). While generat
ing bindings for callback functions, to change existing code which uses callback
functions until the generated bindings are stabilized is undesirable. To implem
ent bindings generation for IDL callback functions incrementally, [ExperimentalC
allbackFunction] extended attribute is added. The code generator keeps using Scr
iptValue for IDL callback functions which don't have this extended attribute. | 1511 Summary: `[ExperimentalCallbackFunction]` on a callback function is a flag to co
llect callback functions. Currently the code generator doesn't generate bindings
for IDL callback functions (instead, it just uses `ScriptValue`). While generat
ing bindings for callback functions, to change existing code which uses callback
functions until the generated bindings are stabilized is undesirable. To implem
ent bindings generation for IDL callback functions incrementally, [ExperimentalC
allbackFunction] extended attribute is added. The code generator keeps using Scr
iptValue for IDL callback functions which don't have this extended attribute. |
1512 | 1512 |
1513 ### [LegacyTreatAsPartialInterface] _(i)_ | 1513 ### [LegacyTreatAsPartialInterface] _(i)_ |
1514 | 1514 |
1515 Summary: `[LegacyTreatAsPartialInterface]` on an interface that is the target of
an `implements` statement means that the interface is treated as a partial inte
rface, meaning members are accessed via static member functions in a separate cl
ass, rather than as instance methods on the instance object `*impl` or class met
hods on the C++ class implementing the (main) interface. This is legacy from ori
ginal implementation of `implements`, and is being removed ([Bug 360435](https:/
/crbug.com/360435), nbarth@). | 1515 Summary: `[LegacyTreatAsPartialInterface]` on an interface that is the target of
an `implements` statement means that the interface is treated as a partial inte
rface, meaning members are accessed via static member functions in a separate cl
ass, rather than as instance methods on the instance object `*impl` or class met
hods on the C++ class implementing the (main) interface. This is legacy from ori
ginal implementation of `implements`, and is being removed ([Bug 360435](https:/
/crbug.com/360435), nbarth@). |
1516 | 1516 |
| 1517 |
| 1518 ### [CachedAccessor] _(a)_ |
| 1519 |
| 1520 Summary: Caches the accessor result in a private property (not directly accesibl
e from JS). Improves accessor reads (getter) at the expense of extra memory and
manual invalidation which should be trivial in most cases. |
| 1521 |
| 1522 |
| 1523 *** note |
| 1524 * The getter cannot have any side effects since calls to the getter will be repl
aced by a cheap property load. |
| 1525 * It uses a **push approach**, so updates must be _pushed_ every single time, it
**DOES NOT** invalidate/update the cache automatically. |
| 1526 * Despite being cached, the getter can still be called on certain circumstances,
consistency is a must. |
| 1527 * The cache **MUST** be initialized before using it. There's no default value li
ke _undefined_ or a _hole_. |
| 1528 *** |
| 1529 |
| 1530 |
| 1531 Usage: `[CachedAccessor]` takes no arguments, can be specified on attributes. |
| 1532 |
| 1533 ```webidl |
| 1534 interface HTMLFoo { |
| 1535 [CachedAccessor] readonly attribute Bar bar; |
| 1536 }; |
| 1537 ``` |
| 1538 |
| 1539 |
| 1540 Register the required property in V8PrivateProperty.h. |
| 1541 To update the cached value (e.g. for HTMLFoo.bar) proceed as follows: |
| 1542 |
| 1543 ```c++ |
| 1544 V8PrivateProperty::getHTMLFooBarCachedAccessor().set(context, object, newValue); |
| 1545 ``` |
| 1546 |
| 1547 |
1517 ## Discouraged Blink-specific IDL Extended Attributes | 1548 ## Discouraged Blink-specific IDL Extended Attributes |
1518 | 1549 |
1519 These extended attributes are _discouraged_ - they are not deprecated, but they
should be avoided and removed if possible. | 1550 These extended attributes are _discouraged_ - they are not deprecated, but they
should be avoided and removed if possible. |
1520 | 1551 |
1521 ### [DoNotCheckConstants] _(i)_ | 1552 ### [DoNotCheckConstants] _(i)_ |
1522 | 1553 |
1523 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c
an be different from constant values in Blink implementation. | 1554 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c
an be different from constant values in Blink implementation. |
1524 | 1555 |
1525 Usage: `[DoNotCheckConstants]` can be specified on interfaces: | 1556 Usage: `[DoNotCheckConstants]` can be specified on interfaces: |
1526 | 1557 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 Copyright (C) 2009 Apple Inc. All rights reserved. | 1620 Copyright (C) 2009 Apple Inc. All rights reserved. |
1590 | 1621 |
1591 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1622 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1592 | 1623 |
1593 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1624 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1594 | 1625 |
1595 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. | 1626 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. |
1596 | 1627 |
1597 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. | 1628 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. |
1598 *** | 1629 *** |
OLD | NEW |