diff options
author | James M Snell <jasnell@gmail.com> | 2020-04-11 05:42:37 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-04-14 03:21:43 +0300 |
commit | cecb08f0c828dd5da8e4c6f8414bb1f9c778319e (patch) | |
tree | 04352ecba6680b8a689c0b3ea8f620de84c5c7b5 /src/node_http2.h | |
parent | 81c03bcebd3841e5bcbd3af0a03e102b80d10d12 (diff) |
src: add AliasedStruct utility
For http2 (and eventually QUIC) we have a struct that is backed
by a v8::BackingStore and exposed to the JavaScript side as an
ArrayBuffer and TypedArray. This is similar to AliasedBuffer
except that it is fronted by a struct on the C++ side.
```c++
struct foo {
uint32_t ex1;
uint32_t ex2;
};
AliasedStruct<foo> foo_;
foo_->ex1 = 1;
foo_->ex2 = 2;
foo_.GetArrayBuffer();
```
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/32778
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r-- | src/node_http2.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_http2.h b/src/node_http2.h index f9a0cae85ff..1e5f99acfac 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -7,6 +7,7 @@ #include <cstdint> #include "nghttp2/nghttp2.h" +#include "aliased_struct.h" #include "node_http2_state.h" #include "node_http_common.h" #include "node_mem.h" @@ -823,8 +824,7 @@ class Http2Session : public AsyncWrap, Nghttp2SessionPointer session_; // JS-accessible numeric fields, as indexed by SessionUint8Fields. - SessionJSFields* js_fields_ = nullptr; - std::shared_ptr<v8::BackingStore> js_fields_store_; + AliasedStruct<SessionJSFields> js_fields_; // The session type: client or server nghttp2_session_type session_type_; |