Signed-off-by: lwx1285820 <lishaoxiong10@huawei.com>
Change-Id: I08438e76e9d7f8a7a857054b4ae1861402f0cbb8
This commit is contained in:
lwx1285820 2024-04-12 08:34:00 +00:00
parent 7f23d76dad
commit 78e2f2f94c
6 changed files with 33 additions and 40 deletions

View File

@ -576,7 +576,6 @@ void JsEventCooperateTarget::CallGetStateAsyncWork(uv_work_t *work, int32_t stat
void JsEventCooperateTarget::EmitCoordinationMessageEvent(uv_work_t *work, int32_t status)
{
CALL_INFO_TRACE;
std::lock_guard<std::mutex> guard(mutex_);
CHKPV(work);
if (work->data == nullptr) {
JsUtilCooperate::DeletePtr<uv_work_t*>(work);
@ -585,6 +584,7 @@ void JsEventCooperateTarget::EmitCoordinationMessageEvent(uv_work_t *work, int32
}
sptr<JsUtilCooperate::CallbackInfo> temp(static_cast<JsUtilCooperate::CallbackInfo*>(work->data));
JsUtilCooperate::DeletePtr<uv_work_t*>(work);
std::lock_guard<std::mutex> guard(mutex_);
temp->DecStrongRef(nullptr);
auto msgEvent = coordinationListeners_.find(COORDINATION);
if (msgEvent == coordinationListeners_.end()) {
@ -592,13 +592,12 @@ void JsEventCooperateTarget::EmitCoordinationMessageEvent(uv_work_t *work, int32
return;
}
for (const auto &item : msgEvent->second) {
napi_handle_scope scope = nullptr;
napi_open_handle_scope(item->env, &scope);
if (item->env == nullptr || item->ref != temp->ref) {
FI_HILOGW("item->env is nullptr, skip then continue")
napi_close_handle_scope(item->env, scope);
CHKPC(item->env);
if (item->ref != temp->ref) {
continue;
}
napi_handle_scope scope = nullptr;
napi_open_handle_scope(item->env, &scope);
napi_value deviceDescriptor = nullptr;
CHKRV_SCOPE(item->env, napi_create_string_utf8(item->env, item->data.deviceDescriptor.c_str(),
NAPI_AUTO_LENGTH, &deviceDescriptor), CREATE_STRING_UTF8, scope);

View File

@ -613,18 +613,12 @@ void JsEventTarget::EmitCoordinationMessageEvent(uv_work_t *work, int32_t status
}
for (const auto &item : messageEvent->second) {
CHKPC(item->env);
if (item->ref != temp->ref) {
continue;
}
napi_handle_scope scope = nullptr;
napi_open_handle_scope(item->env, &scope);
if (item->env == nullptr) {
FI_HILOGW("item->env is nullptr, skip then continue");
napi_close_handle_scope(item->env, scope);
continue;
}
if (item->ref != temp->ref) {
napi_close_handle_scope(item->env, scope);
continue;
}
napi_value deviceDescriptor = nullptr;
CHKRV_SCOPE(item->env, napi_create_string_utf8(item->env, item->data.deviceDescriptor.c_str(),
NAPI_AUTO_LENGTH, &deviceDescriptor), CREATE_STRING_UTF8, scope);

View File

@ -388,7 +388,7 @@ int32_t Device::ReadConfigFile(const std::string &filePath)
}
pos = tmp.find('=');
if (tmp.size() == 0) {
FI_HILOGE("tmp.size() - 1 will overflow");
FI_HILOGE("Invalid size, pos will overflow");
return RET_ERR;
} else if ((pos == (tmp.size() - 1)) || (pos == tmp.npos)) {
FI_HILOGE("Find config item error");

View File

@ -123,7 +123,7 @@ bool DeviceStatusDataParse::DisableCount(const Type type)
{
CALL_DEBUG_ENTER;
if (tempcount_.size() <= static_cast<int32_t>(type)) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, size is %{public}zu", tempcount_.size());
return false;
}
tempcount_[static_cast<int32_t>(type)] = static_cast<int32_t>(TypeValue::INVALID);

View File

@ -164,7 +164,7 @@ bool CheckNodesValid()
{
FI_HILOGD("enter");
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return false;
} else if (g_drawingInfo.nodes.empty() || g_drawingInfo.nodes[DRAG_STYLE_INDEX] == nullptr) {
FI_HILOGE("Nodes invalid");
@ -231,7 +231,7 @@ int32_t DragDrawing::Init(const DragData &dragData)
return INIT_FAIL;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX || g_drawingInfo.nodes.size() <= PIXEL_MAP_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return INIT_FAIL;
}
std::shared_ptr<Rosen::RSCanvasNode> shadowNode = g_drawingInfo.nodes[PIXEL_MAP_INDEX];
@ -351,7 +351,7 @@ int32_t DragDrawing::UpdateShadowPic(const ShadowInfo &shadowInfo)
return RET_ERR;
}
if (g_drawingInfo.nodes.size() <= PIXEL_MAP_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
}
std::shared_ptr<Rosen::RSCanvasNode> shadowNode = g_drawingInfo.nodes[PIXEL_MAP_INDEX];
@ -383,7 +383,7 @@ void DragDrawing::OnDragSuccess()
return;
}
if (g_drawingInfo.nodes.size() <= PIXEL_MAP_INDEX || g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> shadowNode = g_drawingInfo.nodes[PIXEL_MAP_INDEX];
@ -413,7 +413,7 @@ void DragDrawing::EraseMouseIcon()
return;
}
if (g_drawingInfo.nodes.size() <= MOUSE_ICON_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> mouseIconNode = g_drawingInfo.nodes[MOUSE_ICON_INDEX];
@ -576,7 +576,7 @@ void DragDrawing::StartStyleAnimation(float startScale, float endScale, int32_t
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -634,7 +634,7 @@ void DragDrawing::OnDragStyleAnimation()
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -694,7 +694,7 @@ void DragDrawing::OnStopAnimationSuccess()
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -767,7 +767,7 @@ void DragDrawing::OnStopAnimationFail()
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -868,7 +868,7 @@ int32_t DragDrawing::DrawMouseIcon()
return RET_ERR;
}
if (g_drawingInfo.nodes.size() <= MOUSE_ICON_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
}
std::shared_ptr<Rosen::RSCanvasNode> mouseIconNode = g_drawingInfo.nodes[MOUSE_ICON_INDEX];
@ -1181,7 +1181,7 @@ void DragDrawing::RemoveModifier()
}
if (g_drawingInfo.nodes.size() <= PIXEL_MAP_INDEX || g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> pixelMapNode = g_drawingInfo.nodes[PIXEL_MAP_INDEX];
@ -1554,7 +1554,7 @@ void DragDrawing::ProcessFilter()
{
FI_HILOGD("enter");
if (g_drawingInfo.nodes.size() <= BACKGROUND_FILTER_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> filterNode = g_drawingInfo.nodes[BACKGROUND_FILTER_INDEX];
@ -1647,7 +1647,7 @@ int32_t DragDrawing::UpdatePreviewStyle(const PreviewStyle &previewStyle)
{
FI_HILOGD("enter");
if (g_drawingInfo.nodes.size() <= PIXEL_MAP_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
} else if (ModifyPreviewStyle(g_drawingInfo.nodes[PIXEL_MAP_INDEX], previewStyle) != RET_OK) {
FI_HILOGE("ModifyPreviewStyle failed");
@ -1723,7 +1723,7 @@ void DragDrawing::DoDrawMouse()
return;
}
if (g_drawingInfo.nodes.size() <= MOUSE_ICON_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> mouseIconNode = g_drawingInfo.nodes[MOUSE_ICON_INDEX];
@ -1749,7 +1749,7 @@ int32_t DragDrawing::UpdateDefaultDragStyle(DragCursorStyle style)
return RET_ERR;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
}
if (!g_drawingInfo.isCurrentDefaultStyle) {
@ -1776,7 +1776,7 @@ int32_t DragDrawing::UpdateValidDragStyle(DragCursorStyle style)
return RET_ERR;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -2076,7 +2076,7 @@ int32_t DragDrawing::DoRotateDragWindow(float rotation)
return RET_ERR;
}
if (g_drawingInfo.nodes.size() <= MOUSE_ICON_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return RET_ERR;
}
std::shared_ptr<Rosen::RSCanvasNode> mouseIconNode = g_drawingInfo.nodes[MOUSE_ICON_INDEX];
@ -2231,7 +2231,7 @@ void DrawMouseIconModifier::OnDraw(std::shared_ptr<Media::PixelMap> pixelMap, in
g_drawingInfo.mouseWidth = pixelMap->GetWidth();
g_drawingInfo.mouseHeight = pixelMap->GetHeight();
if (g_drawingInfo.nodes.size() <= MOUSE_ICON_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> mouseIconNode = g_drawingInfo.nodes[MOUSE_ICON_INDEX];
@ -2292,7 +2292,7 @@ void DrawStyleChangeModifier::Draw(Rosen::RSDrawingContext &context) const
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -2348,7 +2348,7 @@ void DrawStyleScaleModifier::Draw(Rosen::RSDrawingContext &context) const
return;
}
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];
@ -2383,7 +2383,7 @@ void DrawDragStopModifier::Draw(Rosen::RSDrawingContext &context) const
g_drawingInfo.parentNode->SetAlpha(alpha_->Get());
g_drawingInfo.parentNode->SetScale(scale_->Get(), scale_->Get());
if (g_drawingInfo.nodes.size() <= DRAG_STYLE_INDEX) {
FI_HILOGE("The index is out of bounds");
FI_HILOGE("The index is out of bounds, node size is %{public}zu", g_drawingInfo.nodes.size());
return;
}
std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode = g_drawingInfo.nodes[DRAG_STYLE_INDEX];

View File

@ -153,7 +153,7 @@ bool VirtualDeviceBuilder::ExecuteUnmount(const char *id, const char *name, cons
spath << "/cmdline";
char realPath[PATH_MAX] = { 0 };
if (realpath(spath.str().c_str(), realPath) == nullptr) {
std::cout << "Invalid path" << spath.str().c_str() <<std::endl;
std::cout << "Invalid path" << spath.str().c_str() << std::endl;
return false;
}
std::ifstream stream(spath.str(), std::ios::in);