Files
UnrealEngineUWP/Engine/Plugins/Web/WebAPI/Source/WebAPILiquidJS/Private/WebAPILiquidJSProcess.h
George Rolfe e54c69d811 WebAPI re-submit
#rb simon.therriault
#jira UETOOL-4463
#preflight 62424a85c61d8a458f223a59

[CL 19540648 by George Rolfe in ue5-main branch]
2022-03-29 08:43:59 -04:00

59 lines
1.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include <atomic>
#include "Containers/UnrealString.h"
#include "HAL/PlatformProcess.h"
#include "HAL/Runnable.h"
#include "HAL/RunnableThread.h"
#include "Misc/AsyncTaskNotification.h"
class FWebAPILiquidJSProcess : private FRunnable
{
public:
enum class EStatus : uint8
{
Stopped = 0,
Error = 1,
Launching = 2,
Running = 3,
};
public:
FWebAPILiquidJSProcess();
virtual ~FWebAPILiquidJSProcess();
/** Starts the webapp external process, first launch will take some time as it needs to compile the webapp */
bool TryStart();
/** Shutdown the webapp external process */
void Shutdown();
/** Get the webapp's status. */
EStatus GetStatus() const;
/** Enable / disable external logger */
void SetExternalLoggerEnabled(bool bEnableExternalLog) const;
protected:
virtual uint32 Run() override;
private:
/** Plugin root folder */
FString Root;
/** WebApp Node.js process handle */
FProcHandle Process;
/** Thread for WebApp node.js process (read stdout and forward to log) */
FRunnableThread* Thread = nullptr;
/** Progress notification */
TUniquePtr<FAsyncTaskNotification> TaskNotification;
/** The current status of the web app. */
std::atomic<EStatus> Status;
};