Lines Matching defs:ctx
204 static napi_value UnmarshalReply(napi_env env, const TransactionContext &ctx, const ApiReplyInfo &reply)
206 if (ctx.callInfo_.fdParamIndex_ >= 0) {
207 auto fd = ctx.callInfo_.paramList_.at(INDEX_ZERO).get<int>();
228 NAPI_CALL(env, UnmarshalObject(env, reply.resultValue_.at(idx), &item, ctx.jsThis_));
232 NAPI_CALL(env, UnmarshalObject(env, reply.resultValue_, &result, ctx.jsThis_));
238 napi_value TransactSync(napi_env env, TransactionContext &ctx)
241 LOG_D("TargetApi=%{public}s", ctx.callInfo_.apiId_.data());
243 g_apiTransactClient.Transact(ctx.callInfo_, reply);
244 auto resultValue = UnmarshalReply(env, ctx, reply);
276 static napi_value TransactAsync(napi_env env, TransactionContext &ctx)
279 LOG_D("TargetApi=%{public}s", ctx.callInfo_.apiId_.data());
283 aCtx->ctx_ = ctx;
286 NAPI_CALL(env, napi_create_reference(env, ctx.jsThis_, refCount, &(aCtx->jsThisRef_)));
292 auto &ctx = aCtx->ctx_;
293 g_apiTransactClient.Transact(ctx.callInfo_, aCtx->reply_);
344 static void PreprocessTransaction(napi_env env, TransactionContext &ctx, napi_value &error)
346 auto ¶mList = ctx.callInfo_.paramList_;
347 const auto &id = ctx.callInfo_.apiId_;
370 ctx.callInfo_.fdParamIndex_ = INDEX_ZERO;
373 UiEventObserverNapi::Get().PreprocessCallOnce(env, ctx.callInfo_, ctx.jsThis_, ctx.jsArgs_, err);
384 TransactionContext ctx;
388 NAPI_CALL(env, napi_get_cb_info(env, info, &count, argv, &(ctx.jsThis_), &pData));
390 ctx.jsArgs_ = argv;
409 ctx.callInfo_.paramList_ = nlohmann::json::parse(JsStrToCppStr(env, jsTempObj));
412 NAPI_CALL(env, GetBackendObjRefProp(env, ctx.jsThis_, &jsTempObj));
413 ctx.callInfo_.callerObjRef_ = JsStrToCppStr(env, jsTempObj);
416 ctx.callInfo_.apiId_ = methodDef->name_;
418 PreprocessTransaction(env, ctx, error);
426 return TransactSync(env, ctx);
428 return TransactAsync(env, ctx);