Use trace macro with message generator function 23/303223/2
authorEunki Hong <eunkiki.hong@samsung.com>
Thu, 21 Dec 2023 13:54:32 +0000 (22:54 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Wed, 27 Dec 2023 01:28:52 +0000 (01:28 +0000)
Change-Id: Iac15dac7e023e150f48ef60c3a256edae08cf016
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/texture-manager/texture-manager-impl.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/npatch-loader.cpp
dali-toolkit/internal/visuals/svg/svg-task.cpp

index db7ded1..44d365f 100644 (file)
@@ -805,17 +805,9 @@ void TextureManager::Remove(const TextureManager::TextureId textureId)
 
 void TextureManager::ProcessRemoveQueue()
 {
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    if(mRemoveQueue.Count() > 0u)
-    {
-      std::ostringstream oss;
-      oss << "[" << mRemoveQueue.Count() << "]";
-      DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_TEXTURE_MANAGER_PROCESS_REMOVE_QUEUE", oss.str().c_str());
-    }
-  }
-#endif
+  DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_TEXTURE_MANAGER_PROCESS_REMOVE_QUEUE", [&](std::ostringstream& oss) {
+    oss << "[" << mRemoveQueue.Count() << "]";
+  });
 
   // Note that RemoveQueue is not be changed during Remove().
   for(auto&& textureId : mRemoveQueue)
@@ -826,19 +818,9 @@ void TextureManager::ProcessRemoveQueue()
     }
   }
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    if(mRemoveQueue.Count() > 0u)
-    {
-      std::ostringstream oss;
-      oss << "[" << mRemoveQueue.Count() << "]";
-      DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_TEXTURE_MANAGER_PROCESS_REMOVE_QUEUE", oss.str().c_str());
-    }
-  }
-#endif
-
   mRemoveQueue.Clear();
+
+  DALI_TRACE_END(gTraceFilter, "DALI_TEXTURE_MANAGER_PROCESS_REMOVE_QUEUE");
 }
 
 void TextureManager::Process(bool postProcessor)
index 0c3b3bb..6dba6b5 100644 (file)
@@ -552,15 +552,10 @@ bool VectorAnimationTask::Rasterize()
     return false;
   }
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    std::ostringstream oss;
+  DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", [&](std::ostringstream& oss) {
     oss << "[size:" << mWidth << "x" << mHeight << " ";
     oss << "url:" << mImageUrl.GetUrl() << "]";
-    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
-  }
-#endif
+  });
 
   ApplyAnimationData();
 
@@ -669,18 +664,13 @@ bool VectorAnimationTask::Rasterize()
     mKeepAnimation = true;
   }
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    std::ostringstream oss;
+  DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", [&](std::ostringstream& oss) {
     oss << "[size:" << mWidth << "x" << mHeight << " ";
     oss << "frame:" << mCurrentFrame << " ";
     oss << "loop:" << mCurrentLoop << " ";
     oss << "state:" << mPlayState << " ";
     oss << "url:" << mImageUrl.GetUrl() << "]";
-    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
-  }
-#endif
+  });
 
   return true;
 }
index f13a9c2..fb844ce 100644 (file)
@@ -184,35 +184,15 @@ void NPatchLoader::Remove(NPatchData::NPatchDataId id, TextureUploadObserver* te
 
 void NPatchLoader::Process(bool postProcessor)
 {
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    if(mRemoveQueue.size() > 0u)
-    {
-      std::ostringstream oss;
-      oss << "[" << mRemoveQueue.size() << "]";
-      DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_NPATCH_LOADER_PROCESS_REMOVE_QUEUE", oss.str().c_str());
-    }
-  }
-#endif
+  DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_NPATCH_LOADER_PROCESS_REMOVE_QUEUE", [&](std::ostringstream& oss) {
+    oss << "[" << mRemoveQueue.size() << "]";
+  });
 
   for(auto& iter : mRemoveQueue)
   {
     Remove(iter.first, iter.second);
   }
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    if(mRemoveQueue.size() > 0u)
-    {
-      std::ostringstream oss;
-      oss << "[" << mRemoveQueue.size() << "]";
-      DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_NPATCH_LOADER_PROCESS_REMOVE_QUEUE", oss.str().c_str());
-    }
-  }
-#endif
-
   mRemoveQueue.clear();
 
   if(Adaptor::IsAvailable())
@@ -220,6 +200,8 @@ void NPatchLoader::Process(bool postProcessor)
     Adaptor::Get().UnregisterProcessor(*this, true);
     mRemoveProcessorRegistered = false;
   }
+
+  DALI_TRACE_END(gTraceFilter, "DALI_NPATCH_LOADER_PROCESS_REMOVE_QUEUE");
 }
 
 NPatchDataPtr NPatchLoader::GetNPatchData(const VisualUrl& url, const Rect<int>& border, bool& preMultiplyOnLoad)
index 9939dc7..41956dd 100644 (file)
@@ -174,44 +174,29 @@ void SvgRasterizingTask::Process()
     return;
   }
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    std::ostringstream oss;
+  DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", [&](std::ostringstream& oss) {
     oss << "[size:" << mWidth << "x" << mHeight << " ";
     oss << "url:" << mImageUrl.GetUrl() << "]";
-    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
-  }
-#endif
+  });
 
   Devel::PixelBuffer pixelBuffer = mVectorRenderer.Rasterize(mWidth, mHeight);
   if(!pixelBuffer)
   {
     DALI_LOG_ERROR("Rasterize is failed!\n");
-#ifdef TRACE_ENABLED
-    if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-    {
-      std::ostringstream oss;
+    DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", [&](std::ostringstream& oss) {
       oss << "[size:" << mWidth << "x" << mHeight << " ";
       oss << "url:" << mImageUrl.GetUrl() << "]";
-      DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
-    }
-#endif
+    });
     return;
   }
 
   mPixelData    = Devel::PixelBuffer::Convert(pixelBuffer);
   mHasSucceeded = true;
 
-#ifdef TRACE_ENABLED
-  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
-  {
-    std::ostringstream oss;
+  DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", [&](std::ostringstream& oss) {
     oss << "[size:" << mWidth << "x" << mHeight << " ";
     oss << "url:" << mImageUrl.GetUrl() << "]";
-    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
-  }
-#endif
+  });
 }
 
 bool SvgRasterizingTask::IsReady()