From: Sangjin Lee Date: Tue, 11 Jul 2017 04:34:58 +0000 (+0900) Subject: log: use public wayland api X-Git-Tag: accepted/tizen/3.0/common/20170721.115114~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F138072%2F1;p=platform%2Fcore%2Fuifw%2Flibtdm.git log: use public wayland api remove useless code for protocol log. Change-Id: Ide45ca176c8998f604f8f55664271a1c89d5208b --- diff --git a/src/tdm_event_loop.c b/src/tdm_event_loop.c index 7445ad5..c947243 100644 --- a/src/tdm_event_loop.c +++ b/src/tdm_event_loop.c @@ -532,91 +532,6 @@ _trace_get_next_argument(const char *signature, return signature; } -#if !TDM_WAYLAND_LOGGER - -static void -_trace_protocol_cb(struct wl_closure *closure, struct wl_resource *resource, int send) -{ - int i; - struct argument_details arg; - struct wl_object *object = &resource->object; - struct wl_client *client = resource->client; - const char *signature = closure->message->signature; - struct timespec tp; - unsigned int time; - pid_t pid = -1; - const char *proc_name; - char temp[512] = { 0, }, *p = temp; - int len = sizeof(temp), *l = &len; - - if (client) { - _trace_reg_client_destroy_listener(client); - wl_client_get_credentials(client, &pid, NULL, NULL); - } - - proc_name = tdm_server_get_client_name(pid); - - clock_gettime(CLOCK_MONOTONIC, &tp); - time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000); - - TDM_SNPRINTF(p, l, "[%10.3f] %s%d%s%s@%u.%s(", - time / 1000.0, - send ? "Server -> Client [PID:" : "Server <- Client [PID:", - pid, "] ", - object->interface->name, object->id, closure->message->name); - - for (i = 0; i < closure->count; i++) { - signature = _trace_get_next_argument(signature, &arg); - TDM_RETURN_IF_FAIL(signature != NULL); - - if (i > 0) - TDM_SNPRINTF(p, l, ", "); - - switch (arg.type) { - case 'u': - TDM_SNPRINTF(p, l, "%u", closure->args[i].u); - break; - case 'i': - TDM_SNPRINTF(p, l, "%d", closure->args[i].i); - break; - case 'f': - TDM_SNPRINTF(p, l, "%f", wl_fixed_to_double(closure->args[i].f)); - break; - case 's': - TDM_SNPRINTF(p, l, "\"%s\"", closure->args[i].s); - break; - case 'o': - if (closure->args[i].o) - TDM_SNPRINTF(p, l, "%s@%u", closure->args[i].o->interface->name, closure->args[i].o->id); - else - TDM_SNPRINTF(p, l, "nil"); - break; - case 'n': - TDM_SNPRINTF(p, l, "new id %s@", - (closure->message->types[i]) ? closure->message->types[i]->name : "[unknown]"); - if (closure->args[i].n != 0) - TDM_SNPRINTF(p, l, "%u", closure->args[i].n); - else - TDM_SNPRINTF(p, l, "nil"); - break; - case 'a': - TDM_SNPRINTF(p, l, "array"); - break; - case 'h': - TDM_SNPRINTF(p, l, "fd %d", closure->args[i].h); - break; - default: - return; - } - } - - TDM_SNPRINTF(p, l, "), cmd: %s", proc_name ? proc_name : "Unknown"); - - TDM_INFO("%s", temp); -} - -#else - static struct wl_protocol_logger *_trace_protocol_logger; static void @@ -652,7 +567,7 @@ _trace_protocol_logger_cb(void *user_data, time / 1000.0, send ? "Server -> Client [PID:" : "Server <- Client [PID:", pid, "] ", - wl_resource_get_name(message->resource), + wl_resource_get_class(message->resource), wl_resource_get_id(message->resource), message->message->name); @@ -680,7 +595,7 @@ _trace_protocol_logger_cb(void *user_data, case 'o': if (message->arguments[i].o) TDM_SNPRINTF(p, l, "%s@%u", - wl_resource_get_name((struct wl_resource *) message->arguments[i].o), + wl_resource_get_class((struct wl_resource *) message->arguments[i].o), wl_resource_get_id((struct wl_resource *) message->arguments[i].o)); else TDM_SNPRINTF(p, l, "nil"); @@ -708,7 +623,6 @@ _trace_protocol_logger_cb(void *user_data, TDM_INFO("%s", temp); } -#endif INTERN tdm_error tdm_event_loop_trace_enable(tdm_private_display * private_display, @@ -719,26 +633,18 @@ tdm_event_loop_trace_enable(tdm_private_display * private_display, TDM_RETURN_VAL_IF_FAIL(private_loop->wl_display != NULL, TDM_ERROR_NONE); if (!enable) { -#if !TDM_WAYLAND_LOGGER - wl_debug_server_debug_func_set(NULL); -#else if (_trace_protocol_logger) { wl_protocol_logger_destroy(_trace_protocol_logger); _trace_protocol_logger = NULL; } -#endif return TDM_ERROR_NONE; } -#if !TDM_WAYLAND_LOGGER - wl_debug_server_debug_func_set((wl_server_debug_func_ptr) _trace_protocol_cb); -#else if (_trace_protocol_logger) wl_protocol_logger_destroy(_trace_protocol_logger); _trace_protocol_logger = wl_display_add_protocol_logger(private_loop->wl_display, _trace_protocol_logger_cb, NULL); -#endif return TDM_ERROR_NONE; } diff --git a/src/tdm_private.h b/src/tdm_private.h index 25b24b7..4ea122d 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -696,26 +696,6 @@ void tdm_monitor_server_command(tdm_display *dpy, const char *options, char *reply, int *len); - -#define TDM_WAYLAND_LOGGER ((WAYLAND_VERSION_MAJOR == 1) && (WAYLAND_VERSION_MINOR > 11)) - -#if !TDM_WAYLAND_LOGGER -#ifndef WL_CLOSURE_MAX_ARGS -#define WL_CLOSURE_MAX_ARGS 20 -#endif - -struct wl_closure { - int count; - const struct wl_message *message; - uint32_t opcode; - uint32_t sender_id; - union wl_argument args[WL_CLOSURE_MAX_ARGS]; - struct wl_list link; - struct wl_proxy *proxy; - struct wl_array extra[0]; -}; -#endif /* TDM_WAYLAND_LOGGER */ - struct argument_details { char type; int nullable;