protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { if (commandLine.HasSwitch(CmdAssemblySearchPathSwitch)) { var searchPath = commandLine.GetSwitchValue(CmdAssemblySearchPathSwitch); AppDomain.CurrentDomain.AssemblyResolve += (sender, resolveEventArgs) => { var assemblyName = new AssemblyName(resolveEventArgs.Name); var assemblyFileName = assemblyName.Name + ".dll"; var assemblyLocation = Path.Combine(searchPath, assemblyFileName); if (File.Exists(assemblyLocation)) { return(Assembly.LoadFrom(assemblyLocation)); } return(null); }; } if (string.IsNullOrEmpty(processType)) { // Taken from: https://bitbucket.org/chromiumembedded/cef/commits/e3c1d8632eb43c1c2793d71639f3f5695696a5e8 // If the PDF extension is enabled then cc Surfaces must be disabled for // PDFs to render correctly. // See https://bitbucket.org/chromiumembedded/cef/issues/1689 for details. if (!commandLine.HasSwitch("disable-extensions") && !commandLine.HasSwitch("disable-pdf-extension")) { commandLine.AppendSwitch("disable-surfaces"); } // Use software rendering and compositing (disable GPU) for increased FPS // and decreased CPU usage. This will also disable WebGL so remove these // switches if you need that capability. // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details. if (!commandLine.HasSwitch("enable-gpu")) { commandLine.AppendSwitch("disable-gpu"); commandLine.AppendSwitch("disable-gpu-compositing"); } // Synchronize the frame rate between all processes. This results in // decreased CPU usage by avoiding the generation of extra frames that // would otherwise be discarded. The frame rate can be set at browser // creation time via CefBrowserSettings.windowless_frame_rate or changed // dynamically using CefBrowserHost::SetWindowlessFrameRate. In cefclient // it can be set via the command-line using `--off-screen-frame-rate=XX`. // See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details. commandLine.AppendSwitch("enable-begin-frame-scheduling"); //commandLine.AppendSwitch("disable-smooth-scrolling"); commandLine.AppendSwitch("enable-system-flash"); } base.OnBeforeCommandLineProcessing(processType, commandLine); }
protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine) { if (commandLine.GetSwitchValue("type").StartsWith("render")) { if (_disableSpellChecking) { commandLine.AppendArgument("--disable-spell-checking"); } else if (!string.IsNullOrEmpty(_spellCheckLanguage) && !_spellCheckLanguage.Equals("en-US")) { commandLine.AppendArgument(string.Format("--override-spell-check-lang={0}", _spellCheckLanguage)); } } base.OnBeforeChildProcessLaunch(commandLine); }
protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { if (commandLine.HasSwitch(CmdAssemblySearchPathSwitch)) { var searchPath = commandLine.GetSwitchValue(CmdAssemblySearchPathSwitch); AppDomain.CurrentDomain.AssemblyResolve += (sender, resolveEventArgs) => { var assemblyName = new AssemblyName(resolveEventArgs.Name); var assemblyFileName = assemblyName.Name + ".dll"; var assemblyLocation = Path.Combine(searchPath, assemblyFileName); if (File.Exists(assemblyLocation)) { return(Assembly.LoadFrom(assemblyLocation)); } return(null); }; } base.OnBeforeCommandLineProcessing(processType, commandLine); }