mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
n-api: improve consistency of how we get context
Refs: https://github.com/nodejs/node-addon-api/issues/764 Improve the consistency of how we get a context when needed. We generally used env->context() in N-API but there were are few exceptions that this PR addresses. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/36068 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
1 parent
402e29a87c
commit
dde727e72f
1 file changed
+2
-3
@@ -169,7 +169,7 @@ inline static napi_status ConcludeDeferred(napi_env env,
|
||||
NAPI_PREAMBLE(env);
|
||||
CHECK_ARG(env, result);
|
||||
|
||||
v8::Local<v8::Context> context = env->isolate->GetCurrentContext();
|
||||
v8::Local<v8::Context> context = env->context();
|
||||
v8impl::Persistent<v8::Value>* deferred_ref =
|
||||
NodePersistentFromJsDeferred(deferred);
|
||||
v8::Local<v8::Value> v8_deferred =
|
||||
@@ -385,8 +385,7 @@ inline static napi_status Unwrap(napi_env env,
|
||||
CHECK_ARG(env, result);
|
||||
}
|
||||
|
||||
v8::Isolate* isolate = env->isolate;
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Local<v8::Context> context = env->context();
|
||||
|
||||
v8::Local<v8::Value> value = v8impl::V8LocalValueFromJsValue(js_object);
|
||||
RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg);
|
||||
|
||||
Reference in new issue
Block a user