Use inline to decorate static members

Signed-off-by: wuliangdong <wuliangdong1@huawei.com>
Change-Id: If2423093f3085251824dedb208c7e7ff64550302
This commit is contained in:
wuliangdong 2024-07-02 01:56:59 +00:00
parent 637061fb29
commit be105c157a
7 changed files with 19 additions and 19 deletions

View File

@ -79,7 +79,7 @@ private:
std::string networkId;
CoordinationMessage msg { CoordinationMessage::UNKNOW };
};
static std::queue<CoordinationEvent> eventQueue_;
inline static std::queue<CoordinationEvent> eventQueue_;
inline static std::map<std::string_view, std::vector<sptr<JsUtil::CallbackInfo>>> coordinationListeners_;
inline static std::map<std::string, std::vector<sptr<JsUtil::MouseCallbackInfo>>> mouseLocationListeners_;
};

View File

@ -56,7 +56,7 @@ constexpr int32_t MAX_PIXEL_MAP_HEIGHT { 600 };
constexpr int32_t MOUSE_POINTER_ID { 0 };
constexpr int32_t TOUCH_POINTER_ID { 1 };
constexpr int32_t MOUSE_POINTER_ID_INJECT { 10000 };
constexpr int32_t TOUCH_POINTER_ID_INJECT { 10001 };
constexpr int32_t TOUCH_POINTER_ID_INJECT { 20001 };
constexpr int32_t DISPLAY_ID { 0 };
constexpr int32_t DRAG_SRC_X { 0 };
constexpr int32_t DRAG_SRC_Y { 0 };

View File

@ -96,16 +96,16 @@ CooperateFree::Initial::Initial(CooperateFree &parent)
: ICooperateStep(parent, nullptr), parent_(parent)
{
AddHandler(CooperateEventType::START, [this](Context &context, const CooperateEvent &event) {
this->OnStart(context, event);
this->OnStart(context, event);
});
AddHandler(CooperateEventType::STOP, [this](Context &context, const CooperateEvent &event) {
this->OnStop(context, event);
this->OnStop(context, event);
});
AddHandler(CooperateEventType::APP_CLOSED, [this](Context &context, const CooperateEvent &event) {
this->OnAppClosed(context, event);
this->OnAppClosed(context, event);
});
AddHandler(CooperateEventType::DSOFTBUS_START_COOPERATE, [this](Context &context, const CooperateEvent &event) {
this->OnRemoteStart(context, event);
this->OnRemoteStart(context, event);
});
}

View File

