Remove hash table when recognition start 16/172116/1
authorWonnam Jang <wn.jang@samsung.com>
Fri, 12 Jan 2018 13:02:33 +0000 (22:02 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Mon, 12 Mar 2018 02:54:02 +0000 (02:54 +0000)
Change-Id: I0f1a046658c94ad1229f9030e9567b2933df6577
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
(cherry picked from commit 1359e0d28dc9a2abe26f33cb7f242114d686e83e)

src/vc_elm.c
src/vc_elm_core.c
src/vc_elm_core_default_widgets.c
src/vc_elm_efl_dump.h

index ecddc88..4f883cf 100644 (file)
@@ -407,6 +407,8 @@ int vc_elm_get_action_command(const char *action, char **command)
                return VC_ELM_ERROR_OPERATION_FAILED;
        }
        memcpy(*command, command_name, len);
+
+       VC_ELM_LOG_INFO("[SUCCESS] get action command, action(%s), command(%s)", action, *command);
        return VC_ELM_ERROR_NONE;
 }
 
@@ -447,6 +449,8 @@ int vc_elm_create_object(Evas_Object *object, vc_elm_h *vc_elm)
        handler->data = (void *)object;
        g_handlers_list = eina_list_append(g_handlers_list, handler);
        *vc_elm = (vc_elm_h)handler;
+
+       VC_ELM_LOG_INFO("[SUCCESS] create object(%s)", _get_ui_object_name(object));
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_NONE;
 }
@@ -484,6 +488,8 @@ int vc_elm_create_item(Elm_Object_Item *item, vc_elm_h *vc_elm)
        handler->data = (void *)item;
        g_handlers_list = eina_list_append(g_handlers_list, handler);
        *vc_elm = (vc_elm_h)handler;
+
+       VC_ELM_LOG_INFO("[SUCCESS] create item object)");
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_NONE;
 }
@@ -519,6 +525,8 @@ int vc_elm_destroy(vc_elm_h vc_elm)
        g_handlers_list = eina_list_remove_list(g_handlers_list, list);
        free(handler);
        handler = NULL;
+
+       VC_ELM_LOG_INFO("[SUCCESS] destroy");
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_NONE;
 }
@@ -546,6 +554,8 @@ int vc_elm_set_command(vc_elm_h vc_elm, const char *command)
                Elm_Object_Item *it = (Elm_Object_Item *)handler->data;
                return _vc_elm_set_item_object_command(it, command);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] set command(%s)", command);
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
@@ -573,6 +583,8 @@ int vc_elm_unset_command(vc_elm_h vc_elm)
                Elm_Object_Item *it = (Elm_Object_Item *)handler->data;
                return _vc_elm_unset_item_object_command(it);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] unset command");
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
@@ -600,6 +612,8 @@ int vc_elm_set_command_hint(vc_elm_h vc_elm, const char* hint)
                Elm_Object_Item *it = (Elm_Object_Item *)handler->data;
                return _vc_elm_set_item_object_hint(it, hint);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] set hint(%s)", hint);
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
@@ -627,6 +641,8 @@ int vc_elm_unset_command_hint(vc_elm_h vc_elm)
                Elm_Object_Item *it = (Elm_Object_Item *)handler->data;
                return _vc_elm_unset_item_object_hint(it);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] unset hint");
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
@@ -655,6 +671,8 @@ int vc_elm_set_command_hint_direction(vc_elm_h vc_elm, vc_elm_direction_e direct
                Evas_Object *parent = elm_object_item_widget_get(it);
                return _vc_elm_set_sub_item_hint_direction(parent, direction);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] set hint direction(%d)", direction);
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
@@ -683,6 +701,8 @@ int vc_elm_get_command_hint_direction(vc_elm_h vc_elm, vc_elm_direction_e *direc
                Evas_Object *parent = elm_object_item_widget_get(it);
                return _vc_elm_get_sub_item_hint_direction(parent, direction);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] get hint direction(%d)", *direction);
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
 
@@ -709,6 +729,8 @@ int vc_elm_set_command_hint_offset(vc_elm_h vc_elm, int pos_x, int pos_y)
                Elm_Object_Item *it = (Elm_Object_Item *)handler->data;
                return _vc_elm_set_item_object_custom_hint(it, NULL, pos_x, pos_y);
        }
