diff --git a/src/node.cc b/src/node.cc index 76e17905a5aaf1..565c965cf9fae6 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3069,25 +3069,16 @@ void FreeArrayBufferAllocator(ArrayBufferAllocator* allocator) { } -IsolateData* CreateIsolateData(Isolate* isolate, uv_loop_t* loop) { - return new IsolateData(isolate, loop, nullptr); -} - - -IsolateData* CreateIsolateData( - Isolate* isolate, - uv_loop_t* loop, - MultiIsolatePlatform* platform) { - return new IsolateData(isolate, loop, platform); -} - - IsolateData* CreateIsolateData( Isolate* isolate, uv_loop_t* loop, MultiIsolatePlatform* platform, ArrayBufferAllocator* allocator) { - return new IsolateData(isolate, loop, platform, allocator->zero_fill_field()); + return new IsolateData( + isolate, + loop, + platform, + allocator != nullptr ? allocator->zero_fill_field() : nullptr); } diff --git a/src/node.h b/src/node.h index ab82be7ac4d30f..74403a6e48d3b8 100644 --- a/src/node.h +++ b/src/node.h @@ -257,19 +257,11 @@ NODE_EXTERN v8::Local NewContext( // If `platform` is passed, it will be used to register new Worker instances. // It can be `nullptr`, in which case creating new Workers inside of // Environments that use this `IsolateData` will not work. -// TODO(helloshuangzi): switch to default parameters. -NODE_EXTERN IsolateData* CreateIsolateData( - v8::Isolate* isolate, - struct uv_loop_s* loop); -NODE_EXTERN IsolateData* CreateIsolateData( - v8::Isolate* isolate, - struct uv_loop_s* loop, - MultiIsolatePlatform* platform); NODE_EXTERN IsolateData* CreateIsolateData( v8::Isolate* isolate, struct uv_loop_s* loop, - MultiIsolatePlatform* platform, - ArrayBufferAllocator* allocator); + MultiIsolatePlatform* platform = nullptr, + ArrayBufferAllocator* allocator = nullptr); NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data); // TODO(addaleax): Add an official variant using STL containers, and move