public void Dispose()
        {
            Stop();

            process.Dispose();
            ipc.Dispose();
        }
Exemple #2
0
        private static void Run(RenderProcessArguments args)
        {
            waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset, args.KeepAliveHandleName);

            // Boot up a thread to make sure we shut down if parent dies
            parentWatchThread = new Thread(WatchParentStatus);
            parentWatchThread.Start(args.ParentPid);

#if DEBUG
            AppDomain.CurrentDomain.FirstChanceException += (obj, e) => Console.Error.WriteLine(e.Exception.ToString());
#endif

            var dxRunning = DxHandler.Initialise(args.DxgiAdapterLuid);
            CefHandler.Initialise(cefAssemblyDir, args.CefCacheDir);

            ipcBuffer = new IpcBuffer <DownstreamIpcRequest, UpstreamIpcRequest>(args.IpcChannelName, HandleIpcRequest);

            Console.WriteLine("Notifiying on ready state.");

            // We always support bitmap buffer transport
            var availableTransports = FrameTransportMode.BitmapBuffer;
            if (dxRunning)
            {
                availableTransports |= FrameTransportMode.SharedTexture;
            }

            ipcBuffer.RemoteRequest <object>(new ReadyNotificationRequest()
            {
                availableTransports = availableTransports,
            });

            Console.WriteLine("Waiting...");

            waitHandle.WaitOne();
            waitHandle.Dispose();

            Console.WriteLine("Render process shutting down.");

            ipcBuffer.Dispose();

            DxHandler.Shutdown();
            CefHandler.Shutdown();

            parentWatchThread.Abort();
        }