Skip to content

Commit

Permalink
src: separate out NgLibMemoryManagerBase
Browse files Browse the repository at this point in the history
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 <[email protected]>

PR-URL: #33104
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
  • Loading branch information
jasnell authored and targos committed May 7, 2020
1 parent e4b17e9 commit 9350315
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/node_mem.h
Original file line number Diff line number Diff line change
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 9350315

Please sign in to comment.