Skip to content

Commit cb4510f

Browse files
gahaasvictorgomes
authored andcommitted
[test] Pass existing CppHeap to Isolate creation
New V8 API expects a CppHeap to exist for the whole existence of an Isolate. Therefore the APIs for attaching and detaching a CppHeap get deprecated, and an existing CppHeap has to be passed to the isolate during isolate creation. This PR adjusts a test that passes an existing CppHeap too late to the isolate.
1 parent 192bd83 commit cb4510f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/api/environment.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,13 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
378378
uv_loop_t* event_loop,
379379
MultiIsolatePlatform* platform,
380380
const EmbedderSnapshotData* snapshot_data,
381-
const IsolateSettings& settings) {
381+
const IsolateSettings& settings,
382+
std::unique_ptr<v8::CppHeap> cpp_heap) {
382383
Isolate::CreateParams params;
383384
if (allocator != nullptr) params.array_buffer_allocator = allocator;
385+
if (cpp_heap) {
386+
params.cpp_heap = cpp_heap.release();
387+
}
384388
return NewIsolate(&params,
385389
event_loop,
386390
platform,

src/node.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ NODE_EXTERN v8::Isolate* NewIsolate(
553553
struct uv_loop_s* event_loop,
554554
MultiIsolatePlatform* platform,
555555
const EmbedderSnapshotData* snapshot_data = nullptr,
556-
const IsolateSettings& settings = {});
556+
const IsolateSettings& settings = {},
557+
std::unique_ptr<v8::CppHeap> cpp_heap = {});
557558
NODE_EXTERN v8::Isolate* NewIsolate(
558559
std::shared_ptr<ArrayBufferAllocator> allocator,
559560
struct uv_loop_s* event_loop,

0 commit comments

Comments
 (0)