GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_mem.h Lines: 1 1 100.0 %
Date: 2020-02-19 22:14:06 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_NODE_MEM_H_
2
#define SRC_NODE_MEM_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include <cstddef>
7
8
namespace node {
9
namespace mem {
10
11
// Both ngtcp2 and nghttp2 allow custom allocators that
12
// follow exactly the same structure and behavior, but
13
// use different struct names. To allow for code re-use,
14
// the NgLibMemoryManager template class can be used for both.
15
16
template <typename Class, typename AllocatorStructName>
17
617
class NgLibMemoryManager {
18
 public:
19
  // Class needs to provide these methods:
20
  // void CheckAllocatedSize(size_t previous_size) const;
21
  // void IncreaseAllocatedSize(size_t size);
22
  // void DecreaseAllocatedSize(size_t size);
23
  // Environment* env() const;
24
25
  AllocatorStructName MakeAllocator();
26
27
  void StopTrackingMemory(void* ptr);
28
29
 private:
30
  static void* ReallocImpl(void* ptr, size_t size, void* user_data);
31
  static void* MallocImpl(size_t size, void* user_data);
32
  static void FreeImpl(void* ptr, void* user_data);
33
  static void* CallocImpl(size_t nmemb, size_t size, void* user_data);
34
};
35
36
}  // namespace mem
37
}  // namespace node
38
39
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
40
41
#endif  // SRC_NODE_MEM_H_