internal static int RenderProcessMain() { try { var rp = new RenderProcess(); ChromiumStartup.RaiseRemoteProcessCreated(rp.processHandler); return(rp.RemoteMain()); } catch (CfxRemotingException) { return(-1); } }
void RenderProcessHandler_OnContextCreated(object sender, CfrOnContextCreatedEventArgs e) { var wb = ChromiumStartup.GetBrowser(e.Browser.Identifier); if (wb != null) { //if (e.Frame.IsMain) //{ // SetProperties(e.Context, wb.GlobalObject); // //e.Frame.ExecuteJavaScript(Properties.Resources.ResourceManager.ini, e.Frame.Url, 0); //} //else //{ // //JSObject obj; // //if (wb.FrameGlobalObjects.TryGetValue(e.Frame.Name, out obj)) // //{ // // SetProperties(e.Context, obj); // //} //} wb.RaiseOnV8ContextCreated(e); } }
void RenderProcessHandler_OnBrowserCreated(object sender, CfrOnBrowserCreatedEventArgs e) { var id = e.Browser.Identifier; var wb = ChromiumStartup.GetBrowser(id); if (wb != null) { var rp = wb.remoteProcess; if (rp != null && rp != this.remoteProcess) { // A new process has been created for the browser. // The old process is still alive, but probably it gets // killed soon after this callback returns. // So we suspend all callbacks from the old process. // If there are currently executing callbacks, // this call will block until they are finished. // When this call returns, it should be safe to // continue execution and let the old process die. CfxRemoteCallbackManager.SuspendCallbacks(rp.RemoteProcessId); } //wb.SetRemoteBrowser(e.Browser, remoteProcess); } }