});
bool needRasterize = false;
- auto workingTask = std::find(mWorkingTasks.begin(), mWorkingTasks.end(), task);
- if(workingTask != mWorkingTasks.end())
+ VectorAnimationTaskSet::const_iterator workingIter = mWorkingTasks.find(task);
+ if(workingIter != mWorkingTasks.cend())
{
- mWorkingTasks.erase(workingTask);
+ mWorkingTasks.erase(workingIter);
}
// Check pending task
if(keepAnimation)
{
- if(mCompletedTasks.end() == std::find(mCompletedTasks.begin(), mCompletedTasks.end(), task))
+ VectorAnimationTaskSet::const_iterator completedIter = mCompletedTasks.lower_bound(task);
+ if(completedIter == mCompletedTasks.cend() || task < *completedIter)
{
- mCompletedTasks.push_back(task);
+ mCompletedTasks.insert(completedIter, task);
needRasterize = true;
}
}
if(nextFrameTime <= currentTime)
{
// If the task is not in the working list
- if(std::find(mWorkingTasks.begin(), mWorkingTasks.end(), nextTask) == mWorkingTasks.end())
+ VectorAnimationTaskSet::const_iterator workingIter = mWorkingTasks.lower_bound(nextTask);
+ if(workingIter == mWorkingTasks.cend() || nextTask < *workingIter)
{
it = mAnimationTasks.erase(it);
// Add it to the working list
- mWorkingTasks.push_back(nextTask);
+ mWorkingTasks.insert(workingIter, nextTask);
mAsyncTaskManager.AddTask(nextTask);
}
else
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/set-wrapper.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
private:
std::vector<VectorAnimationTaskPtr> mAnimationTasks; ///< Animation processing tasks, ordered by next frame time.
- std::vector<VectorAnimationTaskPtr> mCompletedTasks; ///< Temperal storage for completed tasks.
- std::vector<VectorAnimationTaskPtr> mWorkingTasks;
+
+ using VectorAnimationTaskSet = std::set<VectorAnimationTaskPtr>;
+ VectorAnimationTaskSet mCompletedTasks; ///< Temperal storage for completed tasks.
+ VectorAnimationTaskSet mWorkingTasks; ///< Tasks which are currently being processed. Key is the task, value is the number of tasks running.
std::vector<std::pair<VectorAnimationTaskPtr, bool>> mCompletedTasksQueue; ///< Queue of completed tasks from worker thread. pair of task, and rasterize required.
///< It will be moved at begin of Rasterize().