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

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

Issue 2758463002: [Refactoring] Clean up binding template files for callback interfaces (Closed)
Patch Set: . Created 3 years, 9 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 | « third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp
index 8c516936a021401e5f00e5e7affa12c8776eeefc..9d785420aee3eb2489f363c54f19dcff9144b88c 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.cpp
@@ -41,10 +41,18 @@ void V8TestCallbackInterface::voidMethod() {
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> *argv = 0;
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 0, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 0,
+ argv,
+ isolate);
}
bool V8TestCallbackInterface::booleanMethod() {
@@ -54,12 +62,20 @@ bool V8TestCallbackInterface::booleanMethod() {
return true;
if (!m_scriptState->contextIsValid())
return true;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> *argv = 0;
- v8::TryCatch exceptionCatcher(m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ v8::TryCatch exceptionCatcher(isolate);
exceptionCatcher.SetVerbose(true);
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 0, argv, m_scriptState->isolate());
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ executionContext,
+ v8::Undefined(isolate),
+ 0,
+ argv,
+ isolate);
return !exceptionCatcher.HasCaught();
}
@@ -70,11 +86,19 @@ void V8TestCallbackInterface::voidMethodBooleanArg(bool boolArg) {
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> boolArgHandle = v8Boolean(boolArg, m_scriptState->isolate());
v8::Local<v8::Value> argv[] = { boolArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 1, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 1,
+ argv,
+ isolate);
}
void V8TestCallbackInterface::voidMethodSequenceArg(const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) {
@@ -84,11 +108,19 @@ void V8TestCallbackInterface::voidMethodSequenceArg(const HeapVector<Member<Test
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> sequenceArgHandle = ToV8(sequenceArg, m_scriptState->context()->Global(), m_scriptState->isolate());
v8::Local<v8::Value> argv[] = { sequenceArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 1, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 1,
+ argv,
+ isolate);
}
void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) {
@@ -98,11 +130,19 @@ void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) {
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> floatArgHandle = v8::Number::New(m_scriptState->isolate(), floatArg);
v8::Local<v8::Value> argv[] = { floatArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 1, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 1,
+ argv,
+ isolate);
}
void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty* testInterfaceEmptyArg) {
@@ -112,11 +152,19 @@ void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> testInterfaceEmptyArgHandle = ToV8(testInterfaceEmptyArg, m_scriptState->context()->Global(), m_scriptState->isolate());
v8::Local<v8::Value> argv[] = { testInterfaceEmptyArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 1, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 1,
+ argv,
+ isolate);
}
void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) {
@@ -126,12 +174,20 @@ void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfac
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
+
v8::Local<v8::Value> testInterfaceEmptyArgHandle = ToV8(testInterfaceEmptyArg, m_scriptState->context()->Global(), m_scriptState->isolate());
v8::Local<v8::Value> stringArgHandle = v8String(m_scriptState->isolate(), stringArg);
v8::Local<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), v8::Undefined(m_scriptState->isolate()), 2, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ v8::Undefined(isolate),
+ 2,
+ argv,
+ isolate);
}
void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptValue thisValue, const String& stringArg) {
@@ -141,12 +197,20 @@ void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptVal
return;
if (!m_scriptState->contextIsValid())
return;
+
ScriptState::Scope scope(m_scriptState.get());
v8::Local<v8::Value> thisHandle = thisValue.v8Value();
+
v8::Local<v8::Value> stringArgHandle = v8String(m_scriptState->isolate(), stringArg);
v8::Local<v8::Value> argv[] = { stringArgHandle };
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), thisHandle, 1, argv, m_scriptState->isolate());
+ v8::Isolate* isolate = m_scriptState->isolate();
+ V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ m_scriptState->getExecutionContext(),
+ thisHandle,
+ 1,
+ argv,
+ isolate);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackInterface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698