mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-27 02:50:40 +00:00
打印告警修改 Signed-off-by:baozewei@huawei.com
Signed-off-by: baozewei <baozewei@huawei.com>
This commit is contained in:
parent
b27de7e46d
commit
54c5f49603
@ -339,7 +339,6 @@ static void PrintAdapterGetFileAfterCallFun(uv_work_t *work, int status)
|
||||
|
||||
bool PrintCallback::onBaseCallback(std::function<void(CallbackParam*)> paramFun, uv_after_work_cb after_work_cb)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
uv_loop_s *loop = nullptr;
|
||||
napi_get_uv_event_loop(env_, &loop);
|
||||
if (loop == nullptr) {
|
||||
@ -358,6 +357,8 @@ bool PrintCallback::onBaseCallback(std::function<void(CallbackParam*)> paramFun,
|
||||
delete work;
|
||||
return false;
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
param->env = env_;
|
||||
param->ref = ref_;
|
||||
param->mutexPtr = &mutex_;
|
||||
|
@ -701,7 +701,6 @@ int32_t PrintManagerClient::RegisterExtCallback(const std::string &extensionId,
|
||||
}
|
||||
sptr<PrintExtensionCallbackStub> callbackStub = nullptr;
|
||||
std::string extensionCID = PrintUtils::EncodeExtensionCid(extensionId, callbackId);
|
||||
std::lock_guard<std::recursive_mutex> lock(proxyLock_);
|
||||
auto it = extCallbackMap_.find(extensionCID);
|
||||
if (it == extCallbackMap_.end()) {
|
||||
callbackStub = new (std::nothrow) PrintExtensionCallbackStub;
|
||||
@ -713,6 +712,7 @@ int32_t PrintManagerClient::RegisterExtCallback(const std::string &extensionId,
|
||||
callbackStub = it->second;
|
||||
callbackStub->SetExtCallback(cb);
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> lock(proxyLock_);
|
||||
int32_t ret = E_PRINT_RPC_FAILURE;
|
||||
if (LoadServer() && GetPrintServiceProxy()) {
|
||||
ret = printServiceProxy_->RegisterExtCallback(extensionCID, callbackStub);
|
||||
@ -816,12 +816,14 @@ int32_t PrintManagerClient::RegisterExtCallback(const std::string &extensionId,
|
||||
|
||||
int32_t PrintManagerClient::UnregisterAllExtCallback(const std::string &extensionId)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(proxyLock_);
|
||||
PRINT_HILOGD("PrintManagerClient UnregisterAllExtCallback start.");
|
||||
int32_t ret = E_PRINT_RPC_FAILURE;
|
||||
if (LoadServer() && GetPrintServiceProxy()) {
|
||||
ret = printServiceProxy_->UnregisterAllExtCallback(extensionId);
|
||||
PRINT_HILOGD("PrintManagerClient UnregisterAllExtCallback out ret = [%{public}d].", ret);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(proxyLock_);
|
||||
PRINT_HILOGD("PrintManagerClient UnregisterAllExtCallback start.");
|
||||
if (LoadServer() && GetPrintServiceProxy()) {
|
||||
ret = printServiceProxy_->UnregisterAllExtCallback(extensionId);
|
||||
PRINT_HILOGD("PrintManagerClient UnregisterAllExtCallback out ret = [%{public}d].", ret);
|
||||
}
|
||||
}
|
||||
extCallbackMap_.clear();
|
||||
return ret;
|
||||
|
@ -153,14 +153,18 @@ sptr<PrintServiceAbility> PrintServiceAbility::GetInstance()
|
||||
|
||||
int32_t PrintServiceAbility::Init()
|
||||
{
|
||||
if (helper_ == nullptr) {
|
||||
helper_ = std::make_shared<PrintServiceHelper>();
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(apiMutex_);
|
||||
if (helper_ == nullptr) {
|
||||
helper_ = std::make_shared<PrintServiceHelper>();
|
||||
}
|
||||
if (helper_ == nullptr) {
|
||||
PRINT_HILOGE("PrintServiceHelper create failed.");
|
||||
return E_PRINT_SERVER_FAILURE;
|
||||
}
|
||||
DelayedSingleton<PrintBMSHelper>::GetInstance()->SetHelper(helper_);
|
||||
helper_->PrintSubscribeCommonEvent();
|
||||
}
|
||||
if (helper_ == nullptr) {
|
||||
PRINT_HILOGE("PrintServiceHelper create failed.");
|
||||
return E_PRINT_SERVER_FAILURE;
|
||||
}
|
||||
DelayedSingleton<PrintBMSHelper>::GetInstance()->SetHelper(helper_);
|
||||
if (!g_publishState) {
|
||||
bool ret = Publish(PrintServiceAbility::GetInstance());
|
||||
if (!ret) {
|
||||
@ -173,7 +177,6 @@ int32_t PrintServiceAbility::Init()
|
||||
InitPreferenceMap();
|
||||
state_ = ServiceRunningState::STATE_RUNNING;
|
||||
PRINT_HILOGI("state_ is %{public}d.Init PrintServiceAbility success.", static_cast<int>(state_));
|
||||
helper_->PrintSubscribeCommonEvent();
|
||||
#ifdef IPPOVERUSB_ENABLE
|
||||
PRINT_HILOGD("before PrintIppOverUsbManager Init");
|
||||
DelayedSingleton<PrintIppOverUsbManager>::GetInstance()->Init();
|
||||
@ -2393,7 +2396,6 @@ int32_t PrintServiceAbility::SendExtensionEvent(const std::string &extensionId,
|
||||
|
||||
void PrintServiceAbility::SetHelper(const std::shared_ptr<PrintServiceHelper> &helper)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(apiMutex_);
|
||||
helper_ = helper;
|
||||
DelayedSingleton<PrintBMSHelper>::GetInstance()->SetHelper(helper_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user