private static void InitializeCef() { if (CefRuntimeLoader.IsLoaded) { return; } var cefSettings = new CefSettings(); cefSettings.LogSeverity = string.IsNullOrWhiteSpace(LogFile) ? CefLogSeverity.Disable : (EnableErrorLogOnly ? CefLogSeverity.Error : CefLogSeverity.Verbose); cefSettings.LogFile = LogFile; cefSettings.UncaughtExceptionStackSize = 100; // enable stack capture cefSettings.CachePath = CachePath; // enable cache for external resources to speedup loading cefSettings.WindowlessRenderingEnabled = OsrEnabled; cefSettings.RemoteDebuggingPort = GetRemoteDebuggingPort(); var customSchemes = CustomSchemes.Select(s => new CustomScheme() { SchemeName = s, SchemeHandlerFactory = new SchemeHandlerFactory() }).ToArray(); var customFlags = new[] { // disable NetworkService https://bitbucket.org/chromiumembedded/cef/issues/2795/crash-in-openinputstreamwrapper new KeyValuePair <string, string>("disable-features", "NetworkService,VizDisplayCompositor"), // enable experimental feature flags new KeyValuePair <string, string>("enable-experimental-web-platform-features", null) }; CefRuntimeLoader.Initialize(settings: cefSettings, flags: customFlags, customSchemes: customSchemes); AppDomain.CurrentDomain.ProcessExit += delegate { Cleanup(); }; }
public static void Initialize(GlobalSettings settings) { if (CefRuntimeLoader.IsLoaded) { return; } globalSettings = settings; var cefSettings = new CefSettings { LogSeverity = string.IsNullOrWhiteSpace(settings.LogFile) ? CefLogSeverity.Disable : (settings.EnableErrorLogOnly ? CefLogSeverity.Error : CefLogSeverity.Verbose), LogFile = settings.LogFile, UncaughtExceptionStackSize = 100, // enable stack capture CachePath = settings.CachePath, // enable cache for external resources to speedup loading WindowlessRenderingEnabled = settings.OsrEnabled, RemoteDebuggingPort = settings.GetRemoteDebuggingPort(), UserAgent = settings.UserAgent }; var customSchemes = CustomSchemes.Select(s => new CustomScheme() { SchemeName = s, SchemeHandlerFactory = new SchemeHandlerFactory() }).ToArray(); var customFlags = new[] { // enable experimental feature flags new KeyValuePair <string, string>("enable-experimental-web-platform-features", null) }; CefRuntimeLoader.Initialize(settings: cefSettings, flags: customFlags, customSchemes: customSchemes); AppDomain.CurrentDomain.ProcessExit += delegate { Cleanup(); }; }