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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp

Issue 2342053002: binding: Refactors bindings/templates/attributes.cpp. (Closed)
Patch Set: Synced. 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/tests/results/core/V8TestInterfaceNode.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp
index e57705f902cd239b5d873b6f3804d33d70fb014a..d05065544f434c0d77849a49dbe09542fd258112 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp
@@ -56,7 +56,9 @@ namespace TestInterfaceNodeV8Internal {
static void nodeNameAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueString(info, impl->nodeName(), info.GetIsolate());
}
@@ -69,22 +71,28 @@ static void nodeNameAttributeSetter(v8::Local<v8::Value> v8Value, const v8::Func
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
+ // Prepare the value to be set.
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
+
impl->setNodeName(cppValue);
}
void nodeNameAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
+
TestInterfaceNodeV8Internal::nodeNameAttributeSetter(v8Value, info);
}
static void stringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueString(info, impl->stringAttribute(), info.GetIsolate());
}
@@ -97,22 +105,28 @@ static void stringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
+ // Prepare the value to be set.
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
+
impl->setStringAttribute(cppValue);
}
void stringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
+
TestInterfaceNodeV8Internal::stringAttributeAttributeSetter(v8Value, info);
}
static void readonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueFast(info, WTF::getPtr(impl->readonlyTestInterfaceEmptyAttribute()), impl);
}
@@ -124,8 +138,11 @@ void readonlyTestInterfaceEmptyAttributeAttributeGetterCallback(const v8::Functi
static void eventHandlerAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
EventListener* cppValue(WTF::getPtr(impl->eventHandlerAttribute()));
+
v8SetReturnValue(info, cppValue ? V8AbstractEventListener::cast(cppValue)->getListenerOrNull(info.GetIsolate(), impl->getExecutionContext()) : v8::Null(info.GetIsolate()).As<v8::Value>());
}
@@ -138,19 +155,25 @@ static void eventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
+ // Prepare the value to be set.
+
impl->setEventHandlerAttribute(V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate));
}
void eventHandlerAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
+
TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetter(v8Value, info);
}
static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsReadonlyTestInterfaceEmptyAttribute()), impl);
}
@@ -162,7 +185,9 @@ void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(
static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsReadonlyTestInterfaceEmptyAttribute()));
}
@@ -174,7 +199,9 @@ void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackF
static void reflectStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::reflectstringattributeAttr), info.GetIsolate());
}
@@ -187,23 +214,30 @@ static void reflectStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value,
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
+ // Prepare the value to be set.
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
+
impl->setAttribute(HTMLNames::reflectstringattributeAttr, cppValue);
}
void reflectStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
+
V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
+
TestInterfaceNodeV8Internal::reflectStringAttributeAttributeSetter(v8Value, info);
}
static void reflectUrlStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
v8SetReturnValueString(info, impl->getURLAttribute(HTMLNames::reflecturlstringattributeAttr), info.GetIsolate());
}
@@ -216,16 +250,21 @@ static void reflectUrlStringAttributeAttributeSetter(v8::Local<v8::Value> v8Valu
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);
+
+ // Prepare the value to be set.
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
+
impl->setAttribute(HTMLNames::reflecturlstringattributeAttr, cppValue);
}
void reflectUrlStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
+
V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
+
TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetter(v8Value, info);
}

Powered by Google App Engine
This is Rietveld 408576698