Revert "[4.0] When native image is destroyed, it release of wl buffer and remote... 25/156225/1
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Tue, 17 Oct 2017 12:44:24 +0000 (21:44 +0900)
committertaeyoon0.lee <taeyoon0.lee@samsung.com>
Tue, 17 Oct 2017 12:44:49 +0000 (21:44 +0900)
This reverts commit ee2382c933fb591b23a980a33ee8653e3f846c39.

Change-Id: I66a923cf802151d41e310e7f1db05d40f2fed614

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

index f34c02609d0c65efea9d9e22e2f47cc473351149..8a9f205697005b53757f0165d2282d4513257c56 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
 {
@@ -202,7 +201,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;
@@ -1004,62 +1011,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 7009bf4b5216726628ad756b9801c5bdbbc26a42..c7e2039c890f147f88590dbea139b12ccf770922 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();