Skip to content
Permalink
Browse files

src: allow running tasks without `Environment`

There is no real reason to assume that V8 tasks would have
to run in a Node.js `Context`.

PR-URL: #26376
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
addaleax authored and BridgeAR committed Feb 24, 2019
1 parent 622048d commit 9c277c04ad74c50a338dab1c5e9fc1ca6056804d
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/node_platform.cc
@@ -334,9 +334,13 @@ void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<Task> task) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
Environment* env = Environment::GetCurrent(isolate);
InternalCallbackScope cb_scope(env, Local<Object>(), { 0, 0 },
InternalCallbackScope::kAllowEmptyResource);
task->Run();
if (env != nullptr) {
InternalCallbackScope cb_scope(env, Local<Object>(), { 0, 0 },
InternalCallbackScope::kAllowEmptyResource);
task->Run();
} else {
task->Run();
}
}

void PerIsolatePlatformData::DeleteFromScheduledTasks(DelayedTask* task) {

0 comments on commit 9c277c0

Please sign in to comment.
You can’t perform that action at this time.