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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp

Issue 2441943002: Retrieve prototype during custom element construction. (Closed)
Patch Set: Update after https://codereview.chromium.org/2443543002 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
index cdf2d1a7bbb145770e39aebeabc5d133012ec427..f6f8fb482c31b67eedc1bfca9b5b5a7e000133c9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
@@ -23,7 +23,7 @@
namespace blink {
// Retrieves the custom elements constructor -> name map, creating it
-// if necessary. The same map is used to keep prototypes alive.
+// if necessary.
static v8::Local<v8::Map> ensureCustomElementRegistryMap(
ScriptState* scriptState,
CustomElementRegistry* registry) {
@@ -101,14 +101,13 @@ ScriptCustomElementDefinition* ScriptCustomElementDefinition::create(
CustomElementRegistry* registry,
const CustomElementDescriptor& descriptor,
const v8::Local<v8::Object>& constructor,
- const v8::Local<v8::Object>& prototype,
const v8::Local<v8::Function>& connectedCallback,
const v8::Local<v8::Function>& disconnectedCallback,
const v8::Local<v8::Function>& adoptedCallback,
const v8::Local<v8::Function>& attributeChangedCallback,
const HashSet<AtomicString>& observedAttributes) {
ScriptCustomElementDefinition* definition = new ScriptCustomElementDefinition(
- scriptState, descriptor, constructor, prototype, connectedCallback,
+ scriptState, descriptor, constructor, connectedCallback,
disconnectedCallback, adoptedCallback, attributeChangedCallback,
observedAttributes);
@@ -120,17 +119,16 @@ ScriptCustomElementDefinition* ScriptCustomElementDefinition::create(
map->Set(scriptState->context(), constructor, nameValue).ToLocalChecked();
definition->m_constructor.setPhantom();
- // We add the prototype and callbacks here to keep them alive. We use the
- // name as the key because it is unique per-registry.
+ // We add the callbacks here to keep them alive. We use the name as
+ // the key because it is unique per-registry.
v8::Local<v8::Array> array = v8::Array::New(scriptState->isolate(), 5);
- keepAlive(array, 0, prototype, definition->m_prototype, scriptState);
- keepAlive(array, 1, connectedCallback, definition->m_connectedCallback,
+ keepAlive(array, 0, connectedCallback, definition->m_connectedCallback,
scriptState);
- keepAlive(array, 2, disconnectedCallback, definition->m_disconnectedCallback,
+ keepAlive(array, 1, disconnectedCallback, definition->m_disconnectedCallback,
scriptState);
- keepAlive(array, 3, adoptedCallback, definition->m_adoptedCallback,
+ keepAlive(array, 2, adoptedCallback, definition->m_adoptedCallback,
scriptState);
- keepAlive(array, 4, attributeChangedCallback,
+ keepAlive(array, 3, attributeChangedCallback,
definition->m_attributeChangedCallback, scriptState);
map->Set(scriptState->context(), nameValue, array).ToLocalChecked();
@@ -141,7 +139,6 @@ ScriptCustomElementDefinition::ScriptCustomElementDefinition(
ScriptState* scriptState,
const CustomElementDescriptor& descriptor,
const v8::Local<v8::Object>& constructor,
- const v8::Local<v8::Object>& prototype,
const v8::Local<v8::Function>& connectedCallback,
const v8::Local<v8::Function>& disconnectedCallback,
const v8::Local<v8::Function>& adoptedCallback,
@@ -266,11 +263,6 @@ v8::Local<v8::Object> ScriptCustomElementDefinition::constructor() const {
return m_constructor.newLocal(m_scriptState->isolate());
}
-v8::Local<v8::Object> ScriptCustomElementDefinition::prototype() const {
- DCHECK(!m_prototype.isEmpty());
- return m_prototype.newLocal(m_scriptState->isolate());
-}
-
// CustomElementDefinition
ScriptValue ScriptCustomElementDefinition::getConstructorForScript() {
return ScriptValue(m_scriptState.get(), constructor());

Powered by Google App Engine
This is Rietveld 408576698