RuntimeStateBroadcastRequested
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "RuntimeUpdateController.h"
|
||||
|
||||
#include "RenderEngine.h"
|
||||
#include "RuntimeEventDispatcher.h"
|
||||
#include "RuntimeServices.h"
|
||||
#include "RuntimeStore.h"
|
||||
#include "ShaderBuildQueue.h"
|
||||
@@ -24,6 +25,9 @@ RuntimeUpdateController::RuntimeUpdateController(
|
||||
mShaderBuildQueue(shaderBuildQueue),
|
||||
mVideoBackend(videoBackend)
|
||||
{
|
||||
mRuntimeEventDispatcher.Subscribe(
|
||||
RuntimeEventType::RuntimeStateBroadcastRequested,
|
||||
[this](const RuntimeEvent& event) { HandleRuntimeStateBroadcastRequested(event); });
|
||||
}
|
||||
|
||||
bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResult& result, std::string* error)
|
||||
@@ -62,6 +66,8 @@ bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordin
|
||||
|
||||
bool RuntimeUpdateController::ProcessRuntimeWork()
|
||||
{
|
||||
mRuntimeEventDispatcher.DispatchPending();
|
||||
|
||||
bool shaderBuildRequested = false;
|
||||
std::vector<RuntimeCoordinatorServiceResult> serviceResults;
|
||||
mRuntimeServices.ConsumeRuntimeCoordinatorResults(serviceResults);
|
||||
@@ -101,5 +107,19 @@ void RuntimeUpdateController::RequestShaderBuild()
|
||||
|
||||
void RuntimeUpdateController::BroadcastRuntimeState()
|
||||
{
|
||||
RuntimeStateBroadcastRequestedEvent event;
|
||||
event.reason = "runtime-state-changed";
|
||||
if (!mRuntimeEventDispatcher.PublishPayload(event, "RuntimeUpdateController"))
|
||||
{
|
||||
mRuntimeServices.BroadcastState();
|
||||
return;
|
||||
}
|
||||
|
||||
mRuntimeEventDispatcher.DispatchPending();
|
||||
}
|
||||
|
||||
void RuntimeUpdateController::HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event)
|
||||
{
|
||||
(void)event;
|
||||
mRuntimeServices.BroadcastState();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
|
||||
class RenderEngine;
|
||||
struct RuntimeEvent;
|
||||
class RuntimeEventDispatcher;
|
||||
class RuntimeServices;
|
||||
class RuntimeStore;
|
||||
@@ -29,6 +30,8 @@ public:
|
||||
void BroadcastRuntimeState();
|
||||
|
||||
private:
|
||||
void HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event);
|
||||
|
||||
RuntimeStore& mRuntimeStore;
|
||||
RuntimeCoordinator& mRuntimeCoordinator;
|
||||
RuntimeEventDispatcher& mRuntimeEventDispatcher;
|
||||
|
||||
Reference in New Issue
Block a user