mirror of
https://gitee.com/openharmony/sensors_sensor
synced 2024-12-04 20:58:50 +00:00
sensor解耦hitrace,超大函数修改
Signed-off-by: tu-xinxin <xxtud@isoftstone.com>
This commit is contained in:
parent
d10108bc14
commit
9aede0f384
@ -59,6 +59,7 @@ private:
|
||||
int32_t InitServiceClient();
|
||||
void UpdateSensorInfoMap(int32_t sensorId, int64_t samplingPeriod, int64_t maxReportDelay);
|
||||
void DeleteSensorInfoItem(int32_t sensorId);
|
||||
int32_t CreateSocketClientFd(int32_t &clientFd);
|
||||
int32_t CreateSocketChannel();
|
||||
std::mutex clientMutex_;
|
||||
sptr<IRemoteObject::DeathRecipient> serviceDeathObserver_ = nullptr;
|
||||
|
@ -524,6 +524,21 @@ void SensorServiceClient::Disconnect()
|
||||
Close();
|
||||
}
|
||||
|
||||
int32_t SensorServiceClient::CreateSocketClientFd(int32_t &clientFd)
|
||||
{
|
||||
#ifdef HIVIEWDFX_HITRACE_ENABLE
|
||||
StartTrace(HITRACE_TAG_SENSORS, "CreateSocketChannel");
|
||||
#endif // HIVIEWDFX_HITRACE_ENABLE
|
||||
CHKPR(sensorClientStub_, INVALID_POINTER);
|
||||
auto remoteObject = sensorClientStub_->AsObject();
|
||||
CHKPR(remoteObject, INVALID_POINTER);
|
||||
int ret = sensorServer_->CreateSocketChannel(remoteObject, clientFd);
|
||||
#ifdef HIVIEWDFX_HITRACE_ENABLE
|
||||
FinishTrace(HITRACE_TAG_SENSORS);
|
||||
#endif // HIVIEWDFX_HITRACE_ENABLE
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t SensorServiceClient::CreateSocketChannel()
|
||||
{
|
||||
CALL_LOG_ENTER;
|
||||
@ -535,16 +550,7 @@ int32_t SensorServiceClient::CreateSocketChannel()
|
||||
std::lock_guard<std::mutex> clientLock(clientMutex_);
|
||||
CHKPR(sensorServer_, ERROR);
|
||||
int32_t clientFd = -1;
|
||||
#ifdef HIVIEWDFX_HITRACE_ENABLE
|
||||
StartTrace(HITRACE_TAG_SENSORS, "CreateSocketChannel");
|
||||
#endif // HIVIEWDFX_HITRACE_ENABLE
|
||||
CHKPR(sensorClientStub_, INVALID_POINTER);
|
||||
auto remoteObject = sensorClientStub_->AsObject();
|
||||
CHKPR(remoteObject, INVALID_POINTER);
|
||||
ret = sensorServer_->CreateSocketChannel(remoteObject, clientFd);
|
||||
#ifdef HIVIEWDFX_HITRACE_ENABLE
|
||||
FinishTrace(HITRACE_TAG_SENSORS);
|
||||
#endif // HIVIEWDFX_HITRACE_ENABLE
|
||||
ret = CreateSocketClientFd(clientFd);
|
||||
if (ret != ERR_OK || clientFd < 0) {
|
||||
Close();
|
||||
SEN_HILOGE("Create socket channel failed, ret:%{public}d", ret);
|
||||
|
Loading…
Reference in New Issue
Block a user