summaryrefslogtreecommitdiff
path: root/src/env-inl.h
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-05-14 12:03:59 -0700
committerJames M Snell <jasnell@gmail.com>2020-05-30 16:20:02 -0700
commite2cd71536161589dff96adf882970b9a33380f02 (patch)
treec88f653beca27baf69a1e1545ad9d0fe8c7008fb /src/env-inl.h
parent56ff1ee55a57b1169dc567f0f51e58a6f2ccda6d (diff)
downloadnode-new-e2cd71536161589dff96adf882970b9a33380f02.tar.gz
src: turn AllocatedBuffer into thin wrapper around v8::BackingStore
Alternative to https://github.com/nodejs/node/pull/33381 that reimplements that change on top of moving AllocatedBuffer out of env.h PR-URL: https://github.com/nodejs/node/pull/33291 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/env-inl.h')
-rw-r--r--src/env-inl.h26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/env-inl.h b/src/env-inl.h
index 3afda388bc..fe92fcb3dd 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -867,29 +867,9 @@ inline IsolateData* Environment::isolate_data() const {
return isolate_data_;
}
-inline char* Environment::AllocateUnchecked(size_t size) {
- return static_cast<char*>(
- isolate_data()->allocator()->AllocateUninitialized(size));
-}
-
-inline char* Environment::Allocate(size_t size) {
- char* ret = AllocateUnchecked(size);
- CHECK_NE(ret, nullptr);
- return ret;
-}
-
-inline void Environment::Free(char* data, size_t size) {
- if (data != nullptr)
- isolate_data()->allocator()->Free(data, size);
-}
-
-// It's a bit awkward to define this Buffer::New() overload here, but it
-// avoids a circular dependency with node_internals.h.
-namespace Buffer {
-v8::MaybeLocal<v8::Object> New(Environment* env,
- char* data,
- size_t length,
- bool uses_malloc);
+std::unordered_map<char*, std::unique_ptr<v8::BackingStore>>*
+ Environment::released_allocated_buffers() {
+ return &released_allocated_buffers_;
}
inline void Environment::ThrowError(const char* errmsg) {