@ -72,7 +72,7 @@ void DisplayChangeEventListener::OnChange(Rosen::DisplayId displayId)
}
lastRotation_ = currentRotation;
CHKPV(context_);
int32_t ret = context_->GetDelegateTasks().PostAsyncTask([this, &currentRotation] {
int32_t ret = context_->GetDelegateTasks().PostAsyncTask([this, currentRotation] {
return this->context_->GetDragManager().RotateDragWindow(currentRotation);
});
if (ret != RET_OK) {

View File

@ -2010,7 +2010,7 @@ int32_t DragDrawing::EnterTextEditorArea(bool enable)
DRAG_DATA_MGR.SetPixelMapLocation({ g_drawingInfo.pixelMapX, g_drawingInfo.pixelMapY });
int32_t positionX = g_drawingInfo.displayX + g_drawingInfo.pixelMapX;
int32_t positionY = g_drawingInfo.displayY + g_drawingInfo.pixelMapY - TWELVE_SIZE * GetScaling();
if (RunAnimation([this, &positionX, &positionY] {
if (RunAnimation([this, positionX, positionY] {
return this->SetNodesLocation(positionX, positionY);
}) != RET_OK) {
FI_HILOGE("RunAnimation to SetNodesLocation failed");

View File

@ -86,7 +86,7 @@ void EventHub::OnReceiveEvent(const EventFwk::CommonEventData &event)
}
return RET_OK;
};
int32_t ret = context_->GetDelegateTasks().PostAsyncTask([this, &fun] {
int32_t ret = context_->GetDelegateTasks().PostAsyncTask([this, fun] {
return fun(this->context_);
});
if (ret != RET_OK) {

View File

@ -360,9 +360,9 @@ int32_t DeviceStatusService::AllocSocketFd(const std::string &programName, int32
int32_t pid = GetCallingPid();
int32_t uid = GetCallingUid();
int32_t ret = delegateTasks_.PostSyncTask(
[this, &programName, &moduleType, &uid, &pid, &serverFd, &toReturnClientFd, &tokenType] {
[this, programName, moduleType, uid, pid, &serverFd, &toReturnClientFd, &tokenType] {
return this->AddSocketPairInfo(programName, moduleType, uid, pid, serverFd,
std::ref(toReturnClientFd), tokenType);
toReturnClientFd, tokenType);
});
if (ret != RET_OK) {
FI_HILOGE("Call Add socket pair info failed, return:%{public}d", ret);
@ -740,7 +740,7 @@ int32_t DeviceStatusService::GetCoordinationState(const std::string &udId, bool
#ifdef OHOS_BUILD_ENABLE_COORDINATION
#ifndef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
int32_t ret = delegateTasks_.PostSyncTask([this, udId, &state] {
return this->OnGetCoordinationStateSync(pid, udId, std::ref(state));
return this->OnGetCoordinationStateSync(pid, udId, state);
});
if (ret != RET_OK) {
FI_HILOGE("OnGetCoordinationStateSync failed, ret:%{public}d", ret);
@ -859,7 +859,7 @@ int32_t DeviceStatusService::GetShadowOffset(ShadowOffset &shadowOffset)
{
CALL_DEBUG_ENTER;
int32_t ret = delegateTasks_.PostSyncTask([this, &shadowOffset] {
return this->dragMgr_.OnGetShadowOffset(std::ref(shadowOffset));
return this->dragMgr_.OnGetShadowOffset(shadowOffset);
});
if (ret != RET_OK) {
FI_HILOGE("Get shadow offset failed, ret:%{public}d", ret);
@ -883,7 +883,7 @@ int32_t DeviceStatusService::GetDragData(DragData &dragData)
{
CALL_DEBUG_ENTER;
int32_t ret = delegateTasks_.PostSyncTask([this, &dragData] {
return this->dragMgr_.GetDragData(std::ref(dragData));
return this->dragMgr_.GetDragData(dragData);
});
if (ret != RET_OK) {
FI_HILOGE("Get drag data failed, ret:%{public}d", ret);
@ -895,7 +895,7 @@ int32_t DeviceStatusService::GetDragState(DragState &dragState)
{
CALL_DEBUG_ENTER;
int32_t ret = delegateTasks_.PostSyncTask([this, &dragState] {
return this->dragMgr_.GetDragState(std::ref(dragState));
return this->dragMgr_.GetDragState(dragState);
});
if (ret != RET_OK) {
FI_HILOGE("Get drag state failed, ret:%{public}d", ret);
@ -921,7 +921,7 @@ int32_t DeviceStatusService::GetUdKey(std::string &udKey)
{
CALL_DEBUG_ENTER;
int32_t ret = delegateTasks_.PostSyncTask([this, &udKey] {
return this->dragMgr_.GetUdKey(std::ref(udKey));
return this->dragMgr_.GetUdKey(udKey);
});
if (ret != RET_OK) {
FI_HILOGE("Get udkey failed, ret:%{public}d", ret);
@ -944,7 +944,7 @@ int32_t DeviceStatusService::GetDragTargetPid()
int32_t DeviceStatusService::GetDragAction(DragAction &dragAction)
{
int32_t ret = delegateTasks_.PostSyncTask([this, &dragAction] {
return this->dragMgr_.GetDragAction(std::ref(dragAction));
return this->dragMgr_.GetDragAction(dragAction);
});
if (ret != RET_OK) {
FI_HILOGE("Get drag action failed, ret:%{public}d", ret);
@ -955,7 +955,7 @@ int32_t DeviceStatusService::GetDragAction(DragAction &dragAction)
int32_t DeviceStatusService::GetExtraInfo(std::string &extraInfo)
{
int32_t ret = delegateTasks_.PostSyncTask([this, &extraInfo] {
return this->dragMgr_.GetExtraInfo(std::ref(extraInfo));
return this->dragMgr_.GetExtraInfo(extraInfo);
});
if (ret != RET_OK) {
FI_HILOGE("Get extraInfo failed, ret:%{public}d", ret);
@ -1170,7 +1170,7 @@ int32_t DeviceStatusService::UpdatePreviewStyleWithAnimation(const PreviewStyle
int32_t DeviceStatusService::GetDragSummary(std::map<std::string, int64_t> &summarys)
{
int32_t ret = delegateTasks_.PostSyncTask([this, &summarys] {
return this->dragMgr_.GetDragSummary(std::ref(summarys));
return this->dragMgr_.GetDragSummary(summarys);
});
if (ret != RET_OK) {
FI_HILOGE("Failed to get drag summarys, ret:%{public}d", ret);