Lines Matching defs:context

22 Call::Call(napi_env env, napi_callback_info info, std::shared_ptr<Context> context, size_t pos, bool needException)
38 context->errCode_ = ErrorThrowType::PARAMETER_ERROR;
39 context->errMsg_ = std::string(PARAMETER_ERROR_MESSAGE) + "The type of valueType must be function.";
42 auto status = (*context)(env, argc, argv, self);
43 if (status != napi_ok && context->errCode_ != 0 && needException) {
44 JsError::ThrowError(env, context->errCode_, context->errMsg_);
45 context->output_ = nullptr;
46 context->exec_ = nullptr;
48 context_->ctx = std::move(context);
111 CallContext *context = reinterpret_cast<CallContext *>(data);
112 context->ctx->Exec();
118 CallContext *context = reinterpret_cast<CallContext *>(data);
120 napi_status runStatus = (*context->ctx)(env, &output);
136 if (context->ctx->errCode_ != 0) {
137 napi_create_int32(env, context->ctx->errCode_, &errCode);
139 if (!context->ctx->errMsg_.empty()) {
140 errMsg = context->ctx->errMsg_;
147 HILOG_DEBUG("run the js callback function:(context->defer != nullptr)?[%{public}d]", context->defer != nullptr);
148 if (context->defer != nullptr) {
152 napi_resolve_deferred(env, context->defer, result[ARG_DATA]);
154 napi_reject_deferred(env, context->defer, result[ARG_ERROR]);
160 napi_get_reference_value(env, context->callback, &callback);
164 DeleteContext(env, context);
166 void Call::DeleteContext(napi_env env, CallContext *context)
169 napi_delete_reference(env, context->callback);
170 napi_delete_reference(env, context->self);
171 napi_delete_async_work(env, context->work);
173 delete context;