代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/hiviewdfx_hisysevent 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 69d852f1b2e243188e06d6462343dc0ed06f772d Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:19:42 +0800
Subject: [PATCH] remove dependency and adapt for build
---
interfaces/innerkits/ipc_core/BUILD.gn | 4 +-
.../ipc_core/include/iremote_broker.h | 1 +
.../ipc_core/include/message_parcel.h | 1 +
interfaces/innerkits/ipc_single/BUILD.gn | 2 +-
.../access_token/src/access_token_adapter.c | 2 +-
.../src/core/source/ipc_object_proxy.cpp | 2 +-
.../src/core/source/ipc_object_stub.cpp | 76 ++++---
ipc/native/src/core/source/iremote_broker.cpp | 2 +-
.../src/mock/include/dbinder_base_invoker.h | 12 +-
ipc/native/src/mock/include/hitrace_invoker.h | 18 +-
ipc/native/src/mock/include/invoker_factory.h | 1 +
.../src/mock/source/binder_connector.cpp | 2 +-
ipc/native/src/mock/source/binder_invoker.cpp | 12 +-
.../src/mock/source/hitrace_invoker.cpp | 212 +++++++++---------
.../src/mock/source/invoker_factory.cpp | 2 +-
.../src/napi/src/napi_remote_object.cpp | 2 +-
ipc/native/src/napi/src/napi_remote_proxy.cpp | 2 +-
.../unittest/common/ipc_hitrace_unittest.cpp | 2 +-
.../include/dbinder_test_service_skeleton.h | 2 +-
19 files changed, 181 insertions(+), 176 deletions(-)
diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn
index cb35083..3c4d57b 100644
--- a/interfaces/innerkits/ipc_core/BUILD.gn
+++ b/interfaces/innerkits/ipc_core/BUILD.gn
@@ -71,10 +71,10 @@ ohos_shared_library("ipc_core") {
all_dependent_configs = [ ":ipc_all_deps_config" ]
external_deps = [
- "access_token:libaccesstoken_sdk",
+ # "access_token:libaccesstoken_sdk",
"c_utils:utils",
"dsoftbus:softbus_client",
- "hitrace_native:libhitracechain",
+ # "hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
]
diff --git a/interfaces/innerkits/ipc_core/include/iremote_broker.h b/interfaces/innerkits/ipc_core/include/iremote_broker.h
index ed2045c..7105ff7 100644
--- a/interfaces/innerkits/ipc_core/include/iremote_broker.h
+++ b/interfaces/innerkits/ipc_core/include/iremote_broker.h
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <functional>
+#include <mutex>
#include "iremote_object.h"
#include "refbase.h"
diff --git a/interfaces/innerkits/ipc_core/include/message_parcel.h b/interfaces/innerkits/ipc_core/include/message_parcel.h
index 0f3302e..efa57ab 100644
--- a/interfaces/innerkits/ipc_core/include/message_parcel.h
+++ b/interfaces/innerkits/ipc_core/include/message_parcel.h
@@ -20,6 +20,7 @@
#include "parcel.h"
#include "refbase.h"
#include <string>
+#include <memory>
namespace OHOS {
class IRemoteObject;
diff --git a/interfaces/innerkits/ipc_single/BUILD.gn b/interfaces/innerkits/ipc_single/BUILD.gn
index de33cdb..f61f26c 100644
--- a/interfaces/innerkits/ipc_single/BUILD.gn
+++ b/interfaces/innerkits/ipc_single/BUILD.gn
@@ -59,7 +59,7 @@ ohos_shared_library("ipc_single") {
external_deps = [
"c_utils:utils",
- "hitrace_native:libhitracechain",
+ # "hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
]
diff --git a/ipc/native/c/adapter/access_token/src/access_token_adapter.c b/ipc/native/c/adapter/access_token/src/access_token_adapter.c
index c25aa57..396cee4 100644
--- a/ipc/native/c/adapter/access_token/src/access_token_adapter.c
+++ b/ipc/native/c/adapter/access_token/src/access_token_adapter.c
@@ -19,7 +19,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
-#include "bits/ioctl.h"
+// #include "bits/ioctl.h"
#define ACCESS_TOKEN_ID_IOCTL_BASE 'A'
diff --git a/ipc/native/src/core/source/ipc_object_proxy.cpp b/ipc/native/src/core/source/ipc_object_proxy.cpp
index 559c276..23f56a8 100644
--- a/ipc/native/src/core/source/ipc_object_proxy.cpp
+++ b/ipc/native/src/core/source/ipc_object_proxy.cpp
@@ -17,7 +17,7 @@
#include <cstdint>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "algorithm"
#include "errors.h"
#include "hilog/log_c.h"
diff --git a/ipc/native/src/core/source/ipc_object_stub.cpp b/ipc/native/src/core/source/ipc_object_stub.cpp
index 28df2cd..781d600 100644
--- a/ipc/native/src/core/source/ipc_object_stub.cpp
+++ b/ipc/native/src/core/source/ipc_object_stub.cpp
@@ -39,8 +39,8 @@
#include "vector"
#ifndef CONFIG_IPC_SINGLE
-#include "accesstoken_kit.h"
-#include "access_token_adapter.h"
+// #include "accesstoken_kit.h"
+// #include "access_token_adapter.h"
#include "dbinder_databus_invoker.h"
#include "dbinder_error_code.h"
#include "rpc_feature_set.h"
@@ -56,10 +56,10 @@ static constexpr int HIDUMPER_SERVICE_UID = 1212;
using namespace OHOS::HiviewDFX;
static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_ID_IPC, "IPCObjectStub" };
#ifndef CONFIG_IPC_SINGLE
-using namespace OHOS::Security;
+// using namespace OHOS::Security;
// Authentication information can be added only for processes with system permission.
static constexpr pid_t ALLOWED_UID = 10000;
-static constexpr int APL_BASIC = 2;
+// static constexpr int APL_BASIC = 2;
// Only the samgr can obtain the UID and PID.
static const std::string SAMGR_PROCESS_NAME = "samgr";
#endif
@@ -259,7 +259,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel
break;
}
case GRANT_DATABUS_NAME: {
- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) {
+ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) {
ZLOGE(LABEL, "GRANT_DATABUS_NAME message is excluded in sa manager");
result = IPC_STUB_INVALID_DATA_ERR;
break;
@@ -268,7 +268,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel
break;
}
case TRANS_DATABUS_NAME: {
- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) {
+ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) {
ZLOGE(LABEL, "TRANS_DATABUS_NAME message is excluded in sa manager");
result = IPC_STUB_INVALID_DATA_ERR;
break;
@@ -611,41 +611,43 @@ std::string IPCObjectStub::CreateDatabusName(int uid, int pid, int systemAbility
bool IPCObjectStub::IsSamgrCall(uint32_t accessToken)
{
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- ZLOGE(LABEL, "not native call");
- return false;
- }
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
- if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
- return true;
- }
- ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str());
- return false;
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
+ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // ZLOGE(LABEL, "not native call");
+ // return false;
+ // }
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
+ // if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
+ // return true;
+ // }
+ // ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str());
+ // return false;
+ return true;
}
bool IPCObjectStub::HasDumpPermission(uint32_t accessToken) const
{
- int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP");
- if (res == AccessToken::PermissionState::PERMISSION_GRANTED) {
- return true;
- }
- bool ret = false;
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
- if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
- ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC);
- } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) {
- AccessToken::HapTokenInfo hapTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo);
- ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC);
- }
- if (!ret) {
- ZLOGD(LABEL, "No dump permission, please check!");
- }
- return ret;
+ // int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP");
+ // if (res == AccessToken::PermissionState::PERMISSION_GRANTED) {
+ // return true;
+ // }
+ // bool ret = false;
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
+ // if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
+ // ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC);
+ // } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) {
+ // AccessToken::HapTokenInfo hapTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo);
+ // ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC);
+ // }
+ // if (!ret) {
+ // ZLOGD(LABEL, "No dump permission, please check!");
+ // }
+ // return ret;
+ return true;
}
#endif
} // namespace OHOS
diff --git a/ipc/native/src/core/source/iremote_broker.cpp b/ipc/native/src/core/source/iremote_broker.cpp
index dcbb59c..12f498e 100644
--- a/ipc/native/src/core/source/iremote_broker.cpp
+++ b/ipc/native/src/core/source/iremote_broker.cpp
@@ -17,7 +17,7 @@
#include <utility>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "functional"
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
diff --git a/ipc/native/src/mock/include/dbinder_base_invoker.h b/ipc/native/src/mock/include/dbinder_base_invoker.h
index ca7fd8e..7d40e7d 100644
--- a/ipc/native/src/mock/include/dbinder_base_invoker.h
+++ b/ipc/native/src/mock/include/dbinder_base_invoker.h
@@ -701,9 +701,9 @@ int DBinderBaseInvoker<T>::SendRequest(int32_t handle, uint32_t code, MessagePar
int userWaitTime = option.GetWaitTime();
MessageParcel &newData = const_cast<MessageParcel &>(data);
size_t oldWritePosition = newData.GetWritePosition();
- HiTraceId traceId = HiTraceChain::GetId();
+ // HiTraceId traceId = HiTraceChain::GetId();
// set client send trace point if trace is enabled
- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
+ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
std::shared_ptr<T> session = WriteTransaction(BC_TRANSACTION, flags, handle, 0, code, data, seqNumber, 0);
if (session == nullptr) {
newData.RewindWrite(oldWritePosition);
@@ -720,7 +720,7 @@ int DBinderBaseInvoker<T>::SendRequest(int32_t handle, uint32_t code, MessagePar
} else {
ret = SendOrWaitForCompletion(userWaitTime, seqNumber, session, &reply);
}
- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
+ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
// restore Parcel data
newData.RewindWrite(oldWritePosition);
return ret;
@@ -865,8 +865,8 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
data.InjectOffsets(reinterpret_cast<binder_uintptr_t>(reinterpret_cast<char *>(tr->buffer) + tr->offsets),
tr->offsets_size / sizeof(binder_size_t));
}
- uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags);
+ // uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
+ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags);
const pid_t oldPid = GetCallerPid();
const auto oldUid = static_cast<const uid_t>(GetCallerUid());
@@ -918,7 +918,7 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
ZLOGE(LOG_LABEL, "delete raw data in process skeleton");
current->DetachRawData(listenFd);
}
- HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags);
+ // HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags);
if (!(flags & MessageOption::TF_ASYNC)) {
SetClientFd(listenFd);
SetSeqNum(senderSeqNumber);
diff --git a/ipc/native/src/mock/include/hitrace_invoker.h b/ipc/native/src/mock/include/hitrace_invoker.h
index 7da8029..785a1d2 100644
--- a/ipc/native/src/mock/include/hitrace_invoker.h
+++ b/ipc/native/src/mock/include/hitrace_invoker.h
@@ -16,24 +16,24 @@
#ifndef OHOS_IPC_HITRACE_INVOKER_H
#define OHOS_IPC_HITRACE_INVOKER_H
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "iremote_object.h"
namespace OHOS {
class HitraceInvoker {
public:
- static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId);
+ // static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId);
- static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
- const HiviewDFX::HiTraceId &traceId);
+ // static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
+ // const HiviewDFX::HiTraceId &traceId);
- static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId,
- const HiviewDFX::HiTraceId &childId);
+ // static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId,
+ // const HiviewDFX::HiTraceId &childId);
- static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen);
+ // static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen);
- static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags);
+ // static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags);
- static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags);
+ // static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags);
private:
static const int PADDED_SIZE_OF_PARCEL = 4;
diff --git a/ipc/native/src/mock/include/invoker_factory.h b/ipc/native/src/mock/include/invoker_factory.h
index 14bd25f..83086c5 100644
--- a/ipc/native/src/mock/include/invoker_factory.h
+++ b/ipc/native/src/mock/include/invoker_factory.h
@@ -17,6 +17,7 @@
#define OHOS_IPC_INVOKER_FACTORY_H
#include <functional>
+#include <mutex>
#include <unordered_map>
#include "iremote_invoker.h"
diff --git a/ipc/native/src/mock/source/binder_connector.cpp b/ipc/native/src/mock/source/binder_connector.cpp
index a262de6..733769d 100644
--- a/ipc/native/src/mock/source/binder_connector.cpp
+++ b/ipc/native/src/mock/source/binder_connector.cpp
@@ -21,7 +21,7 @@
#include <sys/mman.h>
#include <unistd.h>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "cerrno"
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
diff --git a/ipc/native/src/mock/source/binder_invoker.cpp b/ipc/native/src/mock/source/binder_invoker.cpp
index 9ce6b59..946940c 100644
--- a/ipc/native/src/mock/source/binder_invoker.cpp
+++ b/ipc/native/src/mock/source/binder_invoker.cpp
@@ -96,9 +96,9 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M
uint32_t flags = (uint32_t)option.GetFlags();
MessageParcel &newData = const_cast<MessageParcel &>(data);
size_t oldWritePosition = newData.GetWritePosition();
- HiTraceId traceId = HiTraceChain::GetId();
+ // HiTraceId traceId = HiTraceChain::GetId();
// set client send trace point if trace is enabled
- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
+ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
if (!WriteTransaction(BC_TRANSACTION, flags, handle, code, data, nullptr)) {
newData.RewindWrite(oldWritePosition);
ZLOGE(LABEL, "WriteTransaction ERROR");
@@ -114,7 +114,7 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M
} else {
error = WaitForCompletion(&reply);
}
- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
+ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
// restore Parcel data
newData.RewindWrite(oldWritePosition);
if (error != ERR_NONE) {
@@ -413,8 +413,8 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer)
if (tr->offsets_size > 0) {
data->InjectOffsets(tr->data.ptr.offsets, tr->offsets_size / sizeof(binder_size_t));
}
- uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags);
+ // uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
+ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags);
const pid_t oldPid = callerPid_;
const auto oldUid = static_cast<const uid_t>(callerUid_);
const uint32_t oldToken = callerTokenID_;
@@ -469,7 +469,7 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer)
Str16ToStr8(targetObject->descriptor_).c_str(), tr->code, duration);
}
}
- HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags);
+ // HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags);
if (!(flagValue & TF_ONE_WAY)) {
SendReply(reply, 0, error);
}
diff --git a/ipc/native/src/mock/source/hitrace_invoker.cpp b/ipc/native/src/mock/source/hitrace_invoker.cpp
index 4f7f7c3..bc55772 100644
--- a/ipc/native/src/mock/source/hitrace_invoker.cpp
+++ b/ipc/native/src/mock/source/hitrace_invoker.cpp
@@ -20,7 +20,7 @@
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "ipc_debug.h"
#include "log_tags.h"
#include "parcel.h"
@@ -29,118 +29,118 @@
namespace OHOS {
// the value should be equal to the set of parcel
using namespace OHOS::HiviewDFX;
-static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" };
+// static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" };
-bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId)
-{
- return (traceId.IsValid() && (handle != 0) &&
- ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true));
-}
+// bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId)
+// {
+// return (traceId.IsValid() && (handle != 0) &&
+// ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true));
+// }
-HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
- const HiTraceId &traceId)
-{
- HiTraceId childId = traceId;
- bool isClientTraced = IsClientTraced(handle, flags, traceId);
- if (isClientTraced) {
- childId = HiTraceChain::CreateSpan();
- // add childid to parcel data
- uint8_t idBytes[HITRACE_ID_LEN];
- size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN));
- if (idLen != HITRACE_ID_LEN) {
- ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__);
- return childId;
- }
+// HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
+// const HiTraceId &traceId)
+// {
+// HiTraceId childId = traceId;
+// bool isClientTraced = IsClientTraced(handle, flags, traceId);
+// if (isClientTraced) {
+// childId = HiTraceChain::CreateSpan();
+// // add childid to parcel data
+// uint8_t idBytes[HITRACE_ID_LEN];
+// size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN));
+// if (idLen != HITRACE_ID_LEN) {
+// ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__);
+// return childId;
+// }
- size_t oldWritePosition = data.GetWritePosition();
- if (!data.WriteBuffer(idBytes, idLen)) {
- ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__);
- // restore Parcel data
- data.RewindWrite(oldWritePosition);
- return childId;
- }
+// size_t oldWritePosition = data.GetWritePosition();
+// if (!data.WriteBuffer(idBytes, idLen)) {
+// ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__);
+// // restore Parcel data
+// data.RewindWrite(oldWritePosition);
+// return childId;
+// }
- // padded size of traceid
- if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) {
- ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__);
- // restore Parcel data
- data.RewindWrite(oldWritePosition);
- return childId;
- }
- // tracepoint: CS(Client Send)
- HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u",
- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
- handle, code);
- flags |= TF_HITRACE;
- }
- return childId;
-}
+// // padded size of traceid
+// if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) {
+// ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__);
+// // restore Parcel data
+// data.RewindWrite(oldWritePosition);
+// return childId;
+// }
+// // tracepoint: CS(Client Send)
+// HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u",
+// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
+// handle, code);
+// flags |= TF_HITRACE;
+// }
+// return childId;
+// }
-void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId,
- const HiTraceId &childId)
-{
- if (!(flags & TF_HITRACE)) {
- return;
- }
- bool isClientTraced = IsClientTraced(handle, flags, traceId);
- if (isClientTraced) {
- if (!(flags & TF_ONE_WAY)) {
- // restore thread trace id
- HiTraceChain::SetId(traceId);
- // tracepoint: CR(Client Receive)
- HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code);
- }
- }
-}
+// void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId,
+// const HiTraceId &childId)
+// {
+// if (!(flags & TF_HITRACE)) {
+// return;
+// }
+// bool isClientTraced = IsClientTraced(handle, flags, traceId);
+// if (isClientTraced) {
+// if (!(flags & TF_ONE_WAY)) {
+// // restore thread trace id
+// HiTraceChain::SetId(traceId);
+// // tracepoint: CR(Client Receive)
+// HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code);
+// }
+// }
+// }
-void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen)
-{
- // restore data
- data.RewindRead(oldReadPosition);
- // padded size(4 bytes) of uint8_t
- data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
- flags &= ~(uint32_t)TF_HITRACE;
-}
+// void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen)
+// {
+// // restore data
+// data.RewindRead(oldReadPosition);
+// // padded size(4 bytes) of uint8_t
+// data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
+// flags &= ~(uint32_t)TF_HITRACE;
+// }
-bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags)
-{
- bool isServerTraced = (flags & TF_HITRACE) != 0;
- if (isServerTraced) {
- size_t oldReadPosition = data.GetReadPosition();
- // padded size(4 bytes) of uint8_t
- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL);
- // the padded size of traceid
- uint8_t idLen = data.ReadUint8();
- if (idLen >= sizeof(HiTraceIdStruct)) {
- // padded size(4 bytes) of uint8_t
- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
- const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct));
- if (idBytes == nullptr) {
- ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__);
- isServerTraced = 0;
- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
- return isServerTraced;
- }
- HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct));
- HiTraceChain::SetId(traceId);
- // tracepoint: SR(Server Receive)
- HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId,
- "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
- handle, code);
- }
+// bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags)
+// {
+// bool isServerTraced = (flags & TF_HITRACE) != 0;
+// if (isServerTraced) {
+// size_t oldReadPosition = data.GetReadPosition();
+// // padded size(4 bytes) of uint8_t
+// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL);
+// // the padded size of traceid
+// uint8_t idLen = data.ReadUint8();
+// if (idLen >= sizeof(HiTraceIdStruct)) {
+// // padded size(4 bytes) of uint8_t
+// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
+// const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct));
+// if (idBytes == nullptr) {
+// ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__);
+// isServerTraced = 0;
+// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
+// return isServerTraced;
+// }
+// HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct));
+// HiTraceChain::SetId(traceId);
+// // tracepoint: SR(Server Receive)
+// HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId,
+// "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
+// handle, code);
+// }
- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
- }
- return isServerTraced;
-}
+// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
+// }
+// return isServerTraced;
+// }
-void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags)
-{
- if (isServerTraced) {
- // tracepoint: SS(Server Send)
- HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u",
- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code);
- }
- HiTraceChain::ClearId();
-}
+// void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags)
+// {
+// if (isServerTraced) {
+// // tracepoint: SS(Server Send)
+// HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u",
+// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code);
+// }
+// HiTraceChain::ClearId();
+// }
} // namespace OHOS
diff --git a/ipc/native/src/mock/source/invoker_factory.cpp b/ipc/native/src/mock/source/invoker_factory.cpp
index 5b2946b..e539639 100644
--- a/ipc/native/src/mock/source/invoker_factory.cpp
+++ b/ipc/native/src/mock/source/invoker_factory.cpp
@@ -18,7 +18,7 @@
#include <memory>
#include <utility>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "functional"
#include "iremote_invoker.h"
#include "unordered_map"
diff --git a/ipc/native/src/napi/src/napi_remote_object.cpp b/ipc/native/src/napi/src/napi_remote_object.cpp
index 1275bb3..4ff5260 100644
--- a/ipc/native/src/napi/src/napi_remote_object.cpp
+++ b/ipc/native/src/napi/src/napi_remote_object.cpp
@@ -22,7 +22,7 @@
#include <uv.h>
#include "access_token_adapter.h"
#include "hilog/log.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "ipc_skeleton.h"
diff --git a/ipc/native/src/napi/src/napi_remote_proxy.cpp b/ipc/native/src/napi/src/napi_remote_proxy.cpp
index 0239944..9b4c6d9 100644
--- a/ipc/native/src/napi/src/napi_remote_proxy.cpp
+++ b/ipc/native/src/napi/src/napi_remote_proxy.cpp
@@ -21,7 +21,7 @@
#include <uv.h>
#include "access_token_adapter.h"
#include "hilog/log.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "ipc_skeleton.h"
diff --git a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
index 8b008f5..77649f0 100644
--- a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
+++ b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
@@ -23,7 +23,7 @@
#include <securec.h>
#include <gtest/gtest.h>
#include "ipc_debug.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "ipc_skeleton.h"
#include "ipc_object_proxy.h"
#include "test_service_skeleton.h"
diff --git a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
index 41fe229..40d5177 100644
--- a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
+++ b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
@@ -23,7 +23,7 @@
#include "iremote_proxy.h"
#include "hilog/log.h"
#include "log_tags.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
namespace OHOS {
class IDBinderTestService : public IRemoteBroker {
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。