From e3675d4d75c708f35f8041f493fde2fbfbea55b2 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 25 Mar 2024 22:20:01 +0100 Subject: Add stubs for memory scopes API --- deimos/core/allocator.cpp | 9 +++++++++ deimos/core/allocator.h | 9 +++++++++ deimos/core/api_registry.cpp | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deimos/core/allocator.cpp b/deimos/core/allocator.cpp index f7217c8..642afb8 100644 --- a/deimos/core/allocator.cpp +++ b/deimos/core/allocator.cpp @@ -43,6 +43,15 @@ public: { system = &m_system; } + + Allocator* CreateChild(Allocator* parent, const char* /* description */) override + { + return parent; + } + + void DestroyChild(Allocator*) override + { + } }; AllocatorApi* BootstrapAllocatorApi() diff --git a/deimos/core/allocator.h b/deimos/core/allocator.h index b156620..911f8e7 100644 --- a/deimos/core/allocator.h +++ b/deimos/core/allocator.h @@ -128,9 +128,18 @@ public: class AllocatorApi { public: + AllocatorApi() = default; + + deimos_NO_COPY_MOVE(AllocatorApi); + + virtual ~AllocatorApi() = default; + static constexpr IdName kApiName{"deimos::AllocatorApi"}; Allocator* system{}; + + virtual Allocator* CreateChild(Allocator* parent, const char* description) = 0; + virtual void DestroyChild(Allocator*) = 0; }; } // namespace deimos diff --git a/deimos/core/api_registry.cpp b/deimos/core/api_registry.cpp index a070473..873d72d 100644 --- a/deimos/core/api_registry.cpp +++ b/deimos/core/api_registry.cpp @@ -40,7 +40,7 @@ ApiRegistry* InitializeGlobalApiRegistry() { g_allocator_api = BootstrapAllocatorApi(); - Allocator* allocator = g_allocator_api->system; + Allocator* allocator = g_allocator_api->CreateChild(g_allocator_api->system, "API Registry"); ApiRegistry* api_registry = allocator->New(allocator); api_registry->Set(g_allocator_api); -- cgit