Title: [129970] trunk/Source/WebCore
Revision
129970
Author
[email protected]
Date
2012-09-28 19:30:16 -0700 (Fri, 28 Sep 2012)

Log Message

Allow any kind of v8::Handle in invokeCallback instead of requiring a v8::Persistent.
https://bugs.webkit.org/show_bug.cgi?id=97956

Patch by Elliott Sprehn <[email protected]> on 2012-09-28
Reviewed by Adam Barth.

Use v8::Handle instead of v8::Persistent for the callback argument on invokeCallback.
There doesn't seem to be any reason for requiring a Persistent, and it makes it harder
to use this API.

This is factored out of http://wkbug.com/93661

No new tests, this is functionally equivalent.

* bindings/v8/V8Callback.cpp:
(WebCore::invokeCallback):
* bindings/v8/V8Callback.h:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129969 => 129970)


--- trunk/Source/WebCore/ChangeLog	2012-09-29 02:18:06 UTC (rev 129969)
+++ trunk/Source/WebCore/ChangeLog	2012-09-29 02:30:16 UTC (rev 129970)
@@ -1,3 +1,23 @@
+2012-09-28  Elliott Sprehn  <[email protected]>
+
+        Allow any kind of v8::Handle in invokeCallback instead of requiring a v8::Persistent.
+        https://bugs.webkit.org/show_bug.cgi?id=97956
+
+        Reviewed by Adam Barth.
+
+        Use v8::Handle instead of v8::Persistent for the callback argument on invokeCallback.
+        There doesn't seem to be any reason for requiring a Persistent, and it makes it harder
+        to use this API.
+
+        This is factored out of http://wkbug.com/93661
+
+        No new tests, this is functionally equivalent.
+
+        * bindings/v8/V8Callback.cpp:
+        (WebCore::invokeCallback):
+        * bindings/v8/V8Callback.h:
+        (WebCore):
+
 2012-09-28  Anders Carlsson  <[email protected]>
 
         Remove support for method overloading from bridge code

Modified: trunk/Source/WebCore/bindings/v8/V8Callback.cpp (129969 => 129970)


--- trunk/Source/WebCore/bindings/v8/V8Callback.cpp	2012-09-29 02:18:06 UTC (rev 129969)
+++ trunk/Source/WebCore/bindings/v8/V8Callback.cpp	2012-09-29 02:30:16 UTC (rev 129970)
@@ -36,19 +36,19 @@
 
 namespace WebCore {
 
-bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
+bool invokeCallback(v8::Handle<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
 {
     return invokeCallback(callback, v8::Context::GetCurrent()->Global(), argc, argv, callbackReturnValue, scriptExecutionContext);
 }
 
-bool invokeCallback(v8::Persistent<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
+bool invokeCallback(v8::Handle<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
 {
     v8::TryCatch exceptionCatcher;
     exceptionCatcher.SetVerbose(true);
 
     v8::Local<v8::Function> callbackFunction;
     if (callback->IsFunction()) {
-        callbackFunction = v8::Local<v8::Function>::New(v8::Persistent<v8::Function>::Cast(callback));
+        callbackFunction = v8::Local<v8::Function>::New(v8::Handle<v8::Function>::Cast(callback));
     } else if (callback->IsObject()) {
         v8::Local<v8::Value> handleEventFunction = callback->Get(v8::String::NewSymbol("handleEvent"));
         if (handleEventFunction->IsFunction())

Modified: trunk/Source/WebCore/bindings/v8/V8Callback.h (129969 => 129970)


--- trunk/Source/WebCore/bindings/v8/V8Callback.h	2012-09-29 02:18:06 UTC (rev 129969)
+++ trunk/Source/WebCore/bindings/v8/V8Callback.h	2012-09-29 02:30:16 UTC (rev 129970)
@@ -39,8 +39,8 @@
 
 class ScriptExecutionContext;
 
-bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*);
-bool invokeCallback(v8::Persistent<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*);
+bool invokeCallback(v8::Handle<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*);
+bool invokeCallback(v8::Handle<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*);
 
 enum CallbackAllowedValueFlag {
     CallbackAllowUndefined = 1,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to