!12591 gn依赖修改第2笔

Merge pull request !12591 from songjindian/fix_gn2
This commit is contained in:
openharmony_ci
2025-02-14 07:27:43 +00:00
committed by Gitee
8 changed files with 55 additions and 41 deletions
@@ -1382,5 +1382,43 @@ bool WrapJsWantParamsArray(napi_env env, napi_value object, const std::string &k
return false;
}
}
template<class TBase, class T, class NativeT>
bool InnerWrapWantParamsArray(napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao)
{
if (ao == nullptr) {
return false;
}
long size = 0;
if (ao->GetLength(size) != ERR_OK) {
return false;
}
std::vector<NativeT> natArray;
for (long i = 0; i < size; i++) {
sptr<AAFwk::IInterface> iface = nullptr;
if (ao->Get(i, iface) == ERR_OK) {
TBase *iValue = TBase::Query(iface);
if (iValue != nullptr) {
natArray.push_back(T::Unbox(iValue));
}
}
}
napi_set_named_property(env, object, key.c_str(), OHOS::AbilityRuntime::CreateNativeArray(env, natArray));
return true;
}
template<class TBase, class T, class NativeT>
bool InnerWrapJsWantParams(napi_env env, napi_value object, const std::string &key, const AAFwk::WantParams &wantParams)
{
auto value = wantParams.GetParam(key);
TBase *ao = TBase::Query(value);
if (ao != nullptr) {
NativeT natValue = T::Unbox(ao);
napi_value propertyValue = OHOS::AbilityRuntime::CreateJsValue(env, natValue);
napi_set_named_property(env, object, key.c_str(), propertyValue);
return true;
}
return false;
}
} // namespace AppExecFwk
} // namespace OHOS
@@ -20,7 +20,6 @@
#include <string>
#include <vector>
#include "js_runtime_utils.h"
#include "native_engine/native_engine.h"
#include "want.h"
#include "want_params.h"
@@ -57,18 +56,8 @@ napi_value CreateJsWant(napi_env env, const AAFwk::Want &want);
napi_value CreateJsWantParams(napi_env env, const AAFwk::WantParams &wantParams);
template<class TBase, class T, class NativeT>
bool InnerWrapJsWantParams(napi_env env, napi_value object, const std::string &key, const AAFwk::WantParams &wantParams)
{
auto value = wantParams.GetParam(key);
TBase *ao = TBase::Query(value);
if (ao != nullptr) {
NativeT natValue = T::Unbox(ao);
napi_value propertyValue = OHOS::AbilityRuntime::CreateJsValue(env, natValue);
napi_set_named_property(env, object, key.c_str(), propertyValue);
return true;
}
return false;
}
bool InnerWrapJsWantParams(
napi_env env, napi_value object, const std::string &key, const AAFwk::WantParams &wantParams);
bool InnerWrapJsWantParamsWantParams(
napi_env env, napi_value object, const std::string &key, const AAFwk::WantParams &wantParams);
@@ -77,25 +66,7 @@ bool WrapJsWantParamsArray(
napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao);
template<class TBase, class T, class NativeT>
bool InnerWrapWantParamsArray(napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao)
{
long size = 0;
if (ao->GetLength(size) != ERR_OK) {
return false;
}
std::vector<NativeT> natArray;
for (long i = 0; i < size; i++) {
sptr<AAFwk::IInterface> iface = nullptr;
if (ao->Get(i, iface) == ERR_OK) {
TBase *iValue = TBase::Query(iface);
if (iValue != nullptr) {
natArray.push_back(T::Unbox(iValue));
}
}
}
napi_set_named_property(env, object, key.c_str(), OHOS::AbilityRuntime::CreateNativeArray(env, natArray));
return true;
}
bool InnerWrapWantParamsArray(napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao);
} // namespace AppExecFwk
} // namespace OHOS
#endif // OHOS_ABILITY_RUNTIME_NAPI_COMMON_WANT_H
@@ -23,7 +23,6 @@
#include "mission_continue_stub.h"
#include "napi/native_api.h"
#include "napi/native_node_api.h"
#include "js_runtime_utils.h"
#include "securec.h"
#include "want.h"
#include "remote_mission_listener_stub.h"
+1
View File
@@ -44,6 +44,7 @@ ohos_shared_library("child_process") {
deps = [
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_innerkits_path}/runtime:runtime",
"${ability_runtime_native_path}/ability/native:ability_business_error",
]
@@ -17,7 +17,7 @@
#define OHOS_ABILITY_RUNTIME_ABILITY_RUNTIME_ERROR_UTIL_H
#include <string>
#include "js_runtime_utils.h"
#include "napi/native_api.h"
namespace OHOS {
namespace AbilityRuntime {
@@ -18,6 +18,7 @@
#include <map>
#include "errors.h"
#include "hilog_tag_wrapper.h"
#include "js_runtime_utils.h"
#include "napi/native_api.h"
#include "runtime.h"
@@ -31,13 +31,15 @@
#include "double_wrapper.h"
#include "float_wrapper.h"
#include "int_wrapper.h"
#include "js_environment.h"
#include "js_runtime.h"
#include "js_runtime_lite.h"
#include "long_wrapper.h"
#include "remote_object_wrapper.h"
#include "runtime.h"
#include "short_wrapper.h"
#include "string_wrapper.h"
#include "zchar_wrapper.h"
#include "remote_object_wrapper.h"
#include "js_runtime_lite.h"
#include "js_environment.h"
using namespace OHOS::AAFwk;
using namespace OHOS::AppExecFwk;
@@ -145,7 +147,7 @@ void NapiCommonWantFuzztest2(bool boolParam, std::string &stringParam, int32_t i
void NapiCommonWantFuzztest3(bool boolParam, std::string &stringParam, int32_t int32Param)
{
std::shared_ptr<OHOS::JsEnv::JsEnvironment> jsEnv = nullptr;
AbilityRuntime::JsRuntime::Options options;
AbilityRuntime::Runtime::Options options;
auto err = JsRuntimeLite::GetInstance().CreateJsEnv(options, jsEnv);
napi_env env = reinterpret_cast<napi_env>(jsEnv->GetNativeEngine());
ElementName elementName1;
@@ -189,7 +191,7 @@ void NapiCommonWantFuzztest4(bool boolParam, std::string &stringParam, int32_t i
{
napi_value param = nullptr;
std::shared_ptr<OHOS::JsEnv::JsEnvironment> jsEnv = nullptr;
AbilityRuntime::JsRuntime::Options options;
AbilityRuntime::Runtime::Options options;
auto err = JsRuntimeLite::GetInstance().CreateJsEnv(options, jsEnv);
napi_env env = reinterpret_cast<napi_env>(jsEnv->GetNativeEngine());
Want want;
@@ -236,7 +238,7 @@ void NapiCommonWantFuzztest5(bool boolParam, std::string &stringParam, int32_t i
{
napi_value param = nullptr;
std::shared_ptr<OHOS::JsEnv::JsEnvironment> jsEnv = nullptr;
AbilityRuntime::JsRuntime::Options options;
AbilityRuntime::Runtime::Options options;
auto err = JsRuntimeLite::GetInstance().CreateJsEnv(options, jsEnv);
napi_env env = reinterpret_cast<napi_env>(jsEnv->GetNativeEngine());
napi_value nullObject = nullptr;
@@ -290,7 +292,7 @@ void NapiCommonWantFuzztest6(bool boolParam, std::string &stringParam, int32_t i
{
napi_value param = nullptr;
std::shared_ptr<OHOS::JsEnv::JsEnvironment> jsEnv = nullptr;
AbilityRuntime::JsRuntime::Options options;
AbilityRuntime::Runtime::Options options;
auto err = JsRuntimeLite::GetInstance().CreateJsEnv(options, jsEnv);
napi_env env = reinterpret_cast<napi_env>(jsEnv->GetNativeEngine());
napi_value nullObject = nullptr;
@@ -19,6 +19,8 @@
#undef private
#include "app_loader.h"
#include "js_runtime.h"
#include "js_runtime_utils.h"
#include "ohos_application.h"
using namespace testing::ext;