Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Private/WebBrowserModule.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

90 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "WebBrowserModule.h"
#include "WebBrowserLog.h"
#include "WebBrowserSingleton.h"
#include "Misc/App.h"
#include "Misc/EngineVersion.h"
#if WITH_CEF3
# include "CEF3Utils.h"
#endif
DEFINE_LOG_CATEGORY(LogWebBrowser);
static FWebBrowserSingleton* WebBrowserSingleton = nullptr;
FWebBrowserInitSettings::FWebBrowserInitSettings()
: ProductVersion(FString::Printf(TEXT("%s/%s UnrealEngine/%s Chrome/84.0.4147.38"), FApp::GetProjectName(), FApp::GetBuildVersion(), *FEngineVersion::Current().ToString()))
{
}
class FWebBrowserModule : public IWebBrowserModule
{
private:
// IModuleInterface Interface
virtual void StartupModule() override;
virtual void ShutdownModule() override;
public:
virtual bool IsWebModuleAvailable() const override;
virtual IWebBrowserSingleton* GetSingleton() override;
virtual bool CustomInitialize(const FWebBrowserInitSettings& WebBrowserInitSettings) override;
private:
#if WITH_CEF3
bool bLoadedCEFModule = false;
#endif
};
IMPLEMENT_MODULE( FWebBrowserModule, WebBrowser );
void FWebBrowserModule::StartupModule()
{
#if WITH_CEF3
bLoadedCEFModule = CEF3Utils::LoadCEF3Modules(true);
#endif
}
void FWebBrowserModule::ShutdownModule()
{
if (WebBrowserSingleton != nullptr)
{
delete WebBrowserSingleton;
WebBrowserSingleton = nullptr;
}
#if WITH_CEF3
CEF3Utils::UnloadCEF3Modules();
#endif
}
bool FWebBrowserModule::CustomInitialize(const FWebBrowserInitSettings& WebBrowserInitSettings)
{
if (WebBrowserSingleton == nullptr)
{
WebBrowserSingleton = new FWebBrowserSingleton(WebBrowserInitSettings);
return true;
}
return false;
}
IWebBrowserSingleton* FWebBrowserModule::GetSingleton()
{
if (WebBrowserSingleton == nullptr)
{
WebBrowserSingleton = new FWebBrowserSingleton(FWebBrowserInitSettings());
}
return WebBrowserSingleton;
}
bool FWebBrowserModule::IsWebModuleAvailable() const
{
#if WITH_CEF3
return bLoadedCEFModule;
#else
return true;
#endif
}