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

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

Issue 848673002: Add keys(), values() and entries() methods on iterable<> interfaces (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
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/results/modules/V8TestInterface5.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/core/V8TestInterface3.cpp
diff --git a/Source/bindings/tests/results/core/V8TestInterface3.cpp b/Source/bindings/tests/results/core/V8TestInterface3.cpp
index 0dadc80056467bc65d6d4d9242a4c82a32f150e6..b6cba1a59ab81516758a485331360efe1bc2d9ec 100644
--- a/Source/bindings/tests/results/core/V8TestInterface3.cpp
+++ b/Source/bindings/tests/results/core/V8TestInterface3.cpp
@@ -32,6 +32,66 @@ const WrapperTypeInfo& TestInterface3::s_wrapperTypeInfo = V8TestInterface3::wra
namespace TestInterface3V8Internal {
+static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "keys", "TestInterface3", info.Holder(), info.GetIsolate());
+ TestInterface3* impl = V8TestInterface3::toImpl(info.Holder());
+ ScriptState* scriptState = ScriptState::current(info.GetIsolate());
+ RawPtr<Iterator> result = impl->keys(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ v8SetReturnValue(info, result.release());
+}
+
+static void keysMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestInterface3V8Internal::keysMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void valuesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "values", "TestInterface3", info.Holder(), info.GetIsolate());
+ TestInterface3* impl = V8TestInterface3::toImpl(info.Holder());
+ ScriptState* scriptState = ScriptState::current(info.GetIsolate());
+ RawPtr<Iterator> result = impl->values(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ v8SetReturnValue(info, result.release());
+}
+
+static void valuesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestInterface3V8Internal::valuesMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void entriesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "entries", "TestInterface3", info.Holder(), info.GetIsolate());
+ TestInterface3* impl = V8TestInterface3::toImpl(info.Holder());
+ ScriptState* scriptState = ScriptState::current(info.GetIsolate());
+ RawPtr<Iterator> result = impl->entries(scriptState, exceptionState);
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ v8SetReturnValue(info, result.release());
+}
+
+static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestInterface3V8Internal::entriesMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface3", info.Holder(), info.GetIsolate());
@@ -110,6 +170,12 @@ static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
} // namespace TestInterface3V8Internal
+static const V8DOMConfiguration::MethodConfiguration V8TestInterface3Methods[] = {
+ {"keys", TestInterface3V8Internal::keysMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
+ {"values", TestInterface3V8Internal::valuesMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
+ {"entries", TestInterface3V8Internal::entriesMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
+};
+
static void installV8TestInterface3Template(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
@@ -118,7 +184,7 @@ static void installV8TestInterface3Template(v8::Local<v8::FunctionTemplate> func
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface3", v8::Local<v8::FunctionTemplate>(), V8TestInterface3::internalFieldCount,
0, 0,
0, 0,
- 0, 0);
+ V8TestInterface3Methods, WTF_ARRAY_LENGTH(V8TestInterface3Methods));
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/results/modules/V8TestInterface5.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698