Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Private/CEF/CEFBrowserApp.cpp
Marc Audy 76a4f7dd9e Merge CEF version 84.0.4147 from the //Portal branch directly into the //UE5/EA branch
- The CEF helper process has been renamed from UnrealCEFSubprocess to EpicWebHelper
- Support for accelerated rendering from CEF has been added (using GPU->GPU texture copies). This works for the Standalone renderer in DX11/macOS-OpenGL and in the D3D11 RHI renderer, otherwise falls back to the default CPU texture copy mode. Accelerated paint can be disabled by adding "-nocefaccelpaint" to the commandline.
- Numerous other bug fixes and perf improvements in the CEF code have been added since we last took a version drop

#jira distro-133
#[fyi] wes.fudala

#ushell-cherrypick of 15635368 by alfred.reynolds

[CL 15651276 by Marc Audy in ue5-main branch]
2021-03-09 01:37:10 -04:00

78 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CEF/CEFBrowserApp.h"
#if WITH_CEF3
FCEFBrowserApp::FCEFBrowserApp()
: MessagePumpCountdown(0)
{
}
void FCEFBrowserApp::OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> CommandLine)
{
}
void FCEFBrowserApp::OnBeforeCommandLineProcessing(const CefString& ProcessType, CefRefPtr< CefCommandLine > CommandLine)
{
CommandLine->AppendSwitch("enable-gpu");
CommandLine->AppendSwitch("enable-gpu-compositing");
CommandLine->AppendSwitch("enable-begin-frame-scheduling");
CommandLine->AppendSwitch("disable-pinch"); // the web pages we have don't expect zoom to work right now so disable touchpad pinch zoom
CommandLine->AppendSwitch("disable-gpu-shader-disk-cache"); // Don't create a "GPUCache" directory when cache-path is unspecified.
#if PLATFORM_MAC
CommandLine->AppendSwitch("use-mock-keychain"); // Disable the toolchain prompt on macOS.
#endif
}
void FCEFBrowserApp::OnRenderProcessThreadCreated(CefRefPtr<CefListValue> ExtraInfo)
{
RenderProcessThreadCreatedDelegate.ExecuteIfBound(ExtraInfo);
}
void FCEFBrowserApp::OnScheduleMessagePumpWork(int64 delay_ms)
{
FScopeLock Lock(&MessagePumpCountdownCS);
// As per CEF documentation, if delay_ms is <= 0, then the call to CefDoMessageLoopWork should happen reasonably soon. If delay_ms is > 0, then the call
// to CefDoMessageLoopWork should be scheduled to happen after the specified delay and any currently pending scheduled call should be canceled.
if(delay_ms < 0)
{
delay_ms = 0;
}
MessagePumpCountdown = delay_ms;
}
bool FCEFBrowserApp::TickMessagePump(float DeltaTime, bool bForce)
{
bool bPump = false;
{
FScopeLock Lock(&MessagePumpCountdownCS);
// count down in order to call message pump
if (MessagePumpCountdown >= 0)
{
MessagePumpCountdown -= (DeltaTime * 1000);
if (MessagePumpCountdown <= 0)
{
bPump = true;
}
if (bPump || bForce)
{
// -1 indicates that no countdown is currently happening
MessagePumpCountdown = -1;
}
}
}
if (bPump || bForce)
{
CefDoMessageLoopWork();
return true;
}
return false;
}
#endif