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

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

Issue 1994093002: Introduce CustomElementRegistry#get() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-01T11:06:28 Created 4 years, 7 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 d0d3bd051180dce7ef6a8ad89f2a005361ff7fe8..93ca9d23e96c6233a42f5fc39ccbf61c856dd09c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
@@ -109,6 +109,7 @@ ScriptCustomElementDefinition::ScriptCustomElementDefinition(
const v8::Local<v8::Object>& constructor,
const v8::Local<v8::Object>& prototype)
: CustomElementDefinition(descriptor)
+ , m_scriptState(scriptState)
, m_constructor(scriptState->isolate(), constructor)
, m_prototype(scriptState->isolate(), prototype)
{
@@ -122,6 +123,7 @@ ScriptCustomElementDefinition::ScriptCustomElementDefinition(
v8::Local<v8::Object> ScriptCustomElementDefinition::constructor(
ScriptState* scriptState) const
haraken 2016/06/01 02:28:12 ScriptState is not needed. You can just pass in an
yosin_UTC9 2016/06/01 06:16:14 I'll handle this change in another CL.
{
+ DCHECK_EQ(m_scriptState, scriptState);
DCHECK(!m_constructor.isEmpty());
return m_constructor.newLocal(scriptState->isolate());
}
@@ -129,8 +131,18 @@ v8::Local<v8::Object> ScriptCustomElementDefinition::constructor(
v8::Local<v8::Object> ScriptCustomElementDefinition::prototype(
ScriptState* scriptState) const
{
+ DCHECK_EQ(m_scriptState, scriptState);
DCHECK(!m_prototype.isEmpty());
return m_prototype.newLocal(scriptState->isolate());
}
+// CustomElementDefinition
+ScriptValue ScriptCustomElementDefinition::getConstructorForScript(
+ ScriptState* scriptState)
+{
+ if (m_scriptState != scriptState)
+ return ScriptValue();
+ return ScriptValue(scriptState, constructor(scriptState));
haraken 2016/06/01 02:28:12 I guess this should be: return ScriptValue(m_sc
yosin_UTC9 2016/06/01 06:16:14 AFAIK, No. I should not be happened.
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698