mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
FIX FA
Signed-off-by: Laiganlu <laiganlu@huawei.com>
This commit is contained in:
parent
739ef6a4b2
commit
d6462ee58d
@ -2932,18 +2932,6 @@ void UIContentImpl::SetFrameLayoutFinishCallback(std::function<void()>&& callbac
|
||||
moduleName_.c_str(), instanceId_);
|
||||
}
|
||||
|
||||
void UIContentImpl::SetLastestFrameLayoutFinishCallback(std::function<void()>&& callback)
|
||||
{
|
||||
CHECK_NULL_VOID(callback);
|
||||
auto container = Platform::AceContainer::GetContainer(instanceId_);
|
||||
CHECK_NULL_VOID(container);
|
||||
auto pipelineContext = AceType::DynamicCast<NG::PipelineContext>(container->GetPipelineContext());
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
pipelineContext->AddLastestFrameLayoutFinishTask(std::move(callback));
|
||||
LOGI("[%{public}s][%{public}s][%{public}d]: SetLastestFrameLayoutFinishCallback", bundleName_.c_str(),
|
||||
moduleName_.c_str(), instanceId_);
|
||||
}
|
||||
|
||||
void UIContentImpl::NotifyMemoryLevel(int32_t level)
|
||||
{
|
||||
LOGI("[%{public}s][%{public}s][%{public}d]: NotifyMemoryLevel: %{public}d",
|
||||
|
@ -132,9 +132,6 @@ public:
|
||||
// Set UIContent callback after layout finish
|
||||
void SetFrameLayoutFinishCallback(std::function<void()>&& callback) override;
|
||||
|
||||
// Set UIContent callback after lastest layout finish
|
||||
void SetLastestFrameLayoutFinishCallback(std::function<void()>&& callback) override;
|
||||
|
||||
// Receive memory level notification
|
||||
void NotifyMemoryLevel(int32_t level) override;
|
||||
|
||||
|
@ -75,6 +75,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void FlushLayoutSize(int32_t width, int32_t height) {}
|
||||
|
||||
virtual bool FlushAnimation(uint64_t timeStamp)
|
||||
{
|
||||
return false;
|
||||
|
@ -258,7 +258,7 @@ void WindowScene::BufferAvailableCallback()
|
||||
CHECK_NULL_VOID(self);
|
||||
|
||||
auto surfaceNode = self->session_->GetSurfaceNode();
|
||||
bool isWindowSizeEqual = self->IsWindowSizeEqual(true);
|
||||
bool isWindowSizeEqual = self->IsWindowSizeEqual();
|
||||
if (!isWindowSizeEqual || surfaceNode == nullptr || !surfaceNode->IsBufferAvailable()) {
|
||||
TAG_LOGI(AceLogTag::ACE_WINDOW_SCENE,
|
||||
"BufferAvailableCallback id: %{public}d, isWindowSizeEqual: %{public}d",
|
||||
@ -514,14 +514,15 @@ void WindowScene::OnLayoutFinished()
|
||||
auto uiTask = [weakThis = WeakClaim(this)]() {
|
||||
auto self = weakThis.Upgrade();
|
||||
CHECK_NULL_VOID(self);
|
||||
CHECK_EQUAL_VOID(self->session_->IsAnco(), true);
|
||||
if (self->startingWindow_) {
|
||||
self->BufferAvailableCallback();
|
||||
}
|
||||
auto host = self->GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
ACE_SCOPED_TRACE("WindowScene::OnLayoutFinished[id:%d][self:%d][enabled:%d]",
|
||||
self->session_->GetPersistentId(), host->GetId(), self->session_->GetBufferAvailableCallbackEnable());
|
||||
if (self->startingWindow_) {
|
||||
self->BufferAvailableCallback();
|
||||
return;
|
||||
}
|
||||
CHECK_EQUAL_VOID(self->session_->IsAnco(), true);
|
||||
if (self->session_->GetBufferAvailableCallbackEnable()) {
|
||||
TAG_LOGI(AceLogTag::ACE_WINDOW_SCENE, "buffer available callback enable is true, no need remove blank.");
|
||||
return;
|
||||
@ -565,7 +566,7 @@ void WindowScene::OnDrawingCompleted()
|
||||
pipelineContext->PostAsyncEvent(std::move(uiTask), "ArkUIWindowSceneDrawingCompleted", TaskExecutor::TaskType::UI);
|
||||
}
|
||||
|
||||
bool WindowScene::IsWindowSizeEqual(bool allowEmpty)
|
||||
bool WindowScene::IsWindowSizeEqual()
|
||||
{
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_RETURN(host, false);
|
||||
@ -575,7 +576,6 @@ bool WindowScene::IsWindowSizeEqual(bool allowEmpty)
|
||||
ACE_SCOPED_TRACE("WindowScene::IsWindowSizeEqual[id:%d][self:%d][%s][%s]",
|
||||
session_->GetPersistentId(), host->GetId(),
|
||||
frameSize.ToString().c_str(), session_->GetLayoutRect().ToString().c_str());
|
||||
CHECK_EQUAL_RETURN(allowEmpty && session_->GetLayoutRect().IsEmpty(), true, true);
|
||||
if (NearEqual(frameSize.Width(), session_->GetLayoutRect().width_, 1.0f) &&
|
||||
NearEqual(frameSize.Height(), session_->GetLayoutRect().height_, 1.0f)) {
|
||||
return true;
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
void BufferAvailableCallbackForSnapshot();
|
||||
void DisposeSnapshotAndBlankWindow();
|
||||
void OnBoundsChanged(const Rosen::Vector4f& bounds);
|
||||
bool IsWindowSizeEqual(bool allowEmpty = false);
|
||||
bool IsWindowSizeEqual();
|
||||
void RegisterResponseRegionCallback();
|
||||
void RegisterFocusCallback();
|
||||
void CleanBlankWindow();
|
||||
|
@ -221,6 +221,12 @@ void RosenWindow::FlushTasks()
|
||||
JankFrameReport::GetInstance().JsAnimationToRsRecord();
|
||||
}
|
||||
|
||||
void RosenWindow::FlushLayoutSize(int32_t width, int32_t height)
|
||||
{
|
||||
CHECK_NULL_VOID(rsWindow_);
|
||||
rsWindow_->FlushLayoutSize(width, height);
|
||||
}
|
||||
|
||||
float RosenWindow::GetRefreshRate() const
|
||||
{
|
||||
#ifdef PREVIEW
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
|
||||
void SetTaskRunner(RefPtr<TaskExecutor> taskExecutor, int32_t id);
|
||||
|
||||
void FlushLayoutSize(int32_t width, int32_t height) override;
|
||||
|
||||
bool FlushAnimation(uint64_t timeStamp) override
|
||||
{
|
||||
int64_t vsyncPeriod = GetVSyncPeriod();
|
||||
|
@ -1521,6 +1521,8 @@ protected:
|
||||
double dipScale_ = 1.0;
|
||||
double rootHeight_ = 0.0;
|
||||
double rootWidth_ = 0.0;
|
||||
int32_t width_ = 0;
|
||||
int32_t height_ = 0;
|
||||
FrontendType frontendType_;
|
||||
WindowModal windowModal_ = WindowModal::NORMAL;
|
||||
|
||||
|
@ -1940,6 +1940,7 @@ void PipelineContext::FlushVsync(uint64_t nanoTimestamp, uint32_t frameCount)
|
||||
FlushAnimation(GetTimeFromExternalTimer());
|
||||
FlushPipelineWithoutAnimation();
|
||||
FlushAnimationTasks();
|
||||
window_->FlushLayoutSize(width_, height_);
|
||||
hasIdleTasks_ = false;
|
||||
} else {
|
||||
LOGW("the surface is not ready, waiting");
|
||||
|
@ -979,8 +979,6 @@ private:
|
||||
int32_t frameCount_ = 0;
|
||||
#endif
|
||||
|
||||
int32_t width_ = 0;
|
||||
int32_t height_ = 0;
|
||||
bool isFirstPage_ = true;
|
||||
bool buildingFirstPage_ = false;
|
||||
bool forbidPlatformQuit_ = false;
|
||||
|
@ -882,7 +882,6 @@ void PipelineContext::FlushVsync(uint64_t nanoTimestamp, uint32_t frameCount)
|
||||
UIObserverHandler::GetInstance().HandleLayoutDoneCallBack();
|
||||
// flush correct rect again
|
||||
taskScheduler_->FlushPersistAfterLayoutTask();
|
||||
taskScheduler_->FlushLastestFrameLayoutFinishTask();
|
||||
taskScheduler_->FinishRecordFrameInfo();
|
||||
FlushNodeChangeFlag();
|
||||
FlushAnimationClosure();
|
||||
@ -949,6 +948,7 @@ void PipelineContext::FlushVsync(uint64_t nanoTimestamp, uint32_t frameCount)
|
||||
}
|
||||
needRenderNode_.clear();
|
||||
taskScheduler_->FlushAfterRenderTask();
|
||||
window_->FlushLayoutSize(width_, height_);
|
||||
if (IsWaitFlushFinish()) {
|
||||
FireUIExtensionFlushFinishCallback();
|
||||
UnWaitFlushFinish();
|
||||
@ -1558,6 +1558,8 @@ void PipelineContext::OnSurfaceChanged(int32_t width, int32_t height, WindowSize
|
||||
const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)
|
||||
{
|
||||
CHECK_RUN_ON(UI);
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
ACE_FUNCTION_TRACE();
|
||||
if (NearEqual(rootWidth_, width) && NearEqual(rootHeight_, height) &&
|
||||
type == WindowSizeChangeReason::CUSTOM_ANIMATION && !isDensityChanged_) {
|
||||
@ -4648,11 +4650,6 @@ void PipelineContext::AddPersistAfterLayoutTask(std::function<void()>&& task)
|
||||
taskScheduler_->AddPersistAfterLayoutTask(std::move(task));
|
||||
}
|
||||
|
||||
void PipelineContext::AddLastestFrameLayoutFinishTask(std::function<void()>&& task)
|
||||
{
|
||||
taskScheduler_->AddLastestFrameLayoutFinishTask(std::move(task));
|
||||
}
|
||||
|
||||
void PipelineContext::AddAfterRenderTask(std::function<void()>&& task)
|
||||
{
|
||||
taskScheduler_->AddAfterRenderTask(std::move(task));
|
||||
|
@ -319,8 +319,6 @@ public:
|
||||
|
||||
void AddPersistAfterLayoutTask(std::function<void()>&& task);
|
||||
|
||||
void AddLastestFrameLayoutFinishTask(std::function<void()>&& task);
|
||||
|
||||
void AddAfterRenderTask(std::function<void()>&& task);
|
||||
|
||||
void AddSafeAreaPaddingProcessTask(FrameNode* node);
|
||||
|
@ -39,7 +39,6 @@ UITaskScheduler::UITaskScheduler()
|
||||
UITaskScheduler::~UITaskScheduler()
|
||||
{
|
||||
persistAfterLayoutTasks_.clear();
|
||||
lastestFrameLayoutFinishTasks_.clear();
|
||||
}
|
||||
|
||||
void UITaskScheduler::AddDirtyLayoutNode(const RefPtr<FrameNode>& dirty)
|
||||
@ -326,13 +325,6 @@ void UITaskScheduler::AddPersistAfterLayoutTask(std::function<void()>&& task)
|
||||
LOGI("AddPersistAfterLayoutTask size: %{public}u", static_cast<uint32_t>(persistAfterLayoutTasks_.size()));
|
||||
}
|
||||
|
||||
void UITaskScheduler::AddLastestFrameLayoutFinishTask(std::function<void()>&& task)
|
||||
{
|
||||
lastestFrameLayoutFinishTasks_.emplace_back(std::move(task));
|
||||
LOGI("AddLastestFrameLayoutFinishTask size: %{public}u",
|
||||
static_cast<uint32_t>(lastestFrameLayoutFinishTasks_.size()));
|
||||
}
|
||||
|
||||
void UITaskScheduler::FlushAfterLayoutTask()
|
||||
{
|
||||
decltype(afterLayoutTasks_) tasks(std::move(afterLayoutTasks_));
|
||||
@ -370,20 +362,6 @@ void UITaskScheduler::FlushPersistAfterLayoutTask()
|
||||
}
|
||||
}
|
||||
|
||||
void UITaskScheduler::FlushLastestFrameLayoutFinishTask()
|
||||
{
|
||||
// only execute after lastest layout finish
|
||||
if (lastestFrameLayoutFinishTasks_.empty()) {
|
||||
return;
|
||||
}
|
||||
ACE_SCOPED_TRACE("UITaskScheduler::FlushLastestFrameLayoutFinishTask");
|
||||
for (const auto& task : lastestFrameLayoutFinishTasks_) {
|
||||
if (task) {
|
||||
task();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITaskScheduler::AddAfterRenderTask(std::function<void()>&& task)
|
||||
{
|
||||
afterRenderTasks_.emplace_back(std::move(task));
|
||||
|
@ -83,7 +83,6 @@ public:
|
||||
void AddAfterLayoutTask(std::function<void()>&& task, bool isFlushInImplicitAnimationTask = false);
|
||||
void AddAfterRenderTask(std::function<void()>&& task);
|
||||
void AddPersistAfterLayoutTask(std::function<void()>&& task);
|
||||
void AddLastestFrameLayoutFinishTask(std::function<void()>&& task);
|
||||
|
||||
void FlushLayoutTask(bool forceUseMainThread = false);
|
||||
void FlushRenderTask(bool forceUseMainThread = false);
|
||||
@ -93,7 +92,6 @@ public:
|
||||
void FlushAfterLayoutCallbackInImplicitAnimationTask();
|
||||
void FlushAfterRenderTask();
|
||||
void FlushPersistAfterLayoutTask();
|
||||
void FlushLastestFrameLayoutFinishTask();
|
||||
void ExpandSafeArea();
|
||||
|
||||
void FlushDelayJsActive();
|
||||
@ -196,7 +194,6 @@ private:
|
||||
std::list<std::function<void()>> afterLayoutCallbacksInImplicitAnimationTask_;
|
||||
std::list<std::function<void()>> afterRenderTasks_;
|
||||
std::list<std::function<void()>> persistAfterLayoutTasks_;
|
||||
std::list<std::function<void()>> lastestFrameLayoutFinishTasks_;
|
||||
std::list<std::function<void()>> syncGeometryNodeTasks_;
|
||||
std::set<FrameNode*, NodeCompare<FrameNode*>> safeAreaPaddingProcessTasks_;
|
||||
|
||||
|
@ -368,12 +368,6 @@ public:
|
||||
*/
|
||||
virtual void SetFrameLayoutFinishCallback(std::function<void()>&& callback) {};
|
||||
|
||||
/**
|
||||
* @description: Set UIContent callback after lastest layout finish.
|
||||
* @param callback callback func.
|
||||
*/
|
||||
virtual void SetLastestFrameLayoutFinishCallback(std::function<void()>&& callback) {};
|
||||
|
||||
// Current paintSize of window
|
||||
virtual void GetAppPaintSize(OHOS::Rosen::Rect& paintrect) {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user