CEFInterfaceBrowserClosureTask.h
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Engine/Source/Runtime/WebBrowser/Private/CEF/CEFBrowserClosureTask.h
#pragma once
#include "CoreMinimal.h"
#if WITH_CEF3
#if PLATFORM_WINDOWS
#include "Windows/AllowWindowsPlatformTypes.h"
#endif
#pragma push_macro("OVERRIDE")
#undef OVERRIDE // cef headers provide their own OVERRIDE macro
THIRD_PARTY_INCLUDES_START
#if PLATFORM_APPLE
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#endif
#include "include/cef_task.h"
THIRD_PARTY_INCLUDES_END
#if PLATFORM_APPLE
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#endif
#pragma pop_macro("OVERRIDE")
#if PLATFORM_LINUX
typedef CefBase CefBaseRefCounted;
#endif
#if PLATFORM_WINDOWS
#include "Windows/HideWindowsPlatformTypes.h"
#endif
// Helper for posting a closure as a task
class FCEFInterfaceBrowserClosureTask
: public CefTask
{
public:
FCEFInterfaceBrowserClosureTask(CefRefPtr<CefBaseRefCounted> InHandle, TFunction<void ()> InClosure)
: Handle(InHandle)
, Closure(InClosure)
{ }
virtual void Execute() override
{
Closure();
}
private:
CefRefPtr<CefBaseRefCounted> Handle; // Used so the handler will not go out of scope before the closure is executed.
TFunction<void ()> Closure;
IMPLEMENT_REFCOUNTING(FCEFInterfaceBrowserClosureTask);
};
#endif /* WITH_CEF3 */