diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-24 21:58:44 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-05 22:40:01 +0100 |
commit | cf699a02cae81e09d694a18f857eb07503b6e66c (patch) | |
tree | 7fe255f8cb10c45a3d67817a844396a9c934dbd5 /src/node_perf.cc | |
parent | c2f620ab76c3e42fa1fcdfde82aba7bcba3031e9 (diff) | |
download | android-node-v8-cf699a02cae81e09d694a18f857eb07503b6e66c.tar.gz android-node-v8-cf699a02cae81e09d694a18f857eb07503b6e66c.tar.bz2 android-node-v8-cf699a02cae81e09d694a18f857eb07503b6e66c.zip |
src: prefer to get `Environment` from `Context`
We explicitly store the context anyway, and can skip the
extra steps introduced in `Environment::GetCurrent()`.
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r-- | src/node_perf.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc index 908c76c211..e16be29a87 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -333,10 +333,9 @@ inline Local<Value> GetName(Local<Function> fn) { // execution. void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) { Isolate* isolate = args.GetIsolate(); - HandleScope scope(isolate); - Environment* env = Environment::GetCurrent(isolate); + Local<Context> context = isolate->GetCurrentContext(); + Environment* env = Environment::GetCurrent(context); CHECK_NOT_NULL(env); - Local<Context> context = env->context(); Local<Function> fn = args.Data().As<Function>(); size_t count = args.Length(); size_t idx; |