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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Review feedback (and rebase) Created 4 years, 2 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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 Without `[NoImplHeader]`, the IDL compiler assumes that there is XXX.h in the im pl side. With `[NoImplHeader]`, you can tell the IDL compiler that there is no X XX.h. You can use `[NoImplHeader]` when all of the DOM attributes and methods of the interface are implemented in Blink-in-JS and thus don't have any C++ header file. 1523 Without `[NoImplHeader]`, the IDL compiler assumes that there is XXX.h in the im pl side. With `[NoImplHeader]`, you can tell the IDL compiler that there is no X XX.h. You can use `[NoImplHeader]` when all of the DOM attributes and methods of the interface are implemented in Blink-in-JS and thus don't have any C++ header file.
1524 1524
1525 ## Temporary Blink-specific IDL Extended Attributes 1525 ## Temporary Blink-specific IDL Extended Attributes
1526 1526
1527 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. 1527 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.
1528 1528
1529 ### [LegacyTreatAsPartialInterface] _(i)_ 1529 ### [LegacyTreatAsPartialInterface] _(i)_
1530 1530
1531 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@). 1531 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@).
1532 1532
1533
1534 ### [CachedAccessor] _(a)_
1535
1536 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.
1537
1538
1539 *** note
1540 * The getter cannot have any side effects since calls to the getter will be repl aced by a cheap property load.
1541 * It uses a **push approach**, so updates must be _pushed_ every single time, it **DOES NOT** invalidate/update the cache automatically.
1542 * Despite being cached, the getter can still be called on certain circumstances, consistency is a must.
1543 * The cache **MUST** be initialized before using it. There's no default value li ke _undefined_ or a _hole_.
1544 ***
1545
1546
1547 Usage: `[CachedAccessor]` takes no arguments, can be specified on attributes.
1548
1549 ```webidl
1550 interface HTMLFoo {
1551 [CachedAccessor] readonly attribute Bar bar;
1552 };
1553 ```
1554
1555
1556 Register the required property in V8PrivateProperty.h.
1557 To update the cached value (e.g. for HTMLFoo.bar) proceed as follows:
1558
1559 ```c++
1560 V8PrivateProperty::getHTMLFooBarCachedAccessor().set(context, object, newValue);
1561 ```
1562
1563
1533 ## Discouraged Blink-specific IDL Extended Attributes 1564 ## Discouraged Blink-specific IDL Extended Attributes
1534 1565
1535 These extended attributes are _discouraged_ - they are not deprecated, but they should be avoided and removed if possible. 1566 These extended attributes are _discouraged_ - they are not deprecated, but they should be avoided and removed if possible.
1536 1567
1537 ### [DoNotCheckConstants] _(i)_ 1568 ### [DoNotCheckConstants] _(i)_
1538 1569
1539 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c an be different from constant values in Blink implementation. 1570 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c an be different from constant values in Blink implementation.
1540 1571
1541 Usage: `[DoNotCheckConstants]` can be specified on interfaces: 1572 Usage: `[DoNotCheckConstants]` can be specified on interfaces:
1542 1573
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 Copyright (C) 2009 Apple Inc. All rights reserved. 1636 Copyright (C) 2009 Apple Inc. All rights reserved.
1606 1637
1607 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1638 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1608 1639
1609 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer. 1640 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer.
1610 1641
1611 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. 1642 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.
1612 1643
1613 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. 1644 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.
1614 *** 1645 ***
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698