Skip to content

Commit 2502212

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 5e5206b commit 2502212

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
@@ -367,9 +367,13 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
367367
uv_loop_t* event_loop,
368368
MultiIsolatePlatform* platform,
369369
const EmbedderSnapshotData* snapshot_data,
370-
const IsolateSettings& settings) {
370+
const IsolateSettings& settings,
371+
std::unique_ptr<v8::CppHeap> cpp_heap) {
371372
Isolate::CreateParams params;
372373
if (allocator != nullptr) params.array_buffer_allocator = allocator;
374+
if (cpp_heap) {
375+
params.cpp_heap = cpp_heap.release();
376+
}
373377
return NewIsolate(&params,
374378
event_loop,
375379
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)