mirror of
https://gitee.com/openharmony/filemanagement_app_file_service
synced 2024-11-27 10:10:36 +00:00
commit
0241eb5110
@ -153,8 +153,6 @@ private:
|
||||
std::shared_mutex lock_;
|
||||
std::shared_ptr<ExtBackup> extension_;
|
||||
std::vector<std::string> tars_;
|
||||
std::mutex getExtInfoMtx_;
|
||||
std::condition_variable getExtInfoCondition_;
|
||||
std::string backupInfo_;
|
||||
OHOS::ThreadPool threadPool_;
|
||||
};
|
||||
|
@ -69,7 +69,6 @@ using namespace std;
|
||||
namespace {
|
||||
const int64_t DEFAULT_SLICE_SIZE = 100 * 1024 * 1024; // 分片文件大小为100M
|
||||
const uint32_t MAX_FILE_COUNT = 6000; // 单个tar包最多包含6000个文件
|
||||
const int32_t CONNECT_WAIT_TIME_S = 15;
|
||||
} // namespace
|
||||
|
||||
void BackupExtExtension::VerifyCaller()
|
||||
@ -1618,18 +1617,13 @@ ErrCode BackupExtExtension::GetBackupInfo(std::string &result)
|
||||
auto callBackup = [ptr](std::string result) {
|
||||
HILOGI("GetBackupInfo callBackup start. result = %{public}s", result.c_str());
|
||||
ptr->backupInfo_ = result;
|
||||
ptr->getExtInfoCondition_.notify_one();
|
||||
};
|
||||
auto ret = ptr->extension_->GetBackupInfo(callBackup);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Failed to notify the app done. err = %{public}d", ret);
|
||||
return BError(BError::Codes::EXT_INVAL_ARG, "extension getBackupInfo exception").GetCode();
|
||||
}
|
||||
HILOGD("GetBackupInfo getExtInfoMtx_ lock.");
|
||||
std::unique_lock<std::mutex> lock(getExtInfoMtx_);
|
||||
getExtInfoCondition_.wait_for(lock, std::chrono::seconds(CONNECT_WAIT_TIME_S));
|
||||
HILOGD("GetBackupInfo getExtInfoMtx_ unlock.");
|
||||
|
||||
HILOGD("GetBackupInfo lby, backupInfo = %s", backupInfo_.c_str());
|
||||
result = backupInfo_;
|
||||
backupInfo_.clear();
|
||||
|
||||
|
@ -265,14 +265,7 @@ static void onResultReport(weak_ptr<GeneralCallbacks> pCallbacks, const std::str
|
||||
}
|
||||
|
||||
auto cbCompl = [result {result}](napi_env env, NError err) -> NVal {
|
||||
NVal resultStr = NVal::CreateUTF8String(env, result);
|
||||
NVal res;
|
||||
napi_status status = napi_set_named_property(env, res.val_, FILEIO_TAG_ERR_DATA.c_str(), resultStr.val_);
|
||||
if (status != napi_ok) {
|
||||
HILOGE("Failed to set data property, status %{public}d, bundleName %{public}s", status, result.c_str());
|
||||
}
|
||||
|
||||
return res;
|
||||
return NVal::CreateUTF8String(env, result);
|
||||
};
|
||||
|
||||
callbacks->onResultReport.ThreadSafeSchedule(cbCompl);
|
||||
|
Loading…
Reference in New Issue
Block a user