Skip to content

Commit 14ebda5

Browse files
zcbenzMylesBorins
authored andcommitted
src: add public API for managing NodePlatform
PR-URL: #16981 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 74506f7 commit 14ebda5

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/node.cc

+12
Original file line numberDiff line numberDiff line change
@@ -4769,6 +4769,18 @@ void FreeEnvironment(Environment* env) {
47694769
}
47704770

47714771

4772+
MultiIsolatePlatform* CreatePlatform(
4773+
int thread_pool_size,
4774+
v8::TracingController* tracing_controller) {
4775+
return new NodePlatform(thread_pool_size, tracing_controller);
4776+
}
4777+
4778+
4779+
void FreePlatform(MultiIsolatePlatform* platform) {
4780+
delete platform;
4781+
}
4782+
4783+
47724784
Local<Context> NewContext(Isolate* isolate,
47734785
Local<ObjectTemplate> object_template) {
47744786
auto context = Context::New(isolate, nullptr, object_template);

src/node.h

+10
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
// Forward-declare libuv loop
9898
struct uv_loop_s;
9999

100+
// Forward-declare TracingController, used by CreatePlatform.
101+
namespace v8 {
102+
class TracingController;
103+
}
104+
100105
// Forward-declare these functions now to stop MSVS from becoming
101106
// terminally confused when it's done in node_internals.h
102107
namespace node {
@@ -244,6 +249,11 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
244249
NODE_EXTERN void LoadEnvironment(Environment* env);
245250
NODE_EXTERN void FreeEnvironment(Environment* env);
246251

252+
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
253+
int thread_pool_size,
254+
v8::TracingController* tracing_controller);
255+
NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform);
256+
247257
NODE_EXTERN void EmitBeforeExit(Environment* env);
248258
NODE_EXTERN int EmitExit(Environment* env);
249259
NODE_EXTERN void RunAtExit(Environment* env);

0 commit comments

Comments
 (0)