public void Tick() { #if THREAD_SAFE lock (this) { #endif CheckLiveness(); ReleasePendingJSFunctions(); ReleasePendingJSObjects(); if (PuertsDLL.InspectorTick(isolate)) { #if CSHARP_7_3_OR_NEWER if (waitDebugerTaskSource != null) { var tmp = waitDebugerTaskSource; waitDebugerTaskSource = null; tmp.SetResult(true); } #endif } tickHandler.ForEach(fn => { IntPtr resultInfo = PuertsDLL.InvokeJSFunction(fn, false); if (resultInfo == IntPtr.Zero) { var exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(fn); throw new Exception(exceptionInfo); } }); #if THREAD_SAFE } #endif }
public TResult Func <T1, T2, T3, T4, TResult>(T1 p1, T2 p2, T3 p3, T4 p4) { #if THREAD_SAFE lock (jsEnv) { #endif jsEnv.CheckLiveness(); StaticTranslate <T1> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p1); StaticTranslate <T2> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p2); StaticTranslate <T3> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p3); StaticTranslate <T4> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p4); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, true); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } TResult result = StaticTranslate <TResult> .Get(jsEnv.Idx, isolate, NativeValueApi.GetValueFromResult, resultInfo, false); PuertsDLL.ResetResult(resultInfo); return(result); #if THREAD_SAFE } #endif }
public static IntPtr InvokeJSFunction(JsEnv jsEnv, IntPtr nativeJsFuncPtr, int argumentsLength, bool hasResult, PushJSFunctionArgumentsCallback argumentsPusher) { jsEnv.ArgumentsPusher = argumentsPusher; IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, argumentsLength, hasResult); jsEnv.ArgumentsPusher = null; return(resultInfo); }
public void Action() { IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } }
public void Action <T1>(T1 p1) { StaticTranslate <T1> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p1); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } }
public void Tick() { PuertsDLL.InspectorTick(isolate); tickHandler.ForEach(fn => { IntPtr resultInfo = PuertsDLL.InvokeJSFunction(fn, false); if (resultInfo == IntPtr.Zero) { var exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(fn); throw new Exception(exceptionInfo); } }); }
public TResult Func <TResult>() { IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, true); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } TResult result = StaticTranslate <TResult> .Get(jsEnv.Idx, isolate, NativeValueApi.GetValueFromResult, resultInfo, false); PuertsDLL.ResetResult(resultInfo); return(result); }
public void Action() { #if THREAD_SAFE lock (jsEnv) { #endif jsEnv.CheckLiveness(); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } #if THREAD_SAFE } #endif }
public TResult Func <T1, TResult>(T1 p1) { jsEnv.CheckLiveness(); StaticTranslate <T1> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p1); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, true); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } TResult result = StaticTranslate <TResult> .Get(jsEnv.Idx, isolate, NativeValueApi.GetValueFromResult, resultInfo, false); PuertsDLL.ResetResult(resultInfo); return(result); }
public void Action <T1>(T1 p1) { #if THREAD_SAFE lock (jsEnv) { #endif jsEnv.CheckLiveness(); StaticTranslate <T1> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p1); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } #if THREAD_SAFE } #endif }
public void Action <T1, T2, T3, T4>(T1 p1, T2 p2, T3 p3, T4 p4) { jsEnv.CheckLiveness(); StaticTranslate <T1> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p1); StaticTranslate <T2> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p2); StaticTranslate <T3> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p3); StaticTranslate <T4> .Set(jsEnv.Idx, isolate, NativeValueApi.SetValueToArgument, nativeJsFuncPtr, p4); IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false); if (resultInfo == IntPtr.Zero) { string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr); throw new Exception(exceptionInfo); } }
public void Tick() { #if THREAD_SAFE lock (this) { #endif ReleasePendingJSFunctions(); PuertsDLL.InspectorTick(isolate); tickHandler.ForEach(fn => { IntPtr resultInfo = PuertsDLL.InvokeJSFunction(fn, false); if (resultInfo == IntPtr.Zero) { var exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(fn); throw new Exception(exceptionInfo); } }); #if THREAD_SAFE } #endif }