internal RenderProcessHandler(CfrApp app, int processId) { App = app; ProcessId = processId; this.OnContextCreated += RenderProcessHandler_OnContextCreated; this.OnBrowserCreated += RenderProcessHandler_OnBrowserCreated; }
internal int RenderProcessStartup() { var remoteProcessId = CfxRemoteCallContext.CurrentContext.ProcessId; _CfrApp = new CfrApp(); _RenderProcessHandler = new RenderProcessHandler(_CfrApp, remoteProcessId); _RenderProcessHandler.OnNewFrame += (e) => { _TaskContextCreatedEventArgs.TrySetResult(new ChromiumFxWebView(e.Browser, Logger)); }; _CfrApp.GetRenderProcessHandler += (s, e) => { try { e.SetReturnValue(_RenderProcessHandler); } catch (Exception ex) { Logger?.Error($"Exception raised during GetRenderProcessHandler SetReturnValue {ex.Message}, loading task is {_TaskContextCreatedEventArgs.Task.Status}"); throw; } }; return(CfrRuntime.ExecuteProcess(_CfrApp)); }
private RenderProcess() { RemoteProcessId = CfxRemoteCallContext.CurrentContext.ProcessId; app = new CfrApp(); processHandler = new RenderProcessHandler(this); app.GetRenderProcessHandler += (s, e) => e.SetReturnValue(processHandler); }
/// <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 CfxRuntimeExecuteProcessRenderProcessCall(); call.application = CfrObject.Unwrap(application); // 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(CfxRemoteCallContext.CurrentContext.connection); return(call.__retval); } catch (CfxException) { return(-2); } }
private int Start() { try { app = new CfrApp(); loadHandler = new CfrLoadHandler(); loadHandler.OnLoadEnd += loadHandler_OnLoadEnd; loadHandler.OnLoadStart += loadHandler_OnLoadStart; renderProcessHandler = new CfrRenderProcessHandler(); renderProcessHandler.GetLoadHandler += (sender, e) => e.SetReturnValue(loadHandler); app.GetRenderProcessHandler += (s, e) => e.SetReturnValue(renderProcessHandler); var retval = CfrRuntime.ExecuteProcess(app); return(retval); } catch { return(0); } }
internal int RenderProcessStartup() { var remoteProcessId = CfxRemoteCallContext.CurrentContext.ProcessId; _CfrApp = new CfrApp(); _RenderProcessHandler = new RenderProcessHandler(_CfrApp, remoteProcessId); _RenderProcessHandler.OnNewFrame += (e) => { _TaskContextCreatedEventArgs.TrySetResult(new ChromiumFxWebView(e.Browser, Logger)); }; _CfrApp.GetRenderProcessHandler += (s, e) => { try { e.SetReturnValue(_RenderProcessHandler); } catch (Exception ex) { Logger?.Error($"Exception raised during GetRenderProcessHandler SetReturnValue {ex.Message}, loading task is {_TaskContextCreatedEventArgs.Task.Status}"); throw; } }; return CfrRuntime.ExecuteProcess(_CfrApp); }