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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Fix expectation for global-interface-listing-expected, windows. Created 4 years, 1 month 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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 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. 1514 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.
1515 1515
1516 ## Temporary Blink-specific IDL Extended Attributes 1516 ## Temporary Blink-specific IDL Extended Attributes
1517 1517
1518 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. 1518 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.
1519 1519
1520 ### [LegacyTreatAsPartialInterface] _(i)_ 1520 ### [LegacyTreatAsPartialInterface] _(i)_
1521 1521
1522 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@). 1522 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@).
1523 1523
1524
1525 ### [CachedAccessor] _(a)_
1526
1527 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.
1528
1529
1530 *** note
1531 * The getter cannot have any side effects since calls to the getter will be repl aced by a cheap property load.
1532 * It uses a **push approach**, so updates must be _pushed_ every single time, it **DOES NOT** invalidate/update the cache automatically.
1533 * Despite being cached, the getter can still be called on certain circumstances, consistency is a must.
1534 * The cache **MUST** be initialized before using it. There's no default value li ke _undefined_ or a _hole_.
1535 ***
1536
1537
1538 Usage: `[CachedAccessor]` takes no arguments, can be specified on attributes.
1539
1540 ```webidl
1541 interface HTMLFoo {
1542 [CachedAccessor] readonly attribute Bar bar;
1543 };
1544 ```
1545
1546
1547 Register the required property in V8PrivateProperty.h.
1548 To update the cached value (e.g. for HTMLFoo.bar) proceed as follows:
1549
1550 ```c++
1551 V8PrivateProperty::getHTMLFooBarCachedAccessor().set(context, object, newValue);
1552 ```
1553
1554
1524 ## Discouraged Blink-specific IDL Extended Attributes 1555 ## Discouraged Blink-specific IDL Extended Attributes
1525 1556
1526 These extended attributes are _discouraged_ - they are not deprecated, but they should be avoided and removed if possible. 1557 These extended attributes are _discouraged_ - they are not deprecated, but they should be avoided and removed if possible.
1527 1558
1528 ### [DoNotCheckConstants] _(i)_ 1559 ### [DoNotCheckConstants] _(i)_
1529 1560
1530 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c an be different from constant values in Blink implementation. 1561 Summary: `[DoNotCheckConstants]` indicates that constant values in an IDL file c an be different from constant values in Blink implementation.
1531 1562
1532 Usage: `[DoNotCheckConstants]` can be specified on interfaces: 1563 Usage: `[DoNotCheckConstants]` can be specified on interfaces:
1533 1564
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 Copyright (C) 2009 Apple Inc. All rights reserved. 1627 Copyright (C) 2009 Apple Inc. All rights reserved.
1597 1628
1598 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1629 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1599 1630
1600 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer. 1631 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer.
1601 1632
1602 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. 1633 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.
1603 1634
1604 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. 1635 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.
1605 *** 1636 ***
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698