WPF/OffScreen - Initialize Cef with WindowlessRendering enabled by default

Suggestion is this is now required to be set

https://github.com/cefsharp/CefSharp/issues/2431
This commit is contained in:
amaitland
2018-06-27 18:57:11 +10:00
parent 72c1babab9
commit 2da7df0379
2 changed files with 17 additions and 5 deletions
+8 -2
View File
@@ -278,9 +278,15 @@ namespace CefSharp.OffScreen
public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
{
if (!Cef.IsInitialized && !Cef.Initialize())
if (!Cef.IsInitialized)
{
throw new InvalidOperationException("Cef::Initialize() failed");
var settings = new CefSettings();
settings.WindowlessRenderingEnabled = true;
if (!Cef.Initialize(settings))
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
}
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
+9 -3
View File
@@ -433,11 +433,17 @@ namespace CefSharp.Wpf
private void NoInliningConstructor()
{
//Initialize CEF if it hasn't already been initialized
if (!Cef.IsInitialized && !Cef.Initialize())
if (!Cef.IsInitialized)
{
throw new InvalidOperationException("Cef::Initialize() failed");
var settings = new CefSettings();
settings.WindowlessRenderingEnabled = true;
if (!Cef.Initialize(settings))
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
}
//Add this ChromiumWebBrowser instance to a list of IDisposable objects
// that if still alive at the time Cef.Shutdown is called will be disposed of
// It's important all browser instances be freed before Cef.Shutdown is called.