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

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

Issue 483163003: Introduce ES6 iterator for DOM objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « Source/bindings/tests/idls/TestInterface.idl ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestInterface.cpp
diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp
index 36557c740fb57751c0fd5a968a942459559324d1..ab3d1cdf6827c17878ab09d7d80d82cdd3f8a366 100644
--- a/Source/bindings/tests/results/V8TestInterface.cpp
+++ b/Source/bindings/tests/results/V8TestInterface.cpp
@@ -10,6 +10,7 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/PrivateScriptRunner.h"
+#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/V8AbstractEventListener.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
@@ -20,6 +21,7 @@
#include "bindings/tests/idls/TestImplements3Implementation.h"
#include "bindings/tests/idls/TestPartialInterface.h"
#include "bindings/tests/idls/TestPartialInterfaceImplementation.h"
+#include "bindings/tests/v8/V8Iterator.h"
#include "bindings/tests/v8/V8Node.h"
#include "bindings/tests/v8/V8TestInterface.h"
#include "bindings/tests/v8/V8TestInterfaceEmpty.h"
@@ -1418,6 +1420,26 @@ static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
+static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface", info.Holder(), info.GetIsolate());
+ TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
+ ScriptState* scriptState = ScriptState::current(info.GetIsolate());
+ RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ v8SetReturnValue(info, result.release());
+}
+
+static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestInterfaceImplementationV8Internal::iteratorMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
@@ -1679,6 +1701,8 @@ static void installV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> func
}
functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfaceImplementationV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementation>);
functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceImplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback);
+ static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
+ V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration, isolate);
functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMethodConfiguration = {
"alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,
« no previous file with comments | « Source/bindings/tests/idls/TestInterface.idl ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698