Skip to content

Commit

Permalink
fix: fixed browser closure
Browse files Browse the repository at this point in the history
- added cef log
- disabled rasterizer
  • Loading branch information
YermekG committed Mar 10, 2024
1 parent b9e4ea2 commit e8d075f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
9 changes: 6 additions & 3 deletions Source/Blu/Private/Blu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<BluManager> BluApp = new BluManager();
Expand All @@ -46,7 +49,7 @@ class FBlu : public IBlu
virtual void ShutdownModule() override
{
UE_LOG(LogBlu, Log, TEXT(" STATUS: Shutdown"));
//CefShutdown();
CefShutdown();
}

};
Expand Down
13 changes: 3 additions & 10 deletions Source/Blu/Private/BluEye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FBluEyeSettings::FBluEyeSettings()
Height = 720;

bIsTransparent = false;
bEnableWebGL = true;
bEnableWebGL = false;
bAudioMuted = false;
bAutoPlayEnabled = true;
}
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion Source/Blu/Private/BluManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
1 change: 0 additions & 1 deletion Source/Blu/Public/RenderHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class BrowserClient : public CefClient, public CefLifeSpanHandler, public CefDow
// For lifespan
CefRefPtr<CefBrowser> BrowserRef;
int BrowserId;
bool bIsClosing;

public:
BrowserClient(RenderHandler* InRenderHandler) : RenderHandlerRef(InRenderHandler)
Expand Down

0 comments on commit e8d075f

Please sign in to comment.