From e8d075f653800f27202d8acda969c51de5ba62fc Mon Sep 17 00:00:00 2001 From: YermekG Date: Sun, 10 Mar 2024 01:14:29 +1300 Subject: [PATCH] fix: fixed browser closure - added cef log - disabled rasterizer --- Source/Blu/Private/Blu.cpp | 9 ++++++--- Source/Blu/Private/BluEye.cpp | 13 +++---------- Source/Blu/Private/BluManager.cpp | 3 ++- Source/Blu/Public/RenderHandler.h | 1 - 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Source/Blu/Private/Blu.cpp b/Source/Blu/Private/Blu.cpp index 0a61a53..6897a53 100644 --- a/Source/Blu/Private/Blu.cpp +++ b/Source/Blu/Private/Blu.cpp @@ -9,12 +9,14 @@ class FBlu : public IBlu { CefString GameDirCef = *FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "BluCache"); FString ExecutablePath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Plugins/BLUI/ThirdParty/cef/"); + CefString CefLogPath = *FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Saved/Logs/blui_cef.log"); // Setup the default settings for BluManager BluManager::Settings.windowless_rendering_enabled = true; BluManager::Settings.no_sandbox = true; - //BluManager::Settings.remote_debugging_port = 7777; BluManager::Settings.uncaught_exception_stack_size = 5; + BluManager::Settings.multi_threaded_message_loop = false; + BluManager::Settings.log_severity = LOGSEVERITY_ERROR; #if PLATFORM_LINUX ExecutablePath = "./blu_ue4_process"; @@ -30,9 +32,10 @@ class FBlu : public IBlu // Set the sub-process path CefString(&BluManager::Settings.browser_subprocess_path).FromString(realExePath); - // Set the cache path CefString(&BluManager::Settings.cache_path).FromString(GameDirCef); + // Cef logs + CefString(&BluManager::Settings.log_file).FromString(CefLogPath); // Make a new manager instance CefRefPtr BluApp = new BluManager(); @@ -46,7 +49,7 @@ class FBlu : public IBlu virtual void ShutdownModule() override { UE_LOG(LogBlu, Log, TEXT(" STATUS: Shutdown")); - //CefShutdown(); + CefShutdown(); } }; diff --git a/Source/Blu/Private/BluEye.cpp b/Source/Blu/Private/BluEye.cpp index 1d392da..22c1c86 100644 --- a/Source/Blu/Private/BluEye.cpp +++ b/Source/Blu/Private/BluEye.cpp @@ -12,7 +12,7 @@ FBluEyeSettings::FBluEyeSettings() Height = 720; bIsTransparent = false; - bEnableWebGL = true; + bEnableWebGL = false; bAudioMuted = false; bAutoPlayEnabled = true; } @@ -773,16 +773,9 @@ void UBluEye::BeginDestroy() { if (Browser) { - // Close up the browser - Browser->GetHost()->SetAudioMuted(true); - Browser->GetMainFrame()->LoadURL("about:blank"); - //browser->GetMainFrame()->Delete(); - Browser->GetHost()->CloseDevTools(); - Browser->GetHost()->CloseBrowser(true); + Browser->GetHost()->TryCloseBrowser(); Browser = nullptr; - - - UE_LOG(LogBlu, Warning, TEXT("Browser Closing")); + UE_LOG(LogBlu, Log, TEXT("Browser Closing")); } DestroyTexture(); diff --git a/Source/Blu/Private/BluManager.cpp b/Source/Blu/Private/BluManager.cpp index e7b03d5..ab55efd 100644 --- a/Source/Blu/Private/BluManager.cpp +++ b/Source/Blu/Private/BluManager.cpp @@ -14,7 +14,7 @@ void BluManager::OnBeforeCommandLineProcessing(const CefString& process_type, * If set to "true": CEF will use less CPU, but rendering performance will be lower. CSS3 and WebGL are not be usable * If set to "false": CEF will use more CPU, but rendering will be better, CSS3 and WebGL will also be usable */ - BluManager::CPURenderSettings = false; + BluManager::CPURenderSettings = true; ///////////////// CommandLine->AppendSwitch("off-screen-rendering-enabled"); @@ -25,6 +25,7 @@ void BluManager::OnBeforeCommandLineProcessing(const CefString& process_type, // Should we use the render settings that use less CPU? if (CPURenderSettings) { + CommandLine->AppendSwitch("disable-software-rasterizer"); CommandLine->AppendSwitch("disable-gpu"); CommandLine->AppendSwitch("disable-gpu-compositing"); CommandLine->AppendSwitch("enable-begin-frame-scheduling"); diff --git a/Source/Blu/Public/RenderHandler.h b/Source/Blu/Public/RenderHandler.h index fead069..c0c01e2 100644 --- a/Source/Blu/Public/RenderHandler.h +++ b/Source/Blu/Public/RenderHandler.h @@ -40,7 +40,6 @@ class BrowserClient : public CefClient, public CefLifeSpanHandler, public CefDow // For lifespan CefRefPtr BrowserRef; int BrowserId; - bool bIsClosing; public: BrowserClient(RenderHandler* InRenderHandler) : RenderHandlerRef(InRenderHandler)