Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        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
        }
Ejemplo n.º 3
0
        public void Action()
        {
            IntPtr resultInfo = PuertsDLL.InvokeJSFunction(nativeJsFuncPtr, false);

            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr);
                throw new Exception(exceptionInfo);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
 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);
         }
     });
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        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
        }
Ejemplo n.º 12
0
        public void Action <T1, T2, T3>(T1 p1, T2 p2, T3 p3)
        {
#if THREAD_SAFE
            lock (jsEnv) {
#endif
            jsEnv.CheckLiveness();
            IntPtr resultInfo = InvokeJSFunction(
                jsEnv, nativeJsFuncPtr, 3, false,
                (IntPtr isolate, int envIdx, IntPtr nativeJsFuncPtr) => {
                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);
            }
                );
            if (resultInfo == IntPtr.Zero)
            {
                string exceptionInfo = PuertsDLL.GetFunctionLastExceptionInfo(nativeJsFuncPtr);
                throw new Exception(exceptionInfo);
            }
#if THREAD_SAFE
        }
#endif
        }
Ejemplo n.º 13
0
        public TResult Func <TResult>()
        {
#if THREAD_SAFE
            lock (jsEnv) {
#endif
            jsEnv.CheckLiveness();
            IntPtr resultInfo = InvokeJSFunction(
                jsEnv, nativeJsFuncPtr, 0, true,
                (IntPtr isolate, int envIdx, IntPtr nativeJsFuncPtr) => {}
                );
            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
        }