From 4286dcf17f062034117043a2640b620210b61f57 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 12 Sep 2018 15:01:50 +0200 Subject: src: refactor `Environment::GetCurrent()` usage Make `Environment::GetCurrent()` return `nullptr` if the current `Context` is not a Node.js context, and for the relevant usage of this function, either: - Switch to the better `GetCurrent(args)` variant - Turn functions in to no-ops where it makes sense - Make it a `CHECK`, i.e. an API requirement, where it make sense - Leave a `TODO` comment for verifying what, if anything, is to be done PR-URL: https://github.com/nodejs/node/pull/22819 Reviewed-By: Gus Caplan Reviewed-By: Gireesh Punathil Reviewed-By: Eugene Ostroukhov Reviewed-By: Refael Ackermann --- src/node_perf.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/node_perf.cc') diff --git a/src/node_perf.cc b/src/node_perf.cc index 1564b9582c..da6d571f20 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -310,6 +310,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Verify that this is correct. Local context = env->context(); Local fn = args.Data().As(); size_t count = args.Length(); -- cgit v1.2.3