Revert "[Tizen] (Vector) Ensure to release VectorRenderer in the main thread"
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:37:22 +0000 (15:37 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:37:24 +0000 (15:37 +0900)
This reverts commit a6ccd8526c646047387b02c6ce1e629919d9e3af.

Change-Id: I7012b9f4ec0bd56a55bb0d2df5ba5afaf19a62d5

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp

index 9dccaa7..f8c0c36 100755 (executable)
@@ -108,7 +108,7 @@ public:
     height = 100;
   }
 
-  void GetLayerInfo( Property::Map& map )
+  void GetLayerInfo( Property::Map& map ) const
   {
   }
 
@@ -216,7 +216,7 @@ void VectorAnimationRenderer::GetDefaultSize( uint32_t& width, uint32_t& height
   Internal::Adaptor::GetImplementation( *this ).GetDefaultSize( width, height );
 }
 
-void VectorAnimationRenderer::GetLayerInfo( Property::Map& map )
+void VectorAnimationRenderer::GetLayerInfo( Property::Map& map ) const
 {
   Internal::Adaptor::GetImplementation( *this ).GetLayerInfo( map );
 }
index 122d407..ea4dee5 100644 (file)
@@ -119,8 +119,6 @@ AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factor
 
 AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
 {
-  // Finalize animation task in the main thread
-  mVectorAnimationTask->Finalize();
 }
 
 void AnimatedVectorImageVisual::GetNaturalSize( Vector2& naturalSize )
@@ -464,11 +462,11 @@ void AnimatedVectorImageVisual::OnUploadCompleted()
   {
     actor.AddRenderer( mImpl->mRenderer );
     mRendererAdded = true;
+  }
 
-    ResourceReady( Toolkit::Visual::ResourceStatus::READY );
+  ResourceReady( Toolkit::Visual::ResourceStatus::READY );
 
-    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnUploadCompleted: Renderer is added [%p]\n", this );
-  }
+  DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnUploadCompleted: Renderer is added [%p]\n", this );
 }
 
 void AnimatedVectorImageVisual::OnAnimationFinished()
index 8ebad55..7af08ac 100644 (file)
@@ -92,17 +92,6 @@ VectorAnimationTask::~VectorAnimationTask()
   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::~VectorAnimationTask: destructor [%p]\n", this );
 }
 
-void VectorAnimationTask::Finalize()
-{
-  // Release some objects in the main thread
-  if( mAnimationFinishedTrigger )
-  {
-    mAnimationFinishedTrigger.reset();
-  }
-
-  mVectorRenderer.Reset();
-}
-
 void VectorAnimationTask::SetRenderer( Renderer renderer )
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
@@ -181,10 +170,7 @@ void VectorAnimationTask::RenderFrame()
 void VectorAnimationTask::SetAnimationFinishedCallback( EventThreadCallback* callback )
 {
   ConditionalWait::ScopedLock lock( mConditionalWait );
-  if( callback )
-  {
-    mAnimationFinishedTrigger = std::unique_ptr< EventThreadCallback >( callback );
-  }
+  mAnimationFinishedTrigger = std::unique_ptr< EventThreadCallback >( callback );
 }
 
 void VectorAnimationTask::SetLoopCount( int32_t count )
@@ -290,7 +276,6 @@ void VectorAnimationTask::SetCurrentFrameNumber( uint32_t frameNumber )
     mCurrentFrame = frameNumber;
     mCurrentFrameUpdated = true;
 
-    mUpdateFrameNumber = false;
     mResourceReady = false;
 
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetCurrentFrameNumber: frame number = %d [%p]\n", mCurrentFrame, this );
@@ -332,7 +317,7 @@ void VectorAnimationTask::SetLoopingMode( DevelImageVisual::LoopingMode::Type lo
   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetLoopingMode: looping mode = %d [%p]\n", mLoopingMode, this );
 }
 
-void VectorAnimationTask::GetLayerInfo( Property::Map& map )
+void VectorAnimationTask::GetLayerInfo( Property::Map& map ) const
 {
   mVectorRenderer.GetLayerInfo( map );
 }
@@ -449,15 +434,11 @@ bool VectorAnimationTask::Rasterize()
   }
 
   // Rasterize
-  bool renderSuccess = false;
-  if( mVectorRenderer )
+  bool renderSuccess = mVectorRenderer.Render( currentFrame );
+  if( !renderSuccess )
   {
-    renderSuccess = mVectorRenderer.Render( currentFrame );
-    if( !renderSuccess )
-    {
-      DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this );
-      mUpdateFrameNumber = false;
-    }
+    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this );
+    mUpdateFrameNumber = false;
   }
 
   if( stopped && renderSuccess )
index 4defb86..4f6f83a 100644 (file)
@@ -64,11 +64,6 @@ public:
   virtual ~VectorAnimationTask();
 
   /**
-   * @brief Finalizes the task.
-   */
-  void Finalize();
-
-  /**
    * @brief Sets the renderer used to display the result image.
    *
    * @param[in] renderer The renderer used to display the result image
@@ -177,7 +172,7 @@ public:
    * @brief Gets the layer information of all the child layers.
    * @param[out] map The layer information
    */
-  void GetLayerInfo( Property::Map& map );
+  void GetLayerInfo( Property::Map& map ) const;
 
   /**
    * @brief Connect to this signal to be notified when the texture upload is completed.
index e1a4a40..a4a2a16 100644 (file)
@@ -119,7 +119,7 @@ void VectorAnimationThread::OnTaskCompleted( VectorAnimationTaskPtr task, bool k
   {
     ConditionalWait::ScopedLock lock( mConditionalWait );
 
-    if( mCompletedTasks.end() == std::find( mCompletedTasks.begin(), mCompletedTasks.end(), task ) )
+    if( mAnimationTasks.end() == std::find( mAnimationTasks.begin(), mAnimationTasks.end(), task ) )
     {
       mCompletedTasks.push_back( task );
 
@@ -192,7 +192,7 @@ void VectorAnimationThread::Rasterize()
   mCompletedTasks.clear();
 
   // pop out the next task from the queue
-  while( !mAnimationTasks.empty() && !mNeedToSleep )
+  if( !mAnimationTasks.empty() && !mNeedToSleep )
   {
     std::vector< VectorAnimationTaskPtr >::iterator next = mAnimationTasks.begin();
     VectorAnimationTaskPtr nextTask = *next;