summaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-09-21 18:57:46 +0200
committerAnna Henningsen <anna@addaleax.net>2019-12-07 22:55:17 +0100
commit933bd855e240d41e91a3dda2618a16513278f378 (patch)
treeac8922eff0cc4013ae1dbca27c3d14cefe74f1e6 /src/node_http2.h
parent1e5911d5a3c35672941f2dcad6b9a95efa367404 (diff)
downloadnode-new-933bd855e240d41e91a3dda2618a16513278f378.tar.gz
http2: use shared memory tracking implementation
The extensive testing done on http2 makes it easier to make sure the implementation is correct (and doesn’t diverge unnecessarily). Refs: https://github.com/nodejs/quic/pull/126 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/30745 Refs: https://github.com/nodejs/quic/blob/34ee0bc96f804c73cb22b2945a1a78f780938492/src/node_mem.h Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index e828999f2b..1812cba51f 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -8,6 +8,7 @@
#include "nghttp2/nghttp2.h"
#include "node_http2_state.h"
+#include "node_mem.h"
#include "node_perf.h"
#include "stream_base-inl.h"
#include "string_bytes.h"
@@ -703,7 +704,9 @@ enum SessionBitfieldFlags {
kSessionHasAltsvcListeners
};
-class Http2Session : public AsyncWrap, public StreamListener {
+class Http2Session : public AsyncWrap,
+ public StreamListener,
+ public mem::NgLibMemoryManager<Http2Session, nghttp2_mem> {
public:
Http2Session(Environment* env,
Local<Object> wrap,
@@ -712,7 +715,6 @@ class Http2Session : public AsyncWrap, public StreamListener {
class Http2Ping;
class Http2Settings;
- class MemoryAllocatorInfo;
void EmitStatistics();
@@ -813,6 +815,11 @@ class Http2Session : public AsyncWrap, public StreamListener {
void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override;
void OnStreamAfterWrite(WriteWrap* w, int status) override;
+ // Implementation for mem::NgLibMemoryManager
+ void CheckAllocatedSize(size_t previous_size) const;
+ void IncreaseAllocatedSize(size_t size);
+ void DecreaseAllocatedSize(size_t size);
+
// The JavaScript API
static void New(const FunctionCallbackInfo<Value>& args);
static void Consume(const FunctionCallbackInfo<Value>& args);