Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-19 00:58:27 +0300
committerAnna Henningsen <anna@addaleax.net>2019-02-25 04:01:11 +0300
commit84e02b178ad14fae0df2a514e8a39bfa50ffdc2d (patch)
treeddc0435b6bd0b7811e0bf47687777c56b2857fd0 /src/stream_base-inl.h
parent6c257cdf271384555d0ced77104a1d6b0480e246 (diff)
src: allocate Buffer memory using ArrayBuffer allocator
Always use the right allocator for memory that is turned into an `ArrayBuffer` at a later point. This enables embedders to use their own `ArrayBuffer::Allocator`s, and is inspired by Electron’s electron/node@f61bae3440e. It should render their downstream patch unnecessary. Refs: https://github.com/electron/node/commit/f61bae3440e1bfcc83bba6ff0785adfb89b4045e PR-URL: https://github.com/nodejs/node/pull/26207 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r--src/stream_base-inl.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index 7db8403ced8..9cff67cd9fe 100644
--- a/src/stream_base-inl.h
+++ b/src/stream_base-inl.h
@@ -419,18 +419,9 @@ inline void ShutdownWrap::OnDone(int status) {
Dispose();
}
-inline void WriteWrap::SetAllocatedStorage(char* data, size_t size) {
- CHECK_NULL(storage_);
- storage_ = data;
- storage_size_ = size;
-}
-
-inline char* WriteWrap::Storage() {
- return storage_;
-}
-
-inline size_t WriteWrap::StorageSize() const {
- return storage_size_;
+inline void WriteWrap::SetAllocatedStorage(AllocatedBuffer&& storage) {
+ CHECK_NULL(storage_.data());
+ storage_ = std::move(storage);
}
inline void WriteWrap::OnDone(int status) {