Skip to content

Partially revert #95 #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/conversions.cc
Original file line number Diff line number Diff line change
@@ -29,12 +29,7 @@ void InitConversions(Local<Object> exports) {

point_transfer_buffer = static_cast<uint32_t *>(malloc(2 * sizeof(uint32_t)));

#if _MSC_VER && NODE_RUNTIME_ELECTRON && NODE_MODULE_VERSION >= 89
// this is a terrible thing we have to do because of https://github.com/electron/electron/issues/29893
v8::Local<v8::Object> bufferView;
bufferView = node::Buffer::New(Isolate::GetCurrent(), point_transfer_buffer, 0, 2 * sizeof(uint32_t)).ToLocalChecked();
auto js_point_transfer_buffer = node::Buffer::Data(bufferView);
#elif (V8_MAJOR_VERSION > 8 || (V8_MAJOR_VERSION == 8 && V8_MINOR_VERION > 3))
#if (V8_MAJOR_VERSION > 8 || (V8_MAJOR_VERSION == 8 && V8_MINOR_VERSION > 3))
auto backing_store = ArrayBuffer::NewBackingStore(point_transfer_buffer, 2 * sizeof(uint32_t), BackingStore::EmptyDeleter, nullptr);
auto js_point_transfer_buffer = ArrayBuffer::New(Isolate::GetCurrent(), std::move(backing_store));
#else
7 changes: 1 addition & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
@@ -30,12 +30,7 @@ static inline void setup_transfer_buffer(uint32_t node_count) {
transfer_buffer_length = new_length;
transfer_buffer = static_cast<uint32_t *>(malloc(transfer_buffer_length * sizeof(uint32_t)));

#if _MSC_VER && NODE_RUNTIME_ELECTRON && NODE_MODULE_VERSION >= 89
// this is a terrible thing we have to do because of https://github.com/electron/electron/issues/29893
v8::Local<v8::Object> bufferView;
bufferView = node::Buffer::New(Isolate::GetCurrent(), transfer_buffer, 0, transfer_buffer_length * sizeof(uint32_t)).ToLocalChecked();
auto js_point_transfer_buffer = node::Buffer::Data(bufferView);
#elif (V8_MAJOR_VERSION > 8 || (V8_MAJOR_VERSION == 8 && V8_MINOR_VERION > 3))
#if (V8_MAJOR_VERSION > 8 || (V8_MAJOR_VERSION == 8 && V8_MINOR_VERSION > 3))
auto backing_store = ArrayBuffer::NewBackingStore(transfer_buffer, transfer_buffer_length * sizeof(uint32_t), BackingStore::EmptyDeleter, nullptr);
auto js_transfer_buffer = ArrayBuffer::New(Isolate::GetCurrent(), std::move(backing_store));
#else
2 changes: 1 addition & 1 deletion src/util.cc
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ bool instance_of(v8::Local<v8::Value> value, v8::Local<v8::Object> object) {
}

v8::Local<v8::Object> GetGlobal(v8::Local<v8::Function>& callback) {
#if (V8_MAJOR_VERSION > 9 || (V8_MAJOR_VERSION == 9 && V8_MINOR_VERION > 4))
#if (V8_MAJOR_VERSION > 9 || (V8_MAJOR_VERSION == 9 && V8_MINOR_VERSION > 4))
return callback->GetCreationContext().ToLocalChecked()->Global();
#else
return callback->CreationContext()->Global();