Lines Matching defs:env
24 napi_value ImageNapi::Constructor(napi_env env)
38 return NapiDataUtils::DefineClass(env, "Image", properties, count, ImageNapi::New);
41 napi_value ImageNapi::New(napi_env env, napi_callback_info info)
45 ctxt->GetCbInfoSync(env, info);
46 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
49 ASSERT_ERR(ctxt->env, image != nullptr, Status::E_ERROR, "no memory for image!");
51 ASSERT_CALL(env, napi_wrap(env, ctxt->self, image, Destructor, nullptr, nullptr), image);
55 void ImageNapi::NewInstance(napi_env env, std::shared_ptr<UnifiedRecord> in, napi_value &out)
58 ASSERT_CALL_VOID(env, napi_new_instance(env, Constructor(env), 0, nullptr, &out));
60 ASSERT_ERR_VOID(env, image != nullptr, Status::E_ERROR, "no memory for image!");
62 ASSERT_CALL_DELETE(env, napi_wrap(env, out, image, Destructor, nullptr, nullptr), image);
65 void ImageNapi::Destructor(napi_env env, void *data, void *hint)
73 ImageNapi *ImageNapi::GetImage(napi_env env, napi_callback_info info, std::shared_ptr<ContextBase> ctxt)
76 ctxt->GetCbInfoSync(env, info);
77 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
81 napi_value ImageNapi::GetImageUri(napi_env env, napi_callback_info info)
85 auto image = GetImage(env, info, ctxt);
87 ctxt->env, (image != nullptr && image->value_ != nullptr), Status::E_ERROR, "invalid object!");
88 ctxt->status = NapiDataUtils::SetValue(env, image->value_->GetUri(), ctxt->output);
89 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, "set image uri failed!");
93 napi_value ImageNapi::SetImageUri(napi_env env, napi_callback_info info)
98 auto input = [env, ctxt, &uri](size_t argc, napi_value *argv) {
101 ctxt->status = NapiDataUtils::GetValue(env, argv[0], uri);
105 ctxt->GetCbInfoSync(env, info, input);
106 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
109 ctxt->env, (image != nullptr && image->value_ != nullptr), Status::E_ERROR, "invalid object!");