mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
修复由于时序冲突,概率出现不同卡片绘制出错的问题
Signed-off-by: zhangxx_z30070453 <zhangxingxing43@h-partners.com>
This commit is contained in:
parent
340f17dd72
commit
b0c696a00b
@ -223,21 +223,43 @@ void FormManagerDelegate::OnSurfaceCreate(const AppExecFwk::FormJsInfo& formInfo
|
||||
sptr<IRemoteObject> proxy = want.GetRemoteObject(FORM_RENDERER_DISPATCHER);
|
||||
if (proxy != nullptr) {
|
||||
formRendererDispatcher_ = iface_cast<IFormRendererDispatcher>(proxy);
|
||||
CheckWhetherSurfaceChangeFailed();
|
||||
} else {
|
||||
TAG_LOGE(AceLogTag::ACE_FORM, "want renderer dispatcher null");
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(recycleMutex_);
|
||||
recycleStatus_ = RecycleStatus::RECOVERED;
|
||||
}
|
||||
|
||||
isDynamic_ = formInfo.isDynamic;
|
||||
if (!formInfo.isDynamic) {
|
||||
HandleSnapshotCallback(DELAY_TIME_FOR_FORM_SNAPSHOT_10S);
|
||||
}
|
||||
}
|
||||
|
||||
void FormManagerDelegate::CheckWhetherSurfaceChangeFailed()
|
||||
{
|
||||
float width = 0.0f;
|
||||
float height = 0.0f;
|
||||
float borderWidth = 0.0f;
|
||||
bool needRedispatch = false;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(surfaceChangeFailedRecordMutex_);
|
||||
if (notifySurfaceChangeFailedRecord_.isfailed == true) {
|
||||
TAG_LOGI(AceLogTag::ACE_FORM, "redispatch surface change event");
|
||||
needRedispatch = true;
|
||||
notifySurfaceChangeFailedRecord_.isfailed = false;
|
||||
width = notifySurfaceChangeFailedRecord_.expectedWidth;
|
||||
height = notifySurfaceChangeFailedRecord_.expectedHeight;
|
||||
borderWidth = notifySurfaceChangeFailedRecord_.expectedBorderWidth;
|
||||
}
|
||||
}
|
||||
if (needRedispatch) {
|
||||
uint32_t reason = static_cast<uint32_t>(WindowSizeChangeReason::UNDEFINED);
|
||||
formRendererDispatcher_->DispatchSurfaceChangeEvent(width, height, reason, nullptr, borderWidth);
|
||||
}
|
||||
}
|
||||
|
||||
void FormManagerDelegate::HandleCachedClickEvents()
|
||||
{
|
||||
if (formRendererDispatcher_ == nullptr) {
|
||||
@ -739,9 +761,16 @@ void FormManagerDelegate::NotifySurfaceChange(float width, float height, float b
|
||||
wantCache_.SetParam(OHOS::AppExecFwk::Constants::PARAM_FORM_WIDTH_KEY, static_cast<double>(width));
|
||||
wantCache_.SetParam(OHOS::AppExecFwk::Constants::PARAM_FORM_HEIGHT_KEY, static_cast<double>(height));
|
||||
wantCache_.SetParam(OHOS::AppExecFwk::Constants::PARAM_FORM_BORDER_WIDTH_KEY, borderWidth);
|
||||
if (formRendererDispatcher_ == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_FORM, "formRendererDispatcher_ is nullptr");
|
||||
return;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(surfaceChangeFailedRecordMutex_);
|
||||
if (formRendererDispatcher_ == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_FORM, "formRendererDispatcher_ is nullptr");
|
||||
notifySurfaceChangeFailedRecord_.isfailed = true;
|
||||
notifySurfaceChangeFailedRecord_.expectedWidth = width;
|
||||
notifySurfaceChangeFailedRecord_.expectedHeight = height;
|
||||
notifySurfaceChangeFailedRecord_.expectedBorderWidth = borderWidth;
|
||||
return;
|
||||
}
|
||||
}
|
||||
WindowSizeChangeReason sizeChangeReason = WindowSizeChangeReason::UNDEFINED;
|
||||
if (FormManager::GetInstance().IsSizeChangeByRotate()) {
|
||||
|
@ -78,6 +78,13 @@ public:
|
||||
RECOVERED,
|
||||
};
|
||||
|
||||
struct NotifySurfaceChangeFailedRecord {
|
||||
bool isfailed = false;
|
||||
float expectedWidth = 0.0f;
|
||||
float expectedHeight = 0.0f;
|
||||
float expectedBorderWidth = 0.0f;
|
||||
};
|
||||
|
||||
FormManagerDelegate() = delete;
|
||||
~FormManagerDelegate() override;
|
||||
explicit FormManagerDelegate(const WeakPtr<PipelineBase>& context)
|
||||
@ -158,6 +165,7 @@ private:
|
||||
bool ParseAction(const std::string& action, const std::string& type, AAFwk::Want& want);
|
||||
void HandleEnableFormCallback(const bool enable);
|
||||
void SetGestureInnerFlag();
|
||||
void CheckWhetherSurfaceChangeFailed();
|
||||
|
||||
onFormAcquiredCallbackForJava onFormAcquiredCallbackForJava_;
|
||||
OnFormUpdateCallbackForJava onFormUpdateCallbackForJava_;
|
||||
@ -179,8 +187,10 @@ private:
|
||||
bool isDynamic_ = true;
|
||||
std::mutex accessibilityChildTreeRegisterMutex_;
|
||||
std::mutex recycleMutex_;
|
||||
std::mutex surfaceChangeFailedRecordMutex_;
|
||||
RecycleStatus recycleStatus_ = RecycleStatus::RECOVERED;
|
||||
std::vector<std::shared_ptr<MMI::PointerEvent>> pointerEventCache_;
|
||||
NotifySurfaceChangeFailedRecord notifySurfaceChangeFailedRecord_;
|
||||
#ifdef OHOS_STANDARD_SYSTEM
|
||||
int64_t runningCardId_ = -1;
|
||||
std::string runningCompId_;
|
||||
|
Loading…
Reference in New Issue
Block a user