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

Unified Diff: Source/bindings/tests/results/core/V8TestInterface2.cpp

Issue 841973002: IDL: Support iterable<>, maplike<> and setlike<> syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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/core/V8TestInterface2.cpp
diff --git a/Source/bindings/tests/results/core/V8TestInterface2.cpp b/Source/bindings/tests/results/core/V8TestInterface2.cpp
index 6b636fbb59422ae3c1e3865936d826b6f98d7315..7346b4b29740213d2eb4747863e50366f18f7ac1 100644
--- a/Source/bindings/tests/results/core/V8TestInterface2.cpp
+++ b/Source/bindings/tests/results/core/V8TestInterface2.cpp
@@ -8,9 +8,11 @@
#include "V8TestInterface2.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8GCController.h"
#include "bindings/core/v8/V8HiddenValue.h"
+#include "bindings/core/v8/V8Iterator.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/V8TestInterfaceEmpty.h"
#include "core/dom/ContextFeatures.h"
@@ -231,6 +233,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", "TestInterface2", info.Holder(), info.GetIsolate());
+ TestInterface2* impl = V8TestInterface2::toImpl(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");
+ TestInterface2V8Internal::iteratorMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
RefPtr<TestInterface2> impl = TestInterface2::create();
@@ -484,6 +506,8 @@ static void installV8TestInterface2Template(v8::Local<v8::FunctionTemplate> func
static_assert(1 == TestInterface2::CONST_VALUE_1, "the value of TestInterface2_CONST_VALUE_1 does not match with implementation");
functionTemplate->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration(TestInterface2V8Internal::indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPropertySetterCallback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface2>));
functionTemplate->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration(TestInterface2V8Internal::namedPropertyGetterCallback, TestInterface2V8Internal::namedPropertySetterCallback, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterface2V8Internal::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPropertyEnumeratorCallback));
+ static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterface2V8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
+ V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration, isolate);
// Custom toString template
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
« no previous file with comments | « Source/bindings/tests/idls/modules/TestInterface5.idl ('k') | Source/bindings/tests/results/core/V8TestInterface3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698