diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-25 04:12:19 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-01 21:57:54 +0100 |
commit | 31975bbc88d353cf2eecc93c9d2cde62dba67b2c (patch) | |
tree | 7a91545cfd50182e50addd1aa3a6468d74f65474 /src/node_crypto.h | |
parent | b42dcb0eeb2d2c302b0ecabbc1092605a54213d6 (diff) | |
download | android-node-v8-31975bbc88d353cf2eecc93c9d2cde62dba67b2c.tar.gz android-node-v8-31975bbc88d353cf2eecc93c9d2cde62dba67b2c.tar.bz2 android-node-v8-31975bbc88d353cf2eecc93c9d2cde62dba67b2c.zip |
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 <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r-- | src/node_crypto.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h index ce93412830..982fc70543 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -333,7 +333,7 @@ class SSLWrap { ClientHelloParser hello_parser_; - Persistent<v8::Object> ocsp_response_; + Persistent<v8::ArrayBufferView> ocsp_response_; Persistent<v8::Value> sni_context_; friend class SecureContext; @@ -462,7 +462,7 @@ class KeyObject : public BaseObject { static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void Init(const v8::FunctionCallbackInfo<v8::Value>& args); - void InitSecret(const char* key, size_t key_len); + void InitSecret(v8::Local<v8::ArrayBufferView> abv); void InitPublic(const ManagedEVPPKey& pkey); void InitPrivate(const ManagedEVPPKey& pkey); @@ -803,8 +803,7 @@ class ECDH : public BaseObject { static void Initialize(Environment* env, v8::Local<v8::Object> target); static ECPointPointer BufferToPoint(Environment* env, const EC_GROUP* group, - char* data, - size_t len); + v8::Local<v8::Value> buf); // TODO(joyeecheung): track the memory used by OpenSSL types SET_NO_MEMORY_INFO() |