+
+       VC_ELM_LOG_INFO("[SUCCESS] set hint offset, x(%d), y(%d)", pos_x, pos_y);
        _vc_elm_core_set_view_changed();
        return VC_ELM_ERROR_INVALID_PARAMETER;
 }
index be33e73..2e37c30 100644 (file)
@@ -507,14 +507,14 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa
                        return EINA_FALSE;
                }
 
-               VC_ELM_LOG_DBG("command(%s)", temp);
+               VC_ELM_LOG_DBG("found evas_object(%p), command(%s)", found->obj, temp);
                const char* action = NULL;
                if (strlen(cmd) > strlen(temp)) {
                        action = &cmd[strlen(temp) + 1];
                        VC_ELM_LOG_DBG("action(%s)", &cmd[strlen(temp) + 1]);
                }
                found->cmd = temp;
-               VC_ELM_LOG_DBG("unwrapping %s %s for %s", param1, param2, _get_ui_object_name(found->obj));
+               VC_ELM_LOG_DBG("unwrapping %s %s for %s(%s)", param1, param2, _get_ui_object_name(found->obj), evas_object_type_get(found->obj));
                found->unwrap_callback(found, action, param2);
 
                return EINA_TRUE;
@@ -587,6 +587,51 @@ static Eina_Bool __idle_enter(void *data);
  */
 /*static Eina_Bool _delayed_window_load(void *data);*/
 
