diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-09-12 15:01:50 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-09-17 17:20:27 +0200 |
commit | 4286dcf17f062034117043a2640b620210b61f57 (patch) | |
tree | de227e8bb7bee72778a2e7bd98f08991839bf866 /src/node_perf.cc | |
parent | c33e27dc3caf5a5b7954706fe6ecde1e4f82534d (diff) | |
download | android-node-v8-4286dcf17f062034117043a2640b620210b61f57.tar.gz android-node-v8-4286dcf17f062034117043a2640b620210b61f57.tar.bz2 android-node-v8-4286dcf17f062034117043a2640b620210b61f57.zip |
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 <me@gus.host>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r-- | src/node_perf.cc | 1 |
1 files changed, 1 insertions, 0 deletions
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<Value>& 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> context = env->context(); Local<Function> fn = args.Data().As<Function>(); size_t count = args.Length(); |