From 31975bbc88d353cf2eecc93c9d2cde62dba67b2c Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 25 Feb 2019 04:12:19 +0100 Subject: src: allow not materializing ArrayBuffers from C++ Where appropriate, use a helper that wraps around `ArrayBufferView::Buffer()` or `ArrayBufferView::CopyContents()` rather than `Buffer::Data()`, as that may help to avoid materializing the underlying `ArrayBuffer` when reading small typed arrays from C++. This allows keeping the performance benefits of the faster creation of heap-allocated small typed arrays in many cases. PR-URL: https://github.com/nodejs/node/pull/26301 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- src/node_http2.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/node_http2.h') diff --git a/src/node_http2.h b/src/node_http2.h index 9065718c60..8a8ef74af9 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -699,7 +699,8 @@ class Http2Session : public AsyncWrap, public StreamListener { void Close(uint32_t code = NGHTTP2_NO_ERROR, bool socket_closed = false); void Consume(Local external); - void Goaway(uint32_t code, int32_t lastStreamID, uint8_t* data, size_t len); + void Goaway(uint32_t code, int32_t lastStreamID, + const uint8_t* data, size_t len); void AltSvc(int32_t id, uint8_t* origin, size_t origin_len, @@ -1089,7 +1090,7 @@ class Http2Session::Http2Ping : public AsyncWrap { SET_MEMORY_INFO_NAME(Http2Ping) SET_SELF_SIZE(Http2Ping) - void Send(uint8_t* payload); + void Send(const uint8_t* payload); void Done(bool ack, const uint8_t* payload = nullptr); private: -- cgit v1.2.3