Deleted unnecessary checks for gsource is destroyed. 32/231432/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 20 Apr 2020 05:57:42 +0000 (14:57 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 20 Apr 2020 05:57:42 +0000 (14:57 +0900)
Change-Id: I03d527cfd0b1986a32f14e8b106e5f83bddefa16
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 48c9507..29af684 100755 (executable)
@@ -252,13 +252,6 @@ _twe_thread_del_source_dispatch(GSource *source, GSourceFunc cb, gpointer data)
 
        g_mutex_lock(&_twe_ctx->thread_mutex);
 
-       if (g_source_is_destroyed(source)) {
-               TPL_ERR("del_source(%p) already destroyed.", source);
-               g_cond_signal(&_twe_ctx->thread_cond);
-               g_mutex_unlock(&_twe_ctx->thread_mutex);
-               return G_SOURCE_REMOVE;
-       }
-
        cond = g_source_query_unix_fd(source, del_source->tag);
 
        if (cond & G_IO_IN) {
@@ -315,11 +308,6 @@ _twe_thread_del_source_trigger(twe_del_source *del_source)
        uint64_t value = 1;
        int ret;
 
-       if (!del_source || g_source_is_destroyed(&del_source->gsource)) {
-               TPL_ERR("del_source(%p) is already destroyed.", del_source);
-               return;
-       }
-
        ret = write(del_source->event_fd, &value, sizeof(uint64_t));
        if (ret == -1) {
                TPL_ERR("failed to send delete event. twe_del_source(%p)",
@@ -382,11 +370,6 @@ _twe_thread_tdm_source_dispatch(GSource *source, GSourceFunc cb, gpointer data)
        tdm_error tdm_err = TDM_ERROR_NONE;
        GIOCondition cond;
 
-       if (!source || g_source_is_destroyed(source)) {
-               TPL_ERR("TDM source(%p) already destroyed.", source);
-               return G_SOURCE_REMOVE;
-       }
-
        cond = g_source_query_unix_fd(source, tdm_source->tag);
 
        if (cond & G_IO_IN) {
@@ -490,11 +473,6 @@ _twe_thread_tdm_source_destroy(void *source)
 {
        twe_tdm_source *tdm_source = (twe_tdm_source *)source;
 
-       if (!tdm_source || g_source_is_destroyed(&tdm_source->gsource)) {
-               TPL_ERR("TDM source(%p) already destroyed.", tdm_source);
-               return;
-       }
-
        _twe_ctx->tdm_source = NULL;
 
        g_source_remove_unix_fd(&tdm_source->gsource, tdm_source->tag);
@@ -657,13 +635,6 @@ _twe_thread_wl_disp_check(GSource *source)
        twe_wl_disp_source *disp_source = (twe_wl_disp_source *)source;
        gboolean ret = FALSE;
 
-       if (g_source_is_destroyed(source)) {
-               if (disp_source && disp_source->disp && disp_source->prepared)
-                       wl_display_cancel_read(disp_source->disp);
-               TPL_ERR("display source(%p) already destroyed.", source);
-               return ret;
-       }
-
        if (!disp_source->prepared)
                return ret;
 
@@ -686,11 +657,6 @@ _twe_thread_wl_disp_dispatch(GSource *source, GSourceFunc cb, gpointer data)
 {
        twe_wl_disp_source *disp_source = (twe_wl_disp_source *)source;
 
-       if (g_source_is_destroyed(source)) {
-               TPL_ERR("display source(%p) already destroyed.", source);
-               return G_SOURCE_REMOVE;
-       }
-
        g_mutex_lock(&disp_source->wl_event_mutex);
        if (disp_source->gfd.revents & G_IO_IN) {
                if (wl_display_dispatch_queue_pending(disp_source->disp,
@@ -2357,11 +2323,6 @@ _twe_thread_wl_surface_dispatch(GSource *source, GSourceFunc cb, gpointer data)
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)source;
        GIOCondition cond;
 
-       if (g_source_is_destroyed(source)) {
-               TPL_ERR("surface source(%p) already destroyed.", source);
-               return G_SOURCE_REMOVE;
-       }
-
        cond = g_source_query_unix_fd(source, surf_source->tag);
 
        if (cond & G_IO_IN) {
@@ -2907,11 +2868,6 @@ twe_surface_create_swapchain(twe_surface_h twe_surface,
        tbm_bufmgr bufmgr = NULL;
        unsigned int capability;
 
-       if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
-               TPL_ERR("twe_surface(%p) is invalid.", twe_surface);
-               return TPL_ERROR_INVALID_PARAMETER;
-       }
-
        if (surf_source->tbm_queue) {
                TPL_LOG_B(BACKEND, "[REUSE SWAPCHAIN] surf_source(%p) tbm_queue(%p)",
                                  surf_source, surf_source->tbm_queue);
@@ -3040,11 +2996,6 @@ twe_surface_destroy_swapchain(twe_surface_h twe_surface)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface;
 
-       if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
-               TPL_ERR("twe_surface(%p) is invalid.", twe_surface);
-               return TPL_ERROR_INVALID_PARAMETER;
-       }
-
        TPL_LOG_T(BACKEND, "[SWAPCHAIN_DESTROY] twe_surface(%p) tbm_queue(%p)",
                          twe_surface, surf_source->tbm_queue);
 
@@ -3090,11 +3041,6 @@ twe_surface_get_swapchain_buffers(twe_surface_h twe_surface,
        twe_wl_disp_source *disp_source = NULL;
        int ret = 1;
 
-       if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
-               TPL_ERR("twe_surface(%p) is invalid.", twe_surface);
-               return TPL_ERROR_INVALID_PARAMETER;
-       }
-
        if (!buffer_count) {
                TPL_ERR("Invalid parameter. buffer_count is NULL.");
                return TPL_ERROR_INVALID_PARAMETER;
@@ -3435,11 +3381,6 @@ twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns)
        twe_wl_disp_source *disp_source = NULL;
        gint64 end_time;
 
-       if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
-               TPL_ERR("Invalid parameter. surf_source(%p)", surf_source);
-               return TPL_ERROR_INVALID_PARAMETER;
-       }
-
        disp_source = surf_source->disp_source;
 
        if (timeout_ns != UINT64_MAX)
@@ -3588,11 +3529,6 @@ twe_surface_set_post_interval(twe_surface_h twe_surface, int post_interval)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface;
 
-       if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
-               TPL_ERR("Invalid parameter. surf_source(%p)", surf_source);
-               return TPL_ERROR_INVALID_PARAMETER;
-       }
-
        surf_source->post_interval = post_interval;
 
        TPL_LOG_T(BACKEND, "surf_source(%p) post_interval(%d)",