Optimize render task completed notify signal 08/305708/1
authorEunki Hong <eunkiki.hong@samsung.com>
Tue, 6 Feb 2024 15:59:05 +0000 (00:59 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Tue, 6 Feb 2024 15:59:05 +0000 (00:59 +0900)
Let we follow up RenderTask also optimized like Animation.

The relationship between RenderTask <-> RenderTaskList is euqal with
Animation <-> AnimationPlayList. So we can use same logic.

Change-Id: I61072374252394e01fe542d8b02941c5b4e58476
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
dali/internal/event/render-tasks/render-task-list-impl.cpp

index 34912a0..fed77c6 100644 (file)
@@ -216,22 +216,24 @@ void RenderTaskList::Initialize()
   mSceneObject->SetCompleteNotificationInterface(this);
 }
 
-void RenderTaskList::NotifyCompleted(CompleteNotificationInterface::ParameterList notifierList)
+void RenderTaskList::NotifyCompleted(CompleteNotificationInterface::ParameterList notifierIdList)
 {
   DALI_LOG_TRACE_METHOD(gLogRenderList);
 
   RenderTaskContainer finishedRenderTasks;
 
-  // TODO : Optimize here if required.
-  // Note : Actually, Total number of RenderTask should be small enough so full search might not overhead for now.
-
-  // Since render tasks can be unreferenced during the signal emissions, iterators into render tasks pointers may be invalidated.
-  // First copy the finished render tasks, then emit signals
-  for(RenderTaskContainer::iterator iter = mTasks.begin(), endIt = mTasks.end(); iter != endIt; ++iter)
+  for(const auto& notifierId : notifierIdList)
   {
-    if((*iter)->HasFinished())
+    auto* renderTask = GetEventObject(notifierId);
+    if(DALI_LIKELY(renderTask))
     {
-      finishedRenderTasks.push_back(*iter);
+      // Check if this render task hold inputed scenegraph render task.
+      DALI_ASSERT_DEBUG(renderTask->GetRenderTaskSceneObject()->GetNotifyId() == notifierId);
+
+      if(renderTask->HasFinished())
+      {
+        finishedRenderTasks.push_back(renderTask);
+      }
     }
   }