mVectorRenderer(VectorAnimationRenderer::New()),
mAnimationData(),
mVectorAnimationThread(factoryCache.GetVectorAnimationManager().GetVectorAnimationThread()),
- mConditionalWait(),
+ mMutex(),
mResourceReadySignal(),
mLoadCompletedCallback(MakeCallback(this, &VectorAnimationTask::OnLoadCompleted)),
mCachedLayerInfo(),
void VectorAnimationTask::Finalize()
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
-
- // Release some objects in the main thread
- if(mAnimationFinishedCallback)
- {
- mVectorAnimationThread.RemoveEventTriggerCallbacks(mAnimationFinishedCallback.get());
- mAnimationFinishedCallback.reset();
- }
- if(mLoadCompletedCallback)
{
- mVectorAnimationThread.RemoveEventTriggerCallbacks(mLoadCompletedCallback.get());
- mLoadCompletedCallback.reset();
+ Mutex::ScopedLock lock(mMutex);
+
+ // Release some objects in the main thread
+ if(mAnimationFinishedCallback)
+ {
+ mVectorAnimationThread.RemoveEventTriggerCallbacks(mAnimationFinishedCallback.get());
+ mAnimationFinishedCallback.reset();
+ }
+ if(mLoadCompletedCallback)
+ {
+ mVectorAnimationThread.RemoveEventTriggerCallbacks(mLoadCompletedCallback.get());
+ mLoadCompletedCallback.reset();
+ }
+
+ mDestroyTask = true;
}
mVectorRenderer.Finalize();
-
- mDestroyTask = true;
}
void VectorAnimationTask::TaskCompleted(VectorAnimationTaskPtr task)
DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mImageUrl.GetUrl().c_str());
mLoadRequest = false;
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
if(!synchronousLoading && mLoadCompletedCallback)
{
mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
mLoadRequest = false;
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
if(!synchronousLoading && mLoadCompletedCallback)
{
mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
void VectorAnimationTask::SetRenderer(Renderer renderer)
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
-
mVectorRenderer.SetRenderer(renderer);
DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetRenderer [%p]\n", this);
void VectorAnimationTask::SetAnimationData(const AnimationData& data)
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetAnimationData [%p]\n", this);
void VectorAnimationTask::SetAnimationFinishedCallback(CallbackBase* callback)
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
mAnimationFinishedCallback = std::unique_ptr<CallbackBase>(callback);
}
mKeepAnimation = false;
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
if(mDestroyTask)
{
// The task will be destroyed. We don't need rasterization.
// Animation is finished
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
if(mNeedAnimationFinishedTrigger && mAnimationFinishedCallback)
{
mVectorAnimationThread.AddEventTriggerCallback(mAnimationFinishedCallback.get());
uint32_t index;
{
- ConditionalWait::ScopedLock lock(mConditionalWait);
+ Mutex::ScopedLock lock(mMutex);
if(!mAnimationDataUpdated || mAnimationData[mAnimationDataIndex].size() != 0)
{
#define DALI_TOOLKIT_VECTOR_ANIMATION_TASK_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
-#include <dali/devel-api/threading/conditional-wait.h>
+#include <dali/devel-api/threading/mutex.h>
#include <dali/public-api/adaptor-framework/async-task-manager.h>
#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
#include <dali/public-api/common/vector-wrapper.h>
VectorAnimationRenderer mVectorRenderer;
std::vector<AnimationData> mAnimationData[2];
VectorAnimationThread& mVectorAnimationThread;
- ConditionalWait mConditionalWait;
+ Mutex mMutex;
ResourceReadySignalType mResourceReadySignal;
std::unique_ptr<CallbackBase> mAnimationFinishedCallback{};
std::unique_ptr<CallbackBase> mLoadCompletedCallback{};