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

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-05-31T18:12:12 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..94c63cfb2fdfee01d5d084e3fcdba9a88582c218 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
{
+ 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);
yosin_UTC9 2016/05/31 09:16:57 Do we really need to have this check?
DCHECK(!m_prototype.isEmpty());
return m_prototype.newLocal(scriptState->isolate());
}
+// CustomElementDefinition
+ScriptValue ScriptCustomElementDefinition::getConstructor(
+ ScriptState* scriptState)
+{
+ if (m_scriptState != scriptState)
yosin_UTC9 2016/05/31 09:16:57 Do we really need to have this check?
+ return ScriptValue(scriptState, v8Undefined());
yosin_UTC9 2016/05/31 09:16:57 Should be |ScriptValue()|
dominicc (has gone to gerrit) 2016/05/31 22:56:32 Why not just do that?
yosin_UTC9 2016/06/01 02:14:37 I expect to have this patch isn't ready for commit
+ return ScriptValue(scriptState, constructor(scriptState));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698