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

Unified Diff: Source/bindings/v8/V8Callback.cpp

Issue 111603006: Simplify invokeCallback() and support void return values for IDL callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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/v8/V8Callback.cpp
diff --git a/Source/bindings/v8/V8Callback.cpp b/Source/bindings/v8/V8Callback.cpp
index 4c5308c11c5a815b0f7c2dae073b610bbb3cbc68..ef56f45fcbc49881ac8e57e0de5b68f8deaa8044 100644
--- a/Source/bindings/v8/V8Callback.cpp
+++ b/Source/bindings/v8/V8Callback.cpp
@@ -36,33 +36,17 @@
namespace WebCore {
-bool invokeCallback(v8::Handle<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ExecutionContext* executionContext, v8::Isolate* isolate)
+bool invokeCallback(v8::Local<v8::Function> callback, int argc, v8::Handle<v8::Value> argv[], ExecutionContext* executionContext, v8::Isolate* isolate)
{
- return invokeCallback(callback, isolate->GetCurrentContext()->Global(), argc, argv, callbackReturnValue, executionContext, isolate);
+ return invokeCallback(callback, isolate->GetCurrentContext()->Global(), argc, argv, executionContext, isolate);
}
-bool invokeCallback(v8::Handle<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ExecutionContext* executionContext, v8::Isolate* isolate)
+bool invokeCallback(v8::Local<v8::Function> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], ExecutionContext* executionContext, v8::Isolate* isolate)
{
v8::TryCatch exceptionCatcher;
exceptionCatcher.SetVerbose(true);
-
- v8::Local<v8::Function> callbackFunction;
- if (callback->IsFunction()) {
- callbackFunction = v8::Local<v8::Function>::New(isolate, v8::Handle<v8::Function>::Cast(callback));
- } else if (callback->IsObject()) {
- v8::Local<v8::Value> handleEventFunction = callback->Get(v8AtomicString(isolate, "handleEvent"));
- if (handleEventFunction->IsFunction())
- callbackFunction = v8::Local<v8::Function>::Cast(handleEventFunction);
- } else
- return false;
-
- if (callbackFunction.IsEmpty())
- return false;
-
- v8::Handle<v8::Value> result = ScriptController::callFunction(executionContext, callbackFunction, thisObject, argc, argv, isolate);
-
- callbackReturnValue = !result.IsEmpty() && result->BooleanValue();
- return exceptionCatcher.HasCaught();
+ ScriptController::callFunction(executionContext, callback, thisObject, argc, argv, isolate);
+ return !exceptionCatcher.HasCaught();
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698