summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-18 17:30:42 +0100
committerAnna Henningsen <anna@addaleax.net>2019-02-25 02:00:44 +0100
commit5c0e18fd407ec5766a8f326dbe3c870d3594ab7d (patch)
tree50a99eda8a25681e2aa5219aad9d7da8a98716a6 /src/env.h
parent23b075d051acf16711de40cb248bf142ab297d47 (diff)
downloadandroid-node-v8-5c0e18fd407ec5766a8f326dbe3c870d3594ab7d.tar.gz
android-node-v8-5c0e18fd407ec5766a8f326dbe3c870d3594ab7d.tar.bz2
android-node-v8-5c0e18fd407ec5766a8f326dbe3c870d3594ab7d.zip
src: make IsolateData store ArrayBufferAllocator
This enables us to identify whether we are using an allocator that we know more about than what the generic `ArrayBuffer::Allocator` API provides, in particular whether it is `malloc()`-compatible. 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/env.h')
-rw-r--r--src/env.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/env.h b/src/env.h
index 5f578dd54a..527a28f695 100644
--- a/src/env.h
+++ b/src/env.h
@@ -394,16 +394,20 @@ class Environment;
class IsolateData {
public:
- IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
+ IsolateData(v8::Isolate* isolate,
+ uv_loop_t* event_loop,
MultiIsolatePlatform* platform = nullptr,
- uint32_t* zero_fill_field = nullptr);
+ ArrayBufferAllocator* node_allocator = nullptr);
~IsolateData();
inline uv_loop_t* event_loop() const;
- inline uint32_t* zero_fill_field() const;
inline MultiIsolatePlatform* platform() const;
inline std::shared_ptr<PerIsolateOptions> options();
inline void set_options(std::shared_ptr<PerIsolateOptions> options);
+ inline bool uses_node_allocator() const;
+ inline v8::ArrayBuffer::Allocator* allocator() const;
+ inline ArrayBufferAllocator* node_allocator() const;
+
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
@@ -436,7 +440,9 @@ class IsolateData {
v8::Isolate* const isolate_;
uv_loop_t* const event_loop_;
- uint32_t* const zero_fill_field_;
+ v8::ArrayBuffer::Allocator* const allocator_;
+ ArrayBufferAllocator* const node_allocator_;
+ const bool uses_node_allocator_;
MultiIsolatePlatform* platform_;
std::shared_ptr<PerIsolateOptions> options_;