From: sanghyeok.oh Date: Wed, 18 Jul 2018 11:15:29 +0000 (+0900) Subject: libgdbus: replace gdbus proxy call with g_dbus_connection_call X-Git-Tag: submit/tizen/20180724.051226^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18728faa2781c56b67d94eb3f0d7fb72a618185b;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git libgdbus: replace gdbus proxy call with g_dbus_connection_call Replace g_dbus_proxy_call_with_unix_fd_list_sync with g_dbus_connection_call_with_unix_fd_list_sync. gdbus proxy is heavy operation - it makes multiple dbus calls to maintain proxy feature. This functionality is not needed to exchange fd list each other by libgdbus. Change-Id: I5f7b87614eddfd1a79d7aa82332c97dcc5cc6069 Signed-off-by: sanghyeok.oh --- diff --git a/src/libgdbus/dbus-system.c b/src/libgdbus/dbus-system.c index 79c97e6..42f061b 100755 --- a/src/libgdbus/dbus-system.c +++ b/src/libgdbus/dbus-system.c @@ -1796,7 +1796,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply(const char *dest, GVariant * var = NULL; GVariant * ret = NULL; dbus_handle_s *dh = NULL; - GDBusProxy *proxy = NULL; GUnixFDList *g_infdlist = NULL; GUnixFDList *g_outfdlist = NULL; @@ -1818,18 +1817,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply(const char *dest, if (signature && param) var = _append_variant(signature, param); - proxy = g_dbus_proxy_new_sync(dh->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, dest, path, iface, NULL, &err); - if (!proxy) { - if (err) { - _E("failed to proxy_new_sync(%s)\n", err->message); - g_error_free(err); - } else { - _E("failed to proxy_new_sync\n"); - if (var) - g_variant_unref(var); - } - } - /* append fd */ if (in_fdlist) { g_infdlist = g_unix_fd_list_new_from_array(in_fdlist, in_size); @@ -1841,14 +1828,18 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply(const char *dest, //if (g_unix_fd_list_append(g_infdlist, in_fdlist[0], &err) < 0) { } - ret = g_dbus_proxy_call_with_unix_fd_list_sync(proxy, method, var, G_DBUS_CALL_FLAGS_NONE, -1, - g_infdlist, &g_outfdlist, NULL, &err); + ret = g_dbus_connection_call_with_unix_fd_list_sync(dh->conn, + dest, path, iface, method, var, + NULL, G_DBUS_CALL_FLAGS_NONE, + -1, + g_infdlist, &g_outfdlist, + NULL, &err); if (!ret || err) { if (err) { - _E("failed to g_dbus_proxy_call_with_unix_fd_list_sync:%s", err->message); + _E("failed to g_dbus_connection_call_with_unix_fd_list_sync:%s", err->message); g_error_free(err); } else { - _E("failed to g_dbus_proxy_call_with_unix_fd_list_sync:"); + _E("failed to g_dbus_connection_call_with_unix_fd_list_sync:"); if (var) g_variant_unref(var); if (g_infdlist) @@ -1869,8 +1860,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply(const char *dest, out: if (g_outfdlist) g_object_unref(g_outfdlist); - if (proxy) - g_object_unref(proxy); return ret; } @@ -1888,7 +1877,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply_var(const char *d GError *err = NULL; GVariant * ret = NULL; dbus_handle_s *dh = NULL; - GDBusProxy *proxy = NULL; GUnixFDList *g_infdlist = NULL; GUnixFDList *g_outfdlist = NULL; @@ -1907,19 +1895,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply_var(const char *d return NULL; } - proxy = g_dbus_proxy_new_sync(dh->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, dest, path, iface, NULL, &err); - if (!proxy) { - if (err) { - _E("failed to proxy_new_sync(%s)\n", err->message); - g_error_free(err); - } else { - _E("failed to proxy_new_sync\n"); - if (param) - g_variant_unref(param); - } - goto out; - } - /* append fd */ if (in_fdlist) { g_infdlist = g_unix_fd_list_new_from_array(in_fdlist, in_size); @@ -1932,14 +1907,18 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply_var(const char *d } /* send message */ - ret = g_dbus_proxy_call_with_unix_fd_list_sync(proxy, method, param, G_DBUS_CALL_FLAGS_NONE, -1, - g_infdlist, &g_outfdlist, NULL, &err); + ret = g_dbus_connection_call_with_unix_fd_list_sync(dh->conn, + dest, path, iface, method, param, + NULL, G_DBUS_CALL_FLAGS_NONE, + -1, + g_infdlist, &g_outfdlist, + NULL, &err); if (!ret || err) { if (err) { - _E("failed to g_dbus_proxy_call_with_unix_fd_list_sync:%s", err->message); + _E("failed to g_dbus_connection_call_with_unix_fd_list_sync:%s", err->message); g_error_free(err); } else { - _E("failed to g_dbus_proxy_call_with_unix_fd_list_sync:"); + _E("failed to g_dbus_connection_call_with_unix_fd_list_sync:"); if (param) g_variant_unref(param); if (g_infdlist) @@ -1958,8 +1937,6 @@ GVariant *dbus_handle_method_with_unix_fd_list_sync_with_reply_var(const char *d out: if (g_outfdlist) g_object_unref(g_outfdlist); - if (proxy) - g_object_unref(proxy); return ret; }