/// <summary> /// This function should be called from the render process startup callback /// provided to CfxRuntime.Initialize() in the browser process. It will /// call into the render process passing in the provided |application| /// object and block until the render process exits. /// The |application| object will receive CEF framework callbacks /// from within the render process. /// </summary> public static int ExecuteProcess(CfrApp application) { var call = new CfxRuntimeExecuteProcessRemoteCall(); call.application = CfrObject.Unwrap(application).ptr; // Looks like this almost never returns with a value // from the call into the render process. Probably the // IPC connection doesn't get a chance to send over the // return value from CfxRuntime.ExecuteProcess() when the // render process exits. So we don't throw an exception but // use a return value of -2 to indicate connection lost. try { call.RequestExecution(); return(call.__retval); } catch (CfxException) { return(-2); } }
internal static CfrApp Wrap(IntPtr proxyId) { if (proxyId == IntPtr.Zero) { return(null); } var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock (weakCache) { var cfrObj = (CfrApp)weakCache.Get(proxyId); if (cfrObj == null) { cfrObj = new CfrApp(proxyId); weakCache.Add(proxyId, cfrObj); } return(cfrObj); } }
internal static CfrApp Wrap(RemotePtr remotePtr) { if (remotePtr == RemotePtr.Zero) { return(null); } var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock (weakCache) { var cfrObj = (CfrApp)weakCache.Get(remotePtr.ptr); if (cfrObj == null) { cfrObj = new CfrApp(remotePtr); weakCache.Add(remotePtr.ptr, cfrObj); } return(cfrObj); } }