CEFInterfaceBrowserClosureTask.h 722 B

123456789101112131415161718192021222324252627282930313233
  1. // Engine/Source/Runtime/WebBrowser/Private/CEF/CEFBrowserClosureTask.h
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #if WITH_CEF3
  5. #include "CEFInterfaceLibCefIncludes.h"
  6. // Helper for posting a closure as a task
  7. class FCEFInterfaceBrowserClosureTask
  8. : public CefTask
  9. {
  10. public:
  11. FCEFInterfaceBrowserClosureTask(CefRefPtr<CefBaseRefCounted> InHandle, TFunction<void ()> InClosure)
  12. : Handle(InHandle)
  13. , Closure(InClosure)
  14. { }
  15. virtual void Execute() override
  16. {
  17. Closure();
  18. }
  19. private:
  20. CefRefPtr<CefBaseRefCounted> Handle; // Used so the handler will not go out of scope before the closure is executed.
  21. TFunction<void ()> Closure;
  22. IMPLEMENT_REFCOUNTING(FCEFInterfaceBrowserClosureTask);
  23. };
  24. #endif /* WITH_CEF3 */