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

Unified Diff: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md

Issue 2335203006: Add [CachedAccessor] attribute to cache (almost) constant accessors (window.document). (Closed)
Patch Set: Polishing + naming revisited Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
diff --git a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
index 13113cbc5804e70db598dbf67d53845481232e63..eecb69946f0f87a0c3a721ace166c70990eb501f 100644
--- a/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
+++ b/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md
@@ -1573,6 +1573,31 @@ v8::experimental::FastAccessorBuilder* V8Node::XXXAttributeGetterBuilder(v8::Iso
```
+
+### [CachedAccessor] _(a)_
+
+Summary: Caches accessor result to a private property.
+
haraken 2016/09/20 14:15:02 Add a webidl example.
+
haraken 2016/09/20 14:15:02 Some description is needed to describe what [Cache
+*** note
+The accessor cannot have any side effects since calls to the getter will be suppresed, being replaced by a cheap property load.
+It uses a **push approach**, so updates must be 'pushed' every single time, it **WONT'T** invalidate/recalculate the values automatically.
+The original getter can still be used/called on certain circumstances.
+Useful for performance-critical use cases, where the accessor's result doesn't change often.
+
+Please add the required property to V8PrivateProperty.h.
+To update the cache (e.g. for window.document) proceed as follows:
+
+```c++
+V8PrivateProperty::getWindowDocument().set(context, object, newValue);
+```
+
+
+***
+
+Usage: `[CachedAccessor]` takes no arguments, can be specified on attributes.
+
+
## Discouraged Blink-specific IDL Extended Attributes
These extended attributes are _discouraged_ - they are not deprecated, but they should be avoided and removed if possible.

Powered by Google App Engine
This is Rietveld 408576698