コード例 #1
0
    public static void NodejsFuncComplete(IntPtr context, int taskStatus, IntPtr result, int resultType)
    {
        CoreCLREmbedding.DebugMessage("NodejsFuncInvokeContext::NodejsFuncComplete (CLR) - Starting");

        GCHandle gcHandle = GCHandle.FromIntPtr(context);
        NodejsFuncInvokeContext actualContext = (NodejsFuncInvokeContext)gcHandle.Target;

        gcHandle.Free();

        V8Type v8ResultType     = (V8Type)resultType;
        object marshalledResult = CoreCLREmbedding.MarshalV8ToCLR(result, v8ResultType);

        CoreCLREmbedding.DebugMessage("NodejsFuncInvokeContext::NodejsFuncComplete (CLR) - Marshalled result data back to the CLR");

        if (taskStatus == (int)TaskStatus.Faulted)
        {
            actualContext.TaskCompletionSource.SetException((Exception)marshalledResult);
            CoreCLREmbedding.DebugMessage("NodejsFuncInvokeContext::NodejsFuncComplete (CLR) - Set the exception received from Node.js: {0}", ((Exception)marshalledResult).Message);
        }

        else
        {
            actualContext.TaskCompletionSource.SetResult(marshalledResult);
            CoreCLREmbedding.DebugMessage("NodejsFuncInvokeContext::NodejsFuncComplete (CLR) - Set result data");
        }

        CoreCLREmbedding.DebugMessage("NodejsFuncInvokeContext::NodejsFuncComplete (CLR) - Finished");
    }
コード例 #2
0
ファイル: nodejsfunc.cs プロジェクト: BlackPearSw/edge
    Task<object> FunctionWrapper(object payload)
    {
        NodejsFuncInvokeContext ctx = new NodejsFuncInvokeContext(this, payload);
        ExecuteActionOnV8Thread(ctx.CallFuncOnV8Thread);

        return ctx.TaskCompletionSource.Task;
    }
コード例 #3
0
    Task <object> FunctionWrapper(object payload)
    {
        NodejsFuncInvokeContext ctx = new NodejsFuncInvokeContext(this, payload);

        ExecuteActionOnV8Thread(ctx.CallFuncOnV8Thread);

        return(ctx.TaskCompletionSource.Task);
    }
コード例 #4
0
ファイル: nodejsfunc.cs プロジェクト: Glidias/edge
    private Task<object> FunctionWrapper(object payload)
    {
        CoreCLREmbedding.DebugMessage("NodejsFunc::FunctionWrapper (CLR) - Started");

        NodejsFuncInvokeContext invokeContext = new NodejsFuncInvokeContext(this, payload);
        invokeContext.CallFunc();

        CoreCLREmbedding.DebugMessage("NodejsFunc::FunctionWrapper (CLR) - Node.js function invoked on the V8 thread, returning the task completion source");

        return invokeContext.TaskCompletionSource.Task;
    }  
コード例 #5
0
    private Task <object> FunctionWrapper(object payload)
    {
        CoreCLREmbedding.DebugMessage("NodejsFunc::FunctionWrapper (CLR) - Started");

        NodejsFuncInvokeContext invokeContext = new NodejsFuncInvokeContext(this, payload);

        invokeContext.CallFunc();

        CoreCLREmbedding.DebugMessage("NodejsFunc::FunctionWrapper (CLR) - Node.js function invoked on the V8 thread, returning the task completion source");

        return(invokeContext.TaskCompletionSource.Task);
    }
コード例 #6
0
 static extern void CallFuncOnV8ThreadInternal(NodejsFuncInvokeContext _this, IntPtr nativeNodejsFunc, object payload);
コード例 #7
0
 static extern void CallFuncOnV8ThreadInternal(NodejsFuncInvokeContext _this, IntPtr nativeNodejsFunc, object payload);