Skip to content

Commit

Permalink
WPF/OffScreen - Initialize Cef with WindowlessRendering enabled by de…
Browse files Browse the repository at this point in the history
…fault

Suggestion is this is now required to be set

#2431
  • Loading branch information
amaitland committed Jun 27, 2018
1 parent 72c1bab commit 2da7df0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions CefSharp.OffScreen/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,15 @@ public class ChromiumWebBrowser : IRenderWebBrowser
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();
Expand Down
12 changes: 9 additions & 3 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,17 @@ public ChromiumWebBrowser()
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.
Expand Down

0 comments on commit 2da7df0

Please sign in to comment.