Refactor new editor boundaries and test ownership
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
|
||||
#include <XCEngine/Core/Asset/ResourceManager.h>
|
||||
|
||||
#include "State/EditorContext.h"
|
||||
#include "Ports/SystemInteractionPort.h"
|
||||
#include "Composition/EditorContext.h"
|
||||
#include "Platform/Win32/EditorWindow.h"
|
||||
#include "Platform/Win32/EditorWindowManager.h"
|
||||
#include "Internal/EnvironmentFlags.h"
|
||||
#include "Platform/Win32/Win32SystemInteractionHost.h"
|
||||
#include "Internal/ExecutablePath.h"
|
||||
|
||||
#ifndef XCUIEDITOR_REPO_ROOT
|
||||
@@ -24,7 +25,6 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
m_hInstance = hInstance;
|
||||
m_repoRoot = ResolveRepoRootPath();
|
||||
EnableDpiAwareness();
|
||||
InitializeSmokeTestConfig();
|
||||
|
||||
const std::filesystem::path logRoot = GetExecutableDirectory() / "logs";
|
||||
InitializeUIEditorRuntimeTrace(logRoot);
|
||||
@@ -41,6 +41,9 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_systemInteractionHost = std::make_unique<Host::Win32SystemInteractionHost>();
|
||||
m_editorContext->SetSystemInteractionHost(m_systemInteractionHost.get());
|
||||
|
||||
App::EditorWindowHostConfig hostConfig = {};
|
||||
hostConfig.hInstance = m_hInstance;
|
||||
hostConfig.windowClassName = kWindowClassName;
|
||||
@@ -70,7 +73,7 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
createParams.title = kWindowTitle;
|
||||
createParams.showCommand = nCmdShow;
|
||||
createParams.primary = true;
|
||||
createParams.autoCaptureOnStartup = !m_smokeTestEnabled;
|
||||
createParams.autoCaptureOnStartup = true;
|
||||
if (m_windowManager->CreateEditorWindow(
|
||||
m_editorContext->BuildWorkspaceController(),
|
||||
createParams) == nullptr) {
|
||||
@@ -82,28 +85,6 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::InitializeSmokeTestConfig() {
|
||||
m_smokeTestEnabled = App::Internal::IsEnvironmentFlagEnabled("XCUIEDITOR_SMOKE_TEST");
|
||||
m_smokeTestFrameLimit = 0;
|
||||
m_smokeTestRenderedFrames = 0;
|
||||
m_smokeTestCloseRequested = false;
|
||||
if (!m_smokeTestEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr int kDefaultSmokeFrameLimit = 4;
|
||||
const std::optional<int> frameLimit =
|
||||
App::Internal::TryGetEnvironmentInt("XCUIEDITOR_SMOKE_TEST_FRAME_LIMIT");
|
||||
m_smokeTestFrameLimit =
|
||||
frameLimit.has_value() && frameLimit.value() > 0
|
||||
? frameLimit.value()
|
||||
: kDefaultSmokeFrameLimit;
|
||||
|
||||
AppendUIEditorRuntimeTrace(
|
||||
"smoke",
|
||||
"enabled with frame limit=" + std::to_string(m_smokeTestFrameLimit));
|
||||
}
|
||||
|
||||
void Application::Shutdown() {
|
||||
AppendUIEditorRuntimeTrace("app", "shutdown begin");
|
||||
|
||||
@@ -112,6 +93,11 @@ void Application::Shutdown() {
|
||||
m_windowManager.reset();
|
||||
}
|
||||
|
||||
if (m_editorContext != nullptr) {
|
||||
m_editorContext->SetSystemInteractionHost(nullptr);
|
||||
}
|
||||
m_systemInteractionHost.reset();
|
||||
|
||||
::XCEngine::Resources::ResourceManager::Get().Shutdown();
|
||||
|
||||
if (m_windowClassAtom != 0 && m_hInstance != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user