[banshee] [JavaScriptCore] Use JSValue.MarshalArray



commit 9bf6808c47921d6be32054c62916ba8847f9a03f
Author: Aaron Bockover <abockover novell com>
Date:   Tue Nov 30 12:04:10 2010 -0500

    [JavaScriptCore] Use JSValue.MarshalArray

 .../JavaScriptCore/JSFunction.cs                   |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/src/Core/Banshee.WebBrowser/JavaScriptCore/JSFunction.cs b/src/Core/Banshee.WebBrowser/JavaScriptCore/JSFunction.cs
index 767de00..a6e0c37 100644
--- a/src/Core/Banshee.WebBrowser/JavaScriptCore/JSFunction.cs
+++ b/src/Core/Banshee.WebBrowser/JavaScriptCore/JSFunction.cs
@@ -56,18 +56,10 @@ namespace JavaScriptCore
             IntPtr argumentCount, IntPtr arguments, ref IntPtr exception)
         {
             var context = new JSContext (ctx);
-
-            if (handler == null) {
-                return JSValue.NewUndefined (context).Raw;
-            }
-
-            var args = new JSValue[argumentCount.ToInt32 ()];
-
-            for (int i = 0; i < args.Length; i++) {
-                args[i] = new JSValue (context, Marshal.ReadIntPtr (arguments, i * IntPtr.Size));
-            }
-
-            return handler (this, new JSObject (context, thisObject), args).Raw;
+            return handler == null
+                ? JSValue.NewUndefined (context).Raw
+                : handler (this, new JSObject (context, thisObject),
+                    JSValue.MarshalArray (ctx, arguments, argumentCount)).Raw;
         }
     }
 }
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]