Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
src: separate out NgLibMemoryManagerBase
Extracted from the [QUIC PR](#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 <jasnell@gmail.com>

PR-URL: #33104
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
  • Loading branch information
jasnell authored and targos committed May 13, 2020
1 parent 31b143c commit 6b1e235
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/node_mem.h
Expand Up @@ -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 <typename Class, typename AllocatorStructName>
class NgLibMemoryManager {
class NgLibMemoryManager : public NgLibMemoryManagerBase {
public:
// Class needs to provide these methods:
// void CheckAllocatedSize(size_t previous_size) const;
Expand All @@ -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);
Expand Down

0 comments on commit 6b1e235

Please sign in to comment.