From 1d69c6f47415949a2a46b72506383c2f6fc5131b Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 27 Apr 2020 13:09:56 -0700 Subject: [PATCH] src: separate out NgLibMemoryManagerBase Extracted from the [QUIC PR](https://github.com/nodejs/node/pull/32379) So far, this is only used by the QUIC PR directly but the change itself is independent of QUIC, even if not used directly by anything else yet. Separated out per request. Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/33104 Reviewed-By: Anna Henningsen Reviewed-By: Sam Roberts --- src/node_mem.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/node_mem.h b/src/node_mem.h index 0d3388ad476..f8cdc20848f 100644 --- a/src/node_mem.h +++ b/src/node_mem.h @@ -13,8 +13,12 @@ namespace mem { // use different struct names. To allow for code re-use, // the NgLibMemoryManager template class can be used for both. +struct NgLibMemoryManagerBase { + virtual void StopTrackingMemory(void* ptr) = 0; +}; + template -class NgLibMemoryManager { +class NgLibMemoryManager : public NgLibMemoryManagerBase { public: // Class needs to provide these methods: // void CheckAllocatedSize(size_t previous_size) const; @@ -24,7 +28,7 @@ class NgLibMemoryManager { AllocatorStructName MakeAllocator(); - void StopTrackingMemory(void* ptr); + void StopTrackingMemory(void* ptr) override; private: static void* ReallocImpl(void* ptr, size_t size, void* user_data);