@@ -273,17 +273,17 @@ node::DebugOptions debug_options;
273273
274274static struct {
275275#if NODE_USE_V8_PLATFORM
276- void Initialize (int thread_pool_size, uv_loop_t * loop ) {
276+ void Initialize (int thread_pool_size) {
277277 if (trace_enabled) {
278278 tracing_agent_.reset (new tracing::Agent (trace_file_pattern));
279- platform_ = new NodePlatform (thread_pool_size, loop,
279+ platform_ = new NodePlatform (thread_pool_size,
280280 tracing_agent_->GetTracingController ());
281281 V8::InitializePlatform (platform_);
282282 tracing::TraceEventHelper::SetTracingController (
283283 tracing_agent_->GetTracingController ());
284284 } else {
285285 tracing_agent_.reset (nullptr );
286- platform_ = new NodePlatform (thread_pool_size, loop, nullptr );
286+ platform_ = new NodePlatform (thread_pool_size, nullptr );
287287 V8::InitializePlatform (platform_);
288288 tracing::TraceEventHelper::SetTracingController (
289289 new v8::TracingController ());
@@ -297,8 +297,8 @@ static struct {
297297 tracing_agent_.reset (nullptr );
298298 }
299299
300- void DrainVMTasks () {
301- platform_->DrainBackgroundTasks ();
300+ void DrainVMTasks (Isolate* isolate ) {
301+ platform_->DrainBackgroundTasks (isolate );
302302 }
303303
304304#if HAVE_INSPECTOR
@@ -323,12 +323,16 @@ static struct {
323323 tracing_agent_->Stop ();
324324 }
325325
326+ NodePlatform* Platform () {
327+ return platform_;
328+ }
329+
326330 std::unique_ptr<tracing::Agent> tracing_agent_;
327331 NodePlatform* platform_;
328332#else // !NODE_USE_V8_PLATFORM
329- void Initialize (int thread_pool_size, uv_loop_t * loop ) {}
333+ void Initialize (int thread_pool_size) {}
330334 void Dispose () {}
331- void DrainVMTasks () {}
335+ void DrainVMTasks (Isolate* isolate ) {}
332336 bool StartInspector (Environment *env, const char * script_path,
333337 const node::DebugOptions& options) {
334338 env->ThrowError (" Node compiled with NODE_USE_V8_PLATFORM=0" );
@@ -340,6 +344,10 @@ static struct {
340344 " so event tracing is not available.\n " );
341345 }
342346 void StopTracingAgent () {}
347+
348+ NodePlatform* Platform () {
349+ return nullptr ;
350+ }
343351#endif // !NODE_USE_V8_PLATFORM
344352
345353#if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
@@ -4733,7 +4741,14 @@ int EmitExit(Environment* env) {
47334741
47344742
47354743IsolateData* CreateIsolateData (Isolate* isolate, uv_loop_t * loop) {
4736- return new IsolateData (isolate, loop);
4744+ return new IsolateData (isolate, loop, nullptr );
4745+ }
4746+
4747+ IsolateData* CreateIsolateData (
4748+ Isolate* isolate,
4749+ uv_loop_t * loop,
4750+ MultiIsolatePlatform* platform) {
4751+ return new IsolateData (isolate, loop, platform);
47374752}
47384753
47394754
@@ -4801,7 +4816,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
48014816 do {
48024817 uv_run (env.event_loop (), UV_RUN_DEFAULT);
48034818
4804- v8_platform.DrainVMTasks ();
4819+ v8_platform.DrainVMTasks (isolate );
48054820
48064821 more = uv_loop_alive (env.event_loop ());
48074822 if (more)
@@ -4822,7 +4837,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
48224837 RunAtExit (&env);
48234838 uv_key_delete (&thread_local_env);
48244839
4825- v8_platform.DrainVMTasks ();
4840+ v8_platform.DrainVMTasks (isolate );
48264841 WaitForInspectorDisconnect (&env);
48274842#if defined(LEAK_SANITIZER)
48284843 __lsan_do_leak_check ();
@@ -4865,7 +4880,11 @@ inline int Start(uv_loop_t* event_loop,
48654880 Locker locker (isolate);
48664881 Isolate::Scope isolate_scope (isolate);
48674882 HandleScope handle_scope (isolate);
4868- IsolateData isolate_data (isolate, event_loop, allocator.zero_fill_field ());
4883+ IsolateData isolate_data (
4884+ isolate,
4885+ event_loop,
4886+ v8_platform.Platform (),
4887+ allocator.zero_fill_field ());
48694888 exit_code = Start (isolate, &isolate_data, argc, argv, exec_argc, exec_argv);
48704889 }
48714890
@@ -4912,7 +4931,7 @@ int Start(int argc, char** argv) {
49124931 V8::SetEntropySource (crypto::EntropySource);
49134932#endif // HAVE_OPENSSL
49144933
4915- v8_platform.Initialize (v8_thread_pool_size, uv_default_loop () );
4934+ v8_platform.Initialize (v8_thread_pool_size);
49164935 // Enable tracing when argv has --trace-events-enabled.
49174936 if (trace_enabled) {
49184937 fprintf (stderr, " Warning: Trace event is an experimental feature "
0 commit comments