Revert "[4.0] When native image is destroyed, it release of wl buffer and remote... 93/155793/1
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 16 Oct 2017 07:10:15 +0000 (16:10 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 16 Oct 2017 07:10:19 +0000 (16:10 +0900)
This reverts commit 29d7dd78b7d05ebea57b31c38f9840db515e1b9a.

Change-Id: Ic35f2bec303631795d48d311204e1745ffb5c047

widget_viewer_dali/internal/widget_view/widget_view_impl.cpp
widget_viewer_dali/internal/widget_view/widget_view_impl.h

index b86aac75c3f433020a846ca7c395e87d0339dcef..ae032838fbd8dc9b932c918eccf7085adfbf31a0 100644 (file)
@@ -42,7 +42,6 @@
 #include <unistd.h>
 #include <libintl.h>
 #include <xkbcommon/xkbcommon.h>
-#include <dali/devel-api/images/native-image-interface-extension.h>
 
 namespace Dali
 {
@@ -203,7 +202,15 @@ static void OnBufferUpdated( struct tizen_remote_surface *surface, uint32_t type
 
     //get tbm surface from buffer
     tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
-    widgetView->UpdateImageSource( tbmSurface, buffer, surface);
+    widgetView->UpdateImageSource( tbmSurface );
+  }
+
+  if( preBuffer != NULL && tizen_remote_surface_get_version( surface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION )
+  {
+    tizen_remote_surface_release( surface, preBuffer );
+    tbm_surface_h preTbmSurface = (tbm_surface_h)wl_buffer_get_user_data( preBuffer );
+    tbm_surface_internal_unref( preTbmSurface );
+    wl_buffer_destroy( preBuffer );
   }
 
   remoteSurface = surface;
@@ -988,62 +995,11 @@ bool WidgetView::IsWidgetImageView()
   return ( mWidgetImageView )? true: false;
 }
 
-
-class DestructorCallback: public CallbackBase
+void WidgetView::UpdateImageSource( tbm_surface_h source )
 {
-public:
-  DestructorCallback(void *buffer ,void *surface)
-  :CallbackBase( reinterpret_cast< void* >( this ),
-   NULL, // we get the dispatcher to call function directly
-   reinterpret_cast< CallbackBase::Dispatcher>( &DestructorCallback::Dispatcher) ),
-   mWlBuffer( buffer ),
-   mRemoteSurface( surface ) {
-
-  }
-
-  void RunCallback()
-  {
-    struct wl_buffer *buffer = static_cast< struct wl_buffer* >(mWlBuffer);
-    struct tizen_remote_surface *surface = static_cast< struct tizen_remote_surface* >(mRemoteSurface);
-    if (tizen_remote_surface_get_version( surface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) {
-        tizen_remote_surface_release( surface, buffer );
-        tbm_surface_h preTbmSurface = (tbm_surface_h)wl_buffer_get_user_data( buffer );
-        tbm_surface_internal_unref( preTbmSurface );
-        wl_buffer_destroy( buffer );
-    }
-  }
-
-  static void Dispatcher( CallbackBase& base )
-  {
-    DestructorCallback& callback( static_cast< DestructorCallback& >( base) );
-    callback.RunCallback();
-  }
-
-  ~DestructorCallback()
-  {
-  }
-
-private:
-  void *mWlBuffer ;
-  void *mRemoteSurface;
-};
-
-
-void WidgetView::UpdateImageSource( tbm_surface_h source , struct wl_buffer *buffer , struct tizen_remote_surface *surface)
-{
-  DestructorCallback* callback = new DestructorCallback( buffer, surface );
-  TriggerEventFactory triggerEventFactory;
-  TriggerEventInterface* notification = triggerEventFactory.CreateTriggerEvent( callback,
-                                                                                TriggerEventInterface::DELETE_AFTER_TRIGGER );
-
   mImageSource = Dali::NativeImageSource::New( source );
   Dali::NativeImage image = Dali::NativeImage::New( *mImageSource );
 
-  NativeImageInterfacePtr mImageSourcePtr = static_cast< NativeImageInterfacePtr >(mImageSource);
-  NativeImageInterface::Extension* extension = mImageSourcePtr->GetExtension();
-  if( extension )
-   extension->SetDestructorNotification(notification);
-
   if( mWidgetImageView )
   {
     mWidgetImageView.SetImage( image );
index f772df04b67cb23949b0ffc95d9e7f97e24b76ed..8aedda1a5dace3f1d9d9e14a5d75e60b0b57c2be 100644 (file)
@@ -30,7 +30,6 @@
 #include <wayland-extension/tizen-remote-surface-client-protocol.h>
 #include <tbm_surface.h>
 #include <screen_connector_toolkit.h>
-#include <dali/integration-api/adaptors/trigger-event-factory.h>
 
 namespace Dali
 {
@@ -136,7 +135,7 @@ public: // Internal API
 
   bool IsWidgetImageView();
 
-  void UpdateImageSource( tbm_surface_h source , struct wl_buffer *buffer , struct tizen_remote_surface *surface);
+  void UpdateImageSource( tbm_surface_h source );
 
   void CreateWidgetImageView();