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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8StringSequenceCallbackFunctionLongSequenceArg.cpp

Issue 2350813005: bindings: Support sequence in callback function arguments (Closed)
Patch Set: rebase Created 4 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
Index: third_party/WebKit/Source/bindings/tests/results/core/V8StringSequenceCallbackFunctionLongSequenceArg.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8StringSequenceCallbackFunctionLongSequenceArg.cpp
similarity index 60%
copy from third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp
copy to third_party/WebKit/Source/bindings/tests/results/core/V8StringSequenceCallbackFunctionLongSequenceArg.cpp
index b27bdc9509b56f941c4d1d6f92523765e506f590..3294509f6f8c20cf2366673bc918a1d936ffc17e 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8StringSequenceCallbackFunctionLongSequenceArg.cpp
@@ -6,7 +6,7 @@
// clang-format off
-#include "V8LongExperimentalCallbackFunction.h"
+#include "V8StringSequenceCallbackFunctionLongSequenceArg.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ToV8.h"
@@ -15,40 +15,40 @@
namespace blink {
-V8LongExperimentalCallbackFunction::V8LongExperimentalCallbackFunction(v8::Isolate* isolate, v8::Local<v8::Function> callback)
+V8StringSequenceCallbackFunctionLongSequenceArg::V8StringSequenceCallbackFunctionLongSequenceArg(v8::Isolate* isolate, v8::Local<v8::Function> callback)
: m_callback(isolate, callback)
{
DCHECK(!m_callback.isEmpty());
m_callback.setPhantom();
}
-DEFINE_TRACE(V8LongExperimentalCallbackFunction)
+DEFINE_TRACE(V8StringSequenceCallbackFunctionLongSequenceArg)
{
}
-bool V8LongExperimentalCallbackFunction::call(ScriptState* scriptState, ScriptWrappable* scriptWrappable, int num1, int num2, int& returnValue)
+bool V8StringSequenceCallbackFunctionLongSequenceArg::call(ScriptState* scriptState, ScriptWrappable* scriptWrappable, ExceptionState& exceptionState, const Vector<int>& arg, Vector<String>& returnValue)
{
if (!scriptState->contextIsValid())
return false;
if (m_callback.isEmpty())
return false;
+
ScriptState::Scope scope(scriptState);
- v8::Local<v8::Value> num1Argument = v8::Integer::New(scriptState->isolate(), num1);
- v8::Local<v8::Value> num2Argument = v8::Integer::New(scriptState->isolate(), num2);
+ v8::Local<v8::Value> argArgument = toV8(arg, scriptState->context()->Global(), scriptState->isolate());
v8::Local<v8::Value> thisValue = toV8(scriptWrappable, scriptState->context()->Global(), scriptState->isolate());
- v8::Local<v8::Value> argv[] = { num1Argument, num2Argument };
+ v8::Local<v8::Value> argv[] = { argArgument };
v8::Local<v8::Value> v8ReturnValue;
v8::TryCatch exceptionCatcher(scriptState->isolate());
exceptionCatcher.SetVerbose(true);
- if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()), scriptState->getExecutionContext(), thisValue, 2, argv, scriptState->isolate()).ToLocal(&v8ReturnValue))
+ if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()), scriptState->getExecutionContext(), thisValue, 1, argv, scriptState->isolate()).ToLocal(&v8ReturnValue))
{
- int cppValue = toInt32(info.GetIsolate(), v8ReturnValue, NormalConversion, exceptionState);
+ Vector<String> cppValue = toImplArray<Vector<String>>(v8ReturnValue, 0, scriptState->isolate(), exceptionState);
if (exceptionState.hadException())
return false;
returnValue = cppValue;

Powered by Google App Engine
This is Rietveld 408576698