Files
UnrealEngineUWP/Engine/Source/Programs/UnrealCEFSubProcess/Private/UnrealCEFSubProcessCallbackRegistry.h
Ryan Durand 74c879d5f3 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870960 by Ryan Durand in Main branch]
2019-12-26 23:06:02 -05:00

47 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Misc/Guid.h"
#include "UnrealCEFSubProcess.h"
#if WITH_CEF3
/** Represents information about a JS function that can be called from the browser process.
*/
struct FUnrealCEFSubProcessCallbackRegistryEntry
{
FUnrealCEFSubProcessCallbackRegistryEntry(CefRefPtr<CefV8Context> InContext, CefRefPtr<CefV8Value> InObject, CefRefPtr<CefV8Value> InFunction, CefRefPtr<CefV8Value> InOnError, bool bInOneShot)
: Context(InContext)
, Object(InObject)
, Function(InFunction)
, OnError(InOnError)
, bOneShot(bInOneShot)
{}
CefRefPtr<CefV8Context> Context;
CefRefPtr<CefV8Value> Object;
CefRefPtr<CefV8Value> Function;
CefRefPtr<CefV8Value> OnError;
bool bOneShot;
};
class FUnrealCEFSubProcessCallbackRegistry : public TMap<FGuid, FUnrealCEFSubProcessCallbackRegistryEntry>
{
public:
/**
* Looks for a matching entry in the registry or adds a new one, returning its Id.
* A matching entry must have the same Context, Object, Function and OnError object. One-shot callbacks will always result in a new entry , even if there is an exact match.
*/
FGuid FindOrAdd(CefRefPtr<CefV8Context> Context, CefRefPtr<CefV8Value> Object, CefRefPtr<CefV8Value> Function, CefRefPtr<CefV8Value> OnError=nullptr, bool bOneShot=false);
/**
* Deletes all entries that have a matching context.
*/
void RemoveByContext(CefRefPtr<CefV8Context> Context);
};
#endif