Skip to content

Commit

Permalink
src: use default parameters for CreateIsolateData
Browse files Browse the repository at this point in the history
PR-URL: #22465
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • Loading branch information
addaleax committed Aug 27, 2018
1 parent e03f9c5 commit a8572b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
19 changes: 5 additions & 14 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
12 changes: 2 additions & 10 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,11 @@ NODE_EXTERN v8::Local<v8::Context> 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
Expand Down

0 comments on commit a8572b1

Please sign in to comment.