+void _vc_elm_core_init_cmd_hash()
+{
+       if (!item_hint_map)
+               item_hint_map = eina_hash_pointer_new(__hash_entry_free_cb);
+       if (!item_command_map)
+               item_command_map = eina_hash_pointer_new(__hash_entry_free_cb);
+       if (!item_custom_map)
+               item_custom_map = eina_hash_pointer_new(__hash_entry_free_cb);
+       if (!command_item_map)
+               command_item_map = eina_hash_string_superfast_new(__hash_entry_free_cb);
+
+       VC_ELM_LOG_DBG("############## COMMAND HASH INIT ##############");
+}
+
+
+
+void _vc_elm_core_deinit_cmd_hash()
+{
+       if (item_hint_map && 0 != eina_hash_population(item_hint_map)) {
+               VC_ELM_LOG_DBG("item_hint_map HASH FREE");
+               eina_hash_free_cb_set(item_hint_map, __hash_entry_dummy_cb);
+               eina_hash_free(item_hint_map);
+               item_hint_map = NULL;
+       }
+       if (item_command_map && 0 != eina_hash_population(item_command_map)) {
+               VC_ELM_LOG_DBG("item_command_map HASH FREE");
+               eina_hash_free_cb_set(item_command_map, __hash_entry_dummy_cb);
+               eina_hash_free(item_command_map);
+               item_command_map = NULL;
+       }
+       if (item_custom_map && 0 != eina_hash_population(item_custom_map)) {
+               VC_ELM_LOG_DBG("item_custom_map HASH FREE");
+               eina_hash_free_cb_set(item_custom_map, __hash_entry_dummy_cb);
+               eina_hash_free(item_custom_map);
+               item_custom_map = NULL;
+       }
+       if (command_item_map && 0 != eina_hash_population(command_item_map)) {
+               VC_ELM_LOG_DBG("eina_hash_free HASH FREE");
+               eina_hash_free_cb_set(command_item_map, __hash_entry_dummy_cb);
+               eina_hash_free(command_item_map);
+               command_item_map = NULL;
+       }
+       VC_ELM_LOG_DBG("############## COMMAND HASH DEINIT ##############");
+}
+
 void _vc_elm_core_init()
 {
        int ret;
@@ -595,15 +640,12 @@ void _vc_elm_core_init()
 //     bindtextdomain("voice-control-elm", "/usr/share/locale/");
 
        g_widget_info_hash = eina_hash_string_djb2_new(__widget_info_free_cb);
-       item_hint_map = eina_hash_pointer_new(__hash_entry_free_cb);
-       item_command_map = eina_hash_pointer_new(__hash_entry_free_cb);
-       item_custom_map = eina_hash_pointer_new(__hash_entry_free_cb);
-       command_item_map = eina_hash_string_superfast_new(__hash_entry_free_cb);
        registered_item_map = eina_hash_string_superfast_new(__hash_entry_free_cb);
 
        g_config_action_map = eina_hash_string_superfast_new(__hash_entry_stringshare_free_cb);
        g_config_widget_map = eina_hash_string_superfast_new(__hash_entry_eina_list_free_cb);
 
+       _vc_elm_core_init_cmd_hash();
 
        if (NULL == g_allowed_text_part_list) {
                g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, strdup("elm.text"));
@@ -710,6 +752,7 @@ static Eina_List *__get_objects_of_visible_items(Evas_Object *parent, Elm_Object
                        if (item_hint != NULL)
                                evas_object_data_set(obj, VC_ELM_HINT_DATA_KEY, item_hint);
                        evas_object_data_set(obj, VC_ELM_CMD_DATA_KEY, item_command);
+                       VC_ELM_LOG_DBG("set CMD_DATA_KEY : object_item(%p), item_command(%s)", (void*)item, item_command);
                }
 
                item_custom_date = eina_hash_find(item_custom_map, &item);
@@ -875,7 +918,7 @@ static void __elm_widget_foreach_in_tree(Evas_Object *widget, Eina_Bool(*cb)(Eva
 {
        Eina_Bool visible = evas_object_visible_get(widget);
 
-       VC_ELM_LOG_DBG("IS visible %s %d", _get_ui_object_name(widget), visible);
+       VC_ELM_LOG_DBG("IS visible (%p)(%s)(%s), visible(%d)", widget, _get_ui_object_name(widget), evas_object_type_get(widget), visible);
        if (visible) {
                Eina_List *list = NULL;
                const Eina_List *constant_list = NULL;
@@ -897,6 +940,7 @@ static void __elm_widget_foreach_in_tree(Evas_Object *widget, Eina_Bool(*cb)(Eva
                cb(widget, data);
 
                if (NULL != (info = eina_hash_find(g_widget_info_hash, obj_name)) && obj_name != NULL && NULL != info->get_subobjects_func) {
+                       VC_ELM_LOG_DBG("call subobjects_func, constant_list(%d)", eina_list_count(list));
                        constant_list = info->get_subobjects_func(widget, info->user_data);
                } else if (obj_name != NULL && (!strcmp("Elm_Button", obj_name) || !strcmp("Elm_Index", obj_name))) {
                        /* We dont want to have a tooltip for elm_icon on button */
@@ -959,17 +1003,19 @@ static void __elm_widget_foreach_in_tree(Evas_Object *widget, Eina_Bool(*cb)(Eva
                        constant_list = elm_widget_can_focus_child_list_get(widget);
                }
 
+               VC_ELM_LOG_DBG("list (%d) constant_list(%d)", eina_list_count(list), eina_list_count(constant_list));
                if (list)
                        constant_list = list;
 
                EINA_LIST_FOREACH(constant_list, l, obj) {
                        const char *current_name = _get_ui_object_name(obj);
 
-                       VC_ELM_LOG_DBG("calling %p %s", (void*)obj, current_name);
+                       VC_ELM_LOG_DBG("calling evas_object(%p)[%s], focused(%d)", (void*)obj, current_name, elm_object_focus_get(obj));
 
-                       if ((current_name != NULL) && ((0 == strcmp(current_name, "Elm_Inwin")) || (0 == strcmp(current_name, "Elm_Popup")) || ((0 == strcmp(current_name, "Elm_Ctxpopup") && (evas_object_visible_get(obj)))))) {
-                               /*overlaying widget found, remove other widgets found,
-                                traverse it's subtree and return*/
+                       if ((current_name != NULL) && ((0 == strcmp(current_name, "Elm_Inwin"))
+                               || (((0 == strcmp(current_name, "Elm_Popup")) || (0 == strcmp(current_name, "Elm_Ctxpopup")))
+                                       && (evas_object_visible_get(obj)) && (EINA_TRUE == elm_object_focus_get(obj))))) {
+                               /*overlaying widget found, remove other widgets found, traverse it's subtree and return*/
                                VC_ELM_LOG_INFO("overlaying widget: found");
 
                                if (data && (*data)) {
@@ -979,7 +1025,7 @@ static void __elm_widget_foreach_in_tree(Evas_Object *widget, Eina_Bool(*cb)(Eva
 
                                __elm_widget_foreach_in_tree(obj, cb, data);
 
-                               VC_ELM_LOG_INFO("overlaying widget: subtree finished");
+                               VC_ELM_LOG_INFO("overlaying widget: subtree finished, list(%d)", (data && (*data)) ? eina_list_count(*data) : 0);
                                return;
                        } else {
                                /*continue traversing other subtrees*/
@@ -1099,6 +1145,11 @@ void _show_tooltips()
        Evas_Coord w_p;
        Evas_Coord h_p;
 
+       VC_ELM_LOG_DBG("show_tooltips");
+
+       _vc_elm_core_deinit_cmd_hash();
+       _vc_elm_core_init_cmd_hash();
+
        __idle_enter(NULL);
 
        VC_ELM_LOG_DBG("show_tooltips");
@@ -1394,7 +1445,7 @@ static void __vc_add_commands()
 
                obj_name = eina_stringshare_add(obj_name);
 
-               VC_ELM_LOG_DBG("obj(%p), command %s", (void*)obj, evas_object_data_get(obj, VC_ELM_CMD_DATA_KEY));
+               VC_ELM_LOG_DBG("evas_obj(%p), command %s", (void*)obj, evas_object_data_get(obj, VC_ELM_CMD_DATA_KEY));
                if (obj_name)
                        VC_ELM_LOG_DBG("Adding command for %s", obj_name);
                if ((!obj_name && evas_object_data_get(obj, "special_item")) || (obj_name && (!strcmp(obj_name, "Elm_Layout") && evas_object_data_get(obj, "special_item"))))
@@ -1609,11 +1660,12 @@ static void __unwrap_universal_item_command(struct Wrapped_Command *wrapper, con
        unwr->wrap = wrapper;
        unwr->action = (action) ? strdup(action) : NULL;
        unwr->param = (param) ? strdup(param) : NULL;
-       VC_ELM_LOG_DBG("__unwrap_universal_item_command with params: %p %p %s %s", (void *)wrapper->obj, (void *)item, action, param);
+       VC_ELM_LOG_DBG("__unwrap_universal_item_command with params: %p %p %s %s, wrapper(%s)", (void *)wrapper->obj, (void *)item, action, param, wrapper->cmd);
 
        if (NULL != item) {
                parent = elm_object_parent_widget_get(_vc_elm_core_get_evas_object(item));
 
+               VC_ELM_LOG_DBG("Parent evas_object(%s)(%s)", _get_ui_object_name(parent), evas_object_type_get(parent));
                while (NULL != parent) {
                        if (0 == strcmp(_get_ui_object_name(parent), "Elm_Genlist")) {
                                evas_object_geometry_get(_vc_elm_core_get_evas_object(item), &x, &y, &w, &h);
@@ -1690,6 +1742,8 @@ static void __item__object_del_callback(void *data, Evas_Object *obj, void *even
        cdata = (struct Custom_Data *)eina_hash_find(item_custom_map, &obj_item);
        free(cdata);
 
+       VC_ELM_LOG_DBG("object_item(%p) has been deleted, command(%s)", obj_item, command);
+
        eina_hash_del(item_hint_map, &obj_item, NULL);
        eina_hash_del(item_command_map, &obj_item, NULL);
        eina_hash_del(item_custom_map, &obj_item, NULL);
@@ -1707,7 +1761,7 @@ Eina_Bool _vc_elm_core_set_object_command(Evas_Object *obj, const char *_command
        evas_object_data_set(obj, VC_ELM_CMD_DATA_KEY, command);
        if (NULL == eina_list_data_find(ui_objects_list, obj))
                ui_objects_list = eina_list_append(ui_objects_list, obj);
-       VC_ELM_LOG_DBG("added new item %d %p", eina_list_count(ui_objects_list), (void*)obj);
+       VC_ELM_LOG_DBG("added new object, num(%d), evas_object(%p)", eina_list_count(ui_objects_list), (void*)obj);
        evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __object_del_callback, command);
        return EINA_TRUE;
 }
@@ -1717,7 +1771,7 @@ static Eina_Bool _vc_elm_core_set_auto_object_command(Evas_Object *obj, const ch
        char *temp = NULL;
        temp = evas_object_data_get(obj, VC_ELM_CMD_DATA_KEY);
        if (NULL != temp) {
-               VC_ELM_LOG_DBG("obj(%p) already has command(%s)", (void*)obj, temp);
+               VC_ELM_LOG_DBG("evas_obj(%p) already has command(%s)", (void*)obj, temp);
                return EINA_FALSE;
        }
 
@@ -1753,7 +1807,7 @@ Eina_Bool _vc_elm_core_set_item_object_command(Elm_Object_Item *obj, const char
        const char *command = eina_stringshare_add(_command);
        if (NULL == command)
                return EINA_FALSE;
-       VC_ELM_LOG_DBG("Add item object(%p) command(%s)", (void*)obj, _command);
+       VC_ELM_LOG_DBG("Add object_item(%p) command(%s)", (void*)obj, _command);
        eina_hash_add(item_command_map, &obj, command);
        eina_hash_add(command_item_map, command, obj);
        elm_object_item_del_cb_set(obj, __item__object_del_callback);
@@ -1765,7 +1819,7 @@ static Eina_Bool _vc_elm_core_set_auto_item_object_command(Elm_Object_Item *obj,
        char *temp = NULL;
        temp = eina_hash_find(item_command_map, &obj);
        if (NULL != temp && NULL != _command && !strncmp(temp, _command, strlen(temp))) {
-               VC_ELM_LOG_DBG("obj item(%p) already has command(%s)", (void*)obj, temp);
+               VC_ELM_LOG_DBG("object_item(%p) already has command(%s)", (void*)obj, temp);
                return EINA_FALSE;
        }
 
index bdd95b0..ad453d1 100644 (file)
@@ -224,12 +224,12 @@ static void __vc_elm_click_by_focus(Evas_Object *obj)
                                VC_ELM_LOG_DBG("Already focused");
                                ecore_timer_add(g_click_time, __click_event, NULL);
                        } else {
+                               VC_ELM_LOG_DBG("item will be focused, parent(%p)", parent);
                                evas_object_smart_callback_add(parent, "item,focused", __focused_cb, "item,focused");
                                elm_object_item_focus_set(item, EINA_TRUE);
                                elm_object_focus_set(parent, EINA_TRUE);
                        }
                }
-
        }
 }
 
@@ -297,6 +297,8 @@ static Eina_Bool __item_filter_func(Evas_Object *obj, const char *text, void *us
        (void)text;
        (void)user_data;
 
+       VC_ELM_LOG_INFO("[Enter] evas_obj(%p)", obj);
+
        if (NULL == obj)
                return EINA_TRUE;
        return EINA_FALSE;
@@ -415,7 +417,8 @@ static Eina_Bool __gengrid_filter_func(Evas_Object *obj, const char *action, voi
 {
        int horizontal = elm_gengrid_horizontal_get(obj);
        (void)user_data;
-       VC_ELM_LOG_DBG("filtering gengrid");
+       VC_ELM_LOG_INFO("[Enter] evas_obj(%p), action(%s)", obj, action);
+
        if (NULL == action) { /* NULL means whole object */
                Elm_Object_Item *first = __gengrid_filter_first_item_get(obj, NULL);
                Elm_Object_Item *last = __gengrid_filter_last_item_get(obj, NULL);
index 956c05e..27ecd64 100644 (file)
@@ -74,7 +74,9 @@ Eina_List *ea_object_dump_text_list_get(Eina_Bool);
 Eina_List *ea_object_dump_find_data(Eina_List*, const char*, const char*);
 Object_Info *ea_object_dump_parent_widget_data_get(const Object_Info*);
 void ea_object_dump_set_geometry_info(int x, int y, int w, int h);
-void ea_object_dump_unset_geometry_info();
+void ea_object_dump_unset_geometry_info(void);
+Eina_List* text_dump_genlist_in_ctxpopup_get(void);
+void text_dump_genlist_in_ctxpopup_clear(void);
 
 #ifdef __cplusplus
 }