!93 del napi mock for bytrac

Merge pull request !93 from wenlong_12/master
This commit is contained in:
openharmony_ci
2022-07-29 03:53:28 +00:00
committed by Gitee
5 changed files with 25 additions and 111 deletions
+1 -4
View File
@@ -15,9 +15,6 @@ import("//build/ohos.gni")
group("jsapi_kits_target") {
if (support_jsapi) {
deps = [
"//developtools/bytrace/interfaces/kits/js/napi:bytrace",
"//developtools/bytrace/interfaces/kits/js/napi:hitracemeter_napi",
]
deps = [ "//developtools/bytrace/interfaces/kits/js/napi:bytrace" ]
}
}
+1 -21
View File
@@ -15,27 +15,7 @@ import("//build/ohos.gni")
import("//developtools/bytrace/bytrace.gni")
ohos_shared_library("bytrace") {
sources = [
"bytrace.cpp",
"bytrace_napi_common.cpp",
]
deps = [ "//foundation/arkui/napi:ace_napi" ]
external_deps = [
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
]
relative_install_dir = "module"
subsystem_name = "developtools"
part_name = "bytrace"
}
ohos_shared_library("hitracemeter_napi") {
sources = [
"bytrace_napi_common.cpp",
"hitracemeter.cpp",
]
sources = [ "bytrace_napi_common.cpp" ]
deps = [ "//foundation/arkui/napi:ace_napi" ]
external_deps = [
"hitrace_native:hitrace_meter",
-40
View File
@@ -1,40 +0,0 @@
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cstdio>
#include "bytrace_napi_common.h"
using namespace OHOS::Developtools::BytraceNapi;
/*
* bytrace module definition
*/
static napi_module bytrace_module = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = "bytrace",
.nm_register_func = BytraceInit,
.nm_modname = "bytrace",
.nm_priv = ((void *)0),
.reserved = {0}
};
/*
* Module registration
*/
extern "C" __attribute__((constructor)) void RegisterModule(void)
{
napi_module_register(&bytrace_module);
}
@@ -168,13 +168,11 @@ static napi_value JSTraceCount(napi_env env, napi_callback_info info)
return nullptr;
}
namespace OHOS {
namespace Developtools {
namespace BytraceNapi {
/*
* function for module exports
*/
napi_value BytraceInit(napi_env env, napi_value exports)
EXTERN_C_START
static napi_value BytraceInit(napi_env env, napi_value exports)
{
static napi_property_descriptor desc[] = {
DECLARE_NAPI_FUNCTION("startTrace", JSTraceStart),
@@ -184,6 +182,25 @@ napi_value BytraceInit(napi_env env, napi_value exports)
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc));
return exports;
}
}
}
EXTERN_C_END
/*
* bytrace module definition
*/
static napi_module bytrace_module = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = "bytrace",
.nm_register_func = BytraceInit,
.nm_modname = "bytrace",
.nm_priv = ((void *)0),
.reserved = {0}
};
/*
* Module registration
*/
extern "C" __attribute__((constructor)) void RegisterModule(void)
{
napi_module_register(&bytrace_module);
}
-40
View File
@@ -1,40 +0,0 @@
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cstdio>
#include "bytrace_napi_common.h"
using namespace OHOS::Developtools::BytraceNapi;
/*
* hiTraceMeter module definition
*/
static napi_module hitracemeter_module = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = "hiTraceMeter",
.nm_register_func = BytraceInit,
.nm_modname = "hiTraceMeter",
.nm_priv = ((void *)0),
.reserved = {0}
};
/*
* Module registration
*/
extern "C" __attribute__((constructor)) void RegisterModule(void)
{
napi_module_register(&hitracemeter_module);
}