Files
UnrealEngine/Engine/Source/Runtime/WebBrowser/Private/CEF/CEFBrowserApp.h
2025-05-18 13:04:45 +08:00

51 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Misc/ScopeLock.h"
#if WITH_CEF3
#include "CEFLibCefIncludes.h"
DECLARE_LOG_CATEGORY_EXTERN(LogCEFBrowser, Log, All);
/**
* Implements CEF App and other Process level interfaces
*/
class FCEFBrowserApp : public CefApp,
public CefBrowserProcessHandler
{
public:
/**
* Default Constructor
*/
FCEFBrowserApp();
/** Used to pump the CEF message loop whenever OnScheduleMessagePumpWork is triggered */
bool TickMessagePump(float DeltaTime, bool bForce);
private:
// CefApp methods.
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override { return this; }
virtual void OnBeforeCommandLineProcessing(const CefString& ProcessType, CefRefPtr< CefCommandLine > CommandLine) override;
// CefBrowserProcessHandler methods:
virtual void OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> CommandLine) override;
#if CEF_VERSION_MAJOR < 128
virtual void OnScheduleMessagePumpWork(int64 delay_ms) override;
#else
virtual void OnScheduleMessagePumpWork(int64_t delay_ms) override;
#endif
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(FCEFBrowserApp);
// Lock for access MessagePumpCountdown
FCriticalSection MessagePumpCountdownCS;
// Countdown in milliseconds until CefDoMessageLoopWork is called. Updated by OnScheduleMessagePumpWork
int64 MessagePumpCountdown;
};
#endif