Add API for setting resource destruction callback
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / windows / native-image-source-impl-win.cpp
index f1997a7..44742ee 100644 (file)
@@ -58,7 +58,8 @@ NativeImageSourceWin::NativeImageSourceWin(unsigned int width, unsigned int heig
   mBlendingRequired(false),
   mColorDepth(depth),
   mEglImageKHR(NULL),
-  mEglImageExtensions(NULL)
+  mEglImageExtensions(NULL),
+  mResourceDestructionCallback()
 {
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
 
@@ -157,6 +158,11 @@ void NativeImageSourceWin::DestroyResource()
   mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
 
   mEglImageKHR = NULL;
+
+  if(mResourceDestructionCallback)
+  {
+    mResourceDestructionCallback->Trigger();
+  }
 }
 
 unsigned int NativeImageSourceWin::TargetTexture()
@@ -263,6 +269,11 @@ bool NativeImageSourceWin::ReleaseBuffer()
   return false;
 }
 
+void NativeImageSourceWin::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+  mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
 } // namespace Adaptor
 
 } // namespace Internal