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

Unified Diff: third_party/WebKit/Source/core/dom/custom/README.md

Issue 2828643002: Make customElements.define faster
Patch Set: Remove some unneeded casts. Created 3 years, 8 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/core/dom/custom/README.md
diff --git a/third_party/WebKit/Source/core/dom/custom/README.md b/third_party/WebKit/Source/core/dom/custom/README.md
index a85cf911b1393a09c26adbfe48cccc4bd5afd87d..6b50927c9df7fa36834add09f45a8b002a4ff9f9 100644
--- a/third_party/WebKit/Source/core/dom/custom/README.md
+++ b/third_party/WebKit/Source/core/dom/custom/README.md
@@ -4,8 +4,7 @@ Custom elements let authors create their own elements, with their own
methods, behavior, and attribute handling. Custom elements shipped in
M33. We colloquially refer to that version as "v0."
-Contact Dominic Cooney
-([dominicc@chromium.org](mailto:dominicc@chromium.org)) with
+Contact [dom-dev@chromium.org](mailto:dom-dev@chromium.org) with
questions.
### Code Location
@@ -23,42 +22,36 @@ The definition of one ‘class’ of element. This type is
abstract to permit different kinds of definitions, although at the
moment there is only one: ScriptCustomElementDefinition.
-ScriptCustomElementDefinition is linked to its constructor by an ID
-number. The ID number is stored in a map, keyed by constructor, in a
-hidden value of the CustomElementRegistry wrapper. The ID is an index
-into a list of definitions stored in V8PerContextData.
+###### ScriptCustomElementDefinition
+
+A constructor and its callbacks. To go from a custom element
+definition to a constructor, just access the member.
+
+Mapping a constructor back to a definition is more complicated because
+the same constructor could be defined as a custom element in different
+contexts. Each context has its own v8::Private that's a key to the
+property on the constructor; the value is an index into the table of
+definitions in the custom element registry.
###### CustomElementDescriptor
A tuple of local name, and custom element name. For autonomous custom
elements, these strings are the same; for customized built-in elements
these strings will be different. In that case, the local name is the
-element's tag name and the custom element name is related to the value
-of the “is” attribute.
+element's local name and the custom element name is related to the
+value of the “is” attribute.
###### CustomElementRegistry
Implements the `window.customElements` property. This maintains the
-set of registered names. The wrapper of this object is used by
-ScriptCustomElementDefinition to cache state in V8.
+set of registered names and a list of registered definitions.
-###### V8HTMLElement Constructor
+###### V8HTMLElementConstructor
The `HTMLElement` interface constructor. When a custom element is
created from JavaScript all we have to go on is the constructor (in
-`new.target`); this uses ScriptCustomElementDefinition's state to find
-the definition to use.
-
-### Memory Management
-
-Once defined, custom element constructors and prototypes have to be
-kept around indefinitely because they could be created in future by
-the parser. On the other hand, we must not leak when a window can no
-longer run script.
-
-We use a V8HiddenValue on the CustomElementRegistry wrapper which
-points to a map that keeps constructors and prototypes alive. See
-ScriptCustomElementDefinition.
+`new.target`); this uses the context to map the constructor back to
+its definition as described in ScriptCustomElementDefintion above.
## Style Guide

Powered by Google App Engine
This is Rietveld 408576698