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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp

Issue 2755603003: [Refactor] Update template files for callback functions (Closed)
Patch Set: work for comments 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/modules/VoidCallbackFunctionModules.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/modules/VoidCallbackFunctionModules.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp
index 09c9871fd4b55b8e3277e488cc550f8020338cff..28b9d3729ccba9a9897d31e2d49d2dec3e4492a4 100644
--- a/third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp
@@ -22,7 +22,7 @@
namespace blink {
// static
-VoidCallbackFunctionModules* VoidCallbackFunctionModules::create(ScriptState* scriptState, v8::Local<v8::Value> callback){
+VoidCallbackFunctionModules* VoidCallbackFunctionModules::create(ScriptState* scriptState, v8::Local<v8::Value> callback) {
if (isUndefinedOrNull(callback))
return nullptr;
return new VoidCallbackFunctionModules(scriptState, v8::Local<v8::Function>::Cast(callback));
@@ -34,13 +34,14 @@ VoidCallbackFunctionModules::VoidCallbackFunctionModules(ScriptState* scriptStat
DCHECK(!m_callback.isEmpty());
}
-DEFINE_TRACE(VoidCallbackFunctionModules) {}
-
DEFINE_TRACE_WRAPPERS(VoidCallbackFunctionModules) {
visitor->traceWrappers(m_callback.cast<v8::Value>());
}
bool VoidCallbackFunctionModules::call(ScriptWrappable* scriptWrappable) {
+ if (m_callback.isEmpty())
+ return false;
+
if (!m_scriptState->contextIsValid())
return false;
@@ -49,26 +50,32 @@ bool VoidCallbackFunctionModules::call(ScriptWrappable* scriptWrappable) {
if (context->isContextSuspended() || context->isContextDestroyed())
return false;
- if (m_callback.isEmpty())
- return false;
-
// TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK.
// crbug.com/653769
DummyExceptionStateForTesting exceptionState;
ScriptState::Scope scope(m_scriptState.get());
+ v8::Isolate* isolate = m_scriptState->isolate();
- v8::Local<v8::Value> thisValue = ToV8(scriptWrappable, m_scriptState->context()->Global(), m_scriptState->isolate());
+ v8::Local<v8::Value> thisValue = ToV8(
+ scriptWrappable,
+ m_scriptState->context()->Global(),
+ isolate);
v8::Local<v8::Value> *argv = nullptr;
-
- v8::Local<v8::Value> v8ReturnValue;
- v8::TryCatch exceptionCatcher(m_scriptState->isolate());
+ v8::TryCatch exceptionCatcher(isolate);
exceptionCatcher.SetVerbose(true);
- if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), thisValue, 0, argv, m_scriptState->isolate()).ToLocal(&v8ReturnValue)) {
- return true;
+ v8::Local<v8::Value> v8ReturnValue;
+ if (!V8ScriptRunner::callFunction(m_callback.newLocal(isolate),
+ context,
+ thisValue,
+ 0,
+ argv,
+ isolate).ToLocal(&v8ReturnValue)) {
+ return false;
}
- return false;
+
+ return true;
}
VoidCallbackFunctionModules* NativeValueTraits<VoidCallbackFunctionModules>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698