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

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, 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
Index: Source/bindings/tests/results/V8TestInterface.cpp
diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp
index b5d2a151600dd4731a18103a66563efc9c352dc6..07c953a5551d0ed2eef7177241bb15012b7e379b 100644
--- a/Source/bindings/tests/results/V8TestInterface.cpp
+++ b/Source/bindings/tests/results/V8TestInterface.cpp
@@ -10,16 +10,19 @@
#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"
#include "bindings/core/v8/V8EventListenerList.h"
#include "bindings/core/v8/V8HiddenValue.h"
+#include "bindings/core/v8/V8Iterator.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/tests/idls/TestImplements2.h"
#include "bindings/tests/idls/TestImplements3Implementation.h"
#include "bindings/tests/idls/TestPartialInterface.h"
#include "bindings/tests/idls/TestPartialInterfaceImplementation.h"
+#include "bindings/tests/v8/V8Iterator.h"
Jens Widell 2014/08/21 13:58:02 Please help me out: I don't understand why this #i
yhirano 2014/08/25 06:09:26 I don't know either. Given that V8Node.h is in the
#include "bindings/tests/v8/V8Node.h"
#include "bindings/tests/v8/V8TestInterface.h"
#include "bindings/tests/v8/V8TestInterfaceEmpty.h"
@@ -1415,6 +1418,28 @@ static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
+namespace symbol {
Jens Widell 2014/08/21 13:58:02 Nit: it would be nice with a blank after this line
haraken 2014/08/21 16:15:58 I guess we can just use "iteratorMethod" until it
yhirano 2014/08/25 06:09:26 OK, I deleted the namespace. Let's think about the
yhirano 2014/08/25 06:09:26 Deleted
+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::symbol::iteratorMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+} // namespace symbol
static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
@@ -1676,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 symbolIteratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8Internal::symbol::iteratorMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts };
+ V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::DontDelete, symbolIteratorConfiguration, isolate);
functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
static const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMethodConfiguration = {
"alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwaysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts,

Powered by Google App Engine
This is Rietveld 408576698