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

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 22553002: Make EventListener a callback interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.h ('k') | Source/core/dom/EventListener.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index 7551278c293ac84aba6a1faa84128359e6e55f0e..91c3e5282b052f859470a409bc20596508026be1 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -43,6 +43,7 @@
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptValue.h"
#include "bindings/v8/SerializedScriptValue.h"
+#include "bindings/v8/V8AbstractEventListener.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMActivityLogger.h"
#include "bindings/v8/V8DOMConfiguration.h"
@@ -460,6 +461,36 @@ static void stringAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v
TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
}
+static void eventListenerAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ EventListener* listener = imp->eventListenerAttr(isolatedWorldForIsolate(info.GetIsolate()));
+ v8SetReturnValue(info, listener ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(listener)->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate())));
+ return;
+}
+
+static void eventListenerAttrAttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TestObjV8Internal::eventListenerAttrAttrGetter(name, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void eventListenerAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ transferHiddenDependency(info.Holder(), imp->eventListenerAttr(isolatedWorldForIsolate(info.GetIsolate())), value, V8TestObject::eventListenerCacheIndex, info.GetIsolate());
+ imp->setEventListenerAttr(V8EventListenerList::getEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(info.GetIsolate()));
+ return;
+}
+
+static void eventListenerAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ TestObjV8Internal::eventListenerAttrAttrSetter(name, value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
static void testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObj* imp = V8TestObject::toNative(info.Holder());
@@ -5260,6 +5291,8 @@ static const V8DOMConfiguration::BatchedAttribute V8TestObjectAttrs[] = {
{"unsignedLongLongAttr", TestObjV8Internal::unsignedLongLongAttrAttrGetterCallback, TestObjV8Internal::unsignedLongLongAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'stringAttr'
{"stringAttr", TestObjV8Internal::stringAttrAttrGetterCallback, TestObjV8Internal::stringAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'eventListenerAttr'
+ {"eventListenerAttr", TestObjV8Internal::eventListenerAttrAttrGetterCallback, TestObjV8Internal::eventListenerAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'testObjAttr'
{"testObjAttr", TestObjV8Internal::testObjAttrAttrGetterCallback, TestObjV8Internal::testObjAttrAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'XMLObjAttr'
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.h ('k') | Source/core/dom/EventListener.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698