forked from enlightenment/efl
eo debug name: Use strbuf instead of slstr
This should be a little bit more efficient, even if more "risky" in terms of leaks. The final API still looks exactly the same.
This commit is contained in:
parent
569ad0bac4
commit
999dbd9764
|
@ -1176,7 +1176,7 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
|
||||||
Efl.Gfx.size { set; }
|
Efl.Gfx.size { set; }
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Object.debug_name_override { get; }
|
Efl.Object.debug_name_override;
|
||||||
Efl.Canvas.Object.no_render { set; }
|
Efl.Canvas.Object.no_render { set; }
|
||||||
Efl.Canvas.Object.paragraph_direction { set; }
|
Efl.Canvas.Object.paragraph_direction { set; }
|
||||||
Efl.Canvas.Group.group_calculate;
|
Efl.Canvas.Group.group_calculate;
|
||||||
|
|
|
@ -60,15 +60,14 @@ _edje_object_efl_object_destructor(Eo *obj, Edje *class_data)
|
||||||
efl_data_unref(obj, class_data->base);
|
efl_data_unref(obj, class_data->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static Eina_Strbuf *
|
||||||
_edje_object_efl_object_debug_name_override_get(Eo *obj, Edje *ed)
|
_edje_object_efl_object_debug_name_override(Eo *obj, Edje *ed, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
const char *base;
|
sb = efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
||||||
|
eina_strbuf_append_printf(sb, ":file='%s':group='%s'",
|
||||||
base = efl_debug_name_get(efl_super(obj, MY_CLASS));
|
ed->file ? eina_file_filename_get(ed->file->f) : NULL,
|
||||||
return eina_slstr_printf("%s:file='%s':group='%s'", base,
|
ed->group);
|
||||||
ed->file ? eina_file_filename_get(ed->file->f) : NULL,
|
return sb;
|
||||||
ed->group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
|
|
@ -6608,13 +6608,12 @@ _efl_ui_win_class_constructor(Efl_Class *klass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static Eina_Strbuf *
|
||||||
_efl_ui_win_efl_object_debug_name_override_get(Eo *obj, Efl_Ui_Win_Data *pd)
|
_efl_ui_win_efl_object_debug_name_override(Eo *obj, Efl_Ui_Win_Data *pd, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
const char *base;
|
sb = efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
||||||
|
eina_strbuf_append_printf(sb, ":'%s':'%s'", pd->name, pd->title);
|
||||||
base = efl_debug_name_get(efl_super(obj, MY_CLASS));
|
return sb;
|
||||||
return eina_slstr_printf("%s:'%s':'%s'", base, pd->name, pd->title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eo*
|
EOLIAN static Eo*
|
||||||
|
|
|
@ -930,7 +930,7 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Elm.Interface.Atspi.Window,
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Object.finalize;
|
Efl.Object.finalize;
|
||||||
Efl.Object.debug_name_override { get; }
|
Efl.Object.debug_name_override;
|
||||||
Efl.Gfx.visible { set; }
|
Efl.Gfx.visible { set; }
|
||||||
Efl.Gfx.position { set; }
|
Efl.Gfx.position { set; }
|
||||||
Efl.Gfx.size { set; }
|
Efl.Gfx.size { set; }
|
||||||
|
|
|
@ -6234,14 +6234,15 @@ _elm_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd)
|
||||||
sd->on_destroy = EINA_FALSE;
|
sd->on_destroy = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static Eina_Strbuf *
|
||||||
_elm_widget_efl_object_debug_name_override_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
|
_elm_widget_efl_object_debug_name_override(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
const char *base, *focus = "";
|
const char *focus = "";
|
||||||
|
|
||||||
if (elm_obj_widget_focus_get(obj)) focus = ":focused";
|
if (elm_obj_widget_focus_get(obj)) focus = ":focused";
|
||||||
base = efl_debug_name_get(efl_super(obj, MY_CLASS));
|
sb = efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
||||||
return eina_slstr_printf("%s%s", base, focus);
|
eina_strbuf_append_printf(sb, "%s", focus);
|
||||||
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
|
|
|
@ -787,7 +787,7 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
||||||
Efl.Object.finalize;
|
Efl.Object.finalize;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Object.provider_find;
|
Efl.Object.provider_find;
|
||||||
Efl.Object.debug_name_override { get; }
|
Efl.Object.debug_name_override;
|
||||||
Efl.Gfx.color { set; }
|
Efl.Gfx.color { set; }
|
||||||
Efl.Gfx.visible { set; }
|
Efl.Gfx.visible { set; }
|
||||||
Efl.Gfx.position { set; }
|
Efl.Gfx.position { set; }
|
||||||
|
|
|
@ -81,15 +81,26 @@ abstract Efl.Object ()
|
||||||
comment: string @nullable; [[The comment]]
|
comment: string @nullable; [[The comment]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property debug_name_override {
|
debug_name_override {
|
||||||
[[ A read-only name for this object used for debugging.
|
[[ Build a read-only name for this object used for debugging.
|
||||||
|
|
||||||
|
Multiple calls using efl_super() can be chained in order to build
|
||||||
|
the entire debug name, from parent to child classes. In C the usual
|
||||||
|
way to build the string is as follows:
|
||||||
|
|
||||||
|
sb = efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
||||||
|
eina_strbuf_append_printf(sb, "new_information");
|
||||||
|
return sb;
|
||||||
|
|
||||||
|
The receiving function should always either free the strbuf or
|
||||||
|
returning it back to the caller, as ownership is transferred.
|
||||||
|
|
||||||
@since 1.21
|
@since 1.21
|
||||||
]]
|
]]
|
||||||
get {}
|
params {
|
||||||
values {
|
@in sb: own(ptr(Eina.Strbuf)); [[A string buffer, must not be $null.]]
|
||||||
name: string; [[A name including class name and object name.]]
|
|
||||||
}
|
}
|
||||||
|
return: own(ptr(Eina.Strbuf)); [[Should not be $null, may be $sb.]]
|
||||||
}
|
}
|
||||||
@property event_global_freeze_count @class {
|
@property event_global_freeze_count @class {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -47,6 +47,7 @@ enum @extern Eina.Xattr.Flags {
|
||||||
type @extern Eina.Error: int; [[Eina error type]]
|
type @extern Eina.Error: int; [[Eina error type]]
|
||||||
|
|
||||||
struct @extern @free(eina_binbuf_free) Eina.Binbuf; [[Eina binbuf data structure]]
|
struct @extern @free(eina_binbuf_free) Eina.Binbuf; [[Eina binbuf data structure]]
|
||||||
|
struct @extern @free(eina_strbuf_free) Eina.Strbuf; [[Eina strbuf data structure]]
|
||||||
|
|
||||||
struct @extern Eina.Slice {
|
struct @extern Eina.Slice {
|
||||||
[[A linear, read-only, memory segment]]
|
[[A linear, read-only, memory segment]]
|
||||||
|
|
|
@ -2480,7 +2480,8 @@ EAPI const char *
|
||||||
efl_debug_name_get(const Eo *obj_id)
|
efl_debug_name_get(const Eo *obj_id)
|
||||||
{
|
{
|
||||||
const char *override = "";
|
const char *override = "";
|
||||||
const char *name, *clsname, *ret;
|
const char *name, *clsname;
|
||||||
|
Eina_Strbuf *sb;
|
||||||
|
|
||||||
if (!obj_id) return "(null)";
|
if (!obj_id) return "(null)";
|
||||||
|
|
||||||
|
@ -2507,34 +2508,32 @@ efl_debug_name_get(const Eo *obj_id)
|
||||||
EO_OBJ_POINTER(obj_id, obj);
|
EO_OBJ_POINTER(obj_id, obj);
|
||||||
if (!obj) return eina_slstr_printf("Invalid_Object_ID@%p", obj_id);
|
if (!obj) return eina_slstr_printf("Invalid_Object_ID@%p", obj_id);
|
||||||
|
|
||||||
if (!obj->cur_klass)
|
sb = eina_strbuf_new();
|
||||||
{
|
|
||||||
ret = efl_debug_name_override_get(obj_id);
|
|
||||||
if (ret) goto end;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (obj->super)
|
|
||||||
ret = efl_debug_name_override_get(efl_super(obj_id, (Efl_Class *) obj->cur_klass->header.id));
|
|
||||||
else
|
|
||||||
ret = efl_debug_name_override_get(efl_cast(obj_id, (Efl_Class *) obj->cur_klass->header.id));
|
|
||||||
obj->super = EINA_FALSE;
|
|
||||||
obj->cur_klass = NULL;
|
|
||||||
if (ret) goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = efl_name_get(obj_id);
|
name = efl_name_get(obj_id);
|
||||||
clsname = obj->klass->desc->name;
|
clsname = obj->klass->desc->name;
|
||||||
if (_obj_is_override(obj)) override = "(override)";
|
if (_obj_is_override(obj)) override = "(override)";
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
ret = eina_slstr_printf("%s%s@%p[%d]:'%s'", clsname, override, obj_id, (int) obj->refcount, name);
|
eina_strbuf_append_printf(sb, "%s%s@%p[%d]:'%s'", clsname, override, obj_id, (int) obj->refcount, name);
|
||||||
else
|
else
|
||||||
ret = eina_slstr_printf("%s%s@%p[%d]", clsname, override, obj_id, (int) obj->refcount);
|
eina_strbuf_append_printf(sb, "%s%s@%p[%d]", clsname, override, obj_id, (int) obj->refcount);
|
||||||
|
|
||||||
|
if (!obj->cur_klass)
|
||||||
|
{
|
||||||
|
sb = efl_debug_name_override((Eo *) obj_id, sb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (obj->super)
|
||||||
|
sb = efl_debug_name_override(efl_super(obj_id, (Efl_Class *) obj->cur_klass->header.id), sb);
|
||||||
|
else
|
||||||
|
sb = efl_debug_name_override(efl_cast(obj_id, (Efl_Class *) obj->cur_klass->header.id), sb);
|
||||||
|
obj->super = EINA_FALSE;
|
||||||
|
obj->cur_klass = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
EO_OBJ_DONE(obj_id);
|
EO_OBJ_DONE(obj_id);
|
||||||
return ret;
|
return eina_slstr_strbuf_new(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
|
|
|
@ -572,10 +572,10 @@ _efl_object_comment_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
||||||
return pd->ext->comment;
|
return pd->ext->comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static Eina_Strbuf *
|
||||||
_efl_object_debug_name_override_get(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED)
|
_efl_object_debug_name_override(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
return NULL;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
||||||
class.destructor;
|
class.destructor;
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Object.debug_name_override { get; }
|
Efl.Object.debug_name_override;
|
||||||
Efl.Canvas.Object.no_render { set; }
|
Efl.Canvas.Object.no_render { set; }
|
||||||
Efl.Canvas.Object.paragraph_direction { get; set; }
|
Efl.Canvas.Object.paragraph_direction { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,7 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Object.finalize;
|
Efl.Object.finalize;
|
||||||
Efl.Object.provider_find;
|
Efl.Object.provider_find;
|
||||||
Efl.Object.debug_name_override { get; }
|
Efl.Object.debug_name_override;
|
||||||
Efl.Gfx.visible { get; set; }
|
Efl.Gfx.visible { get; set; }
|
||||||
Efl.Gfx.color { get; set; }
|
Efl.Gfx.color { get; set; }
|
||||||
Efl.Gfx.color_part { get; set; }
|
Efl.Gfx.color_part { get; set; }
|
||||||
|
|
|
@ -330,8 +330,8 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
|
||||||
|
|
||||||
EINA_LIST_FREE(unrefs, eo_obj)
|
EINA_LIST_FREE(unrefs, eo_obj)
|
||||||
{
|
{
|
||||||
ERR("Killing Zombie Object [%s@%p]. Refs: %i:%i",
|
ERR("Killing Zombie Object [%s]. Refs: %i:%i",
|
||||||
efl_class_name_get(eo_obj), eo_obj, efl_ref_get(eo_obj), ___efl_ref2_get(eo_obj));
|
efl_debug_name_get(eo_obj), efl_ref_get(eo_obj), ___efl_ref2_get(eo_obj));
|
||||||
___efl_ref2_reset(eo_obj);
|
___efl_ref2_reset(eo_obj);
|
||||||
while (efl_ref_get(eo_obj) > 1) efl_unref(eo_obj);
|
while (efl_ref_get(eo_obj) > 1) efl_unref(eo_obj);
|
||||||
while (efl_ref_get(eo_obj) < 1) efl_ref(eo_obj);
|
while (efl_ref_get(eo_obj) < 1) efl_ref(eo_obj);
|
||||||
|
@ -343,12 +343,12 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
|
||||||
EINA_INLIST_FOREACH(lay->objects, o)
|
EINA_INLIST_FOREACH(lay->objects, o)
|
||||||
if (o && (o->object == eo_obj))
|
if (o && (o->object == eo_obj))
|
||||||
{
|
{
|
||||||
ERR("Zombie Object [%s@%p] could not be removed "
|
ERR("Zombie Object [%s] could not be removed "
|
||||||
"from the list of objects. Maybe this object "
|
"from the list of objects. Maybe this object "
|
||||||
"was deleted but the call to efl_destructor() "
|
"was deleted but the call to efl_destructor() "
|
||||||
"was not propagated to all the parent classes? "
|
"was not propagated to all the parent classes? "
|
||||||
"Forcibly removing it. This may leak! Refs: %i:%i",
|
"Forcibly removing it. This may leak! Refs: %i:%i",
|
||||||
efl_class_name_get(eo_obj), eo_obj, efl_ref_get(eo_obj), ___efl_ref2_get(eo_obj));
|
efl_debug_name_get(eo_obj), efl_ref_get(eo_obj), ___efl_ref2_get(eo_obj));
|
||||||
lay->objects = (Evas_Object_Protected_Data *)
|
lay->objects = (Evas_Object_Protected_Data *)
|
||||||
eina_inlist_remove(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(o));
|
eina_inlist_remove(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(o));
|
||||||
goto next_zombie;
|
goto next_zombie;
|
||||||
|
|
|
@ -67,22 +67,22 @@ evas_object_name_child_find(const Evas_Object *eo_obj, const char *name, int rec
|
||||||
}
|
}
|
||||||
|
|
||||||
/* new in EO */
|
/* new in EO */
|
||||||
EOLIAN const char *
|
EOLIAN Eina_Strbuf *
|
||||||
_efl_canvas_object_efl_object_debug_name_override_get(Eo *eo_obj, Evas_Object_Protected_Data *obj)
|
_efl_canvas_object_efl_object_debug_name_override(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
const char *norend = obj->no_render ? ":no_render" : "";
|
const char *norend = obj->no_render ? ":no_render" : "";
|
||||||
const char *clip = obj->clip.clipees ? ":clipper" : "";
|
const char *clip = obj->clip.clipees ? ":clipper" : "";
|
||||||
const char *base;
|
|
||||||
|
|
||||||
base = efl_debug_name_get(efl_super(eo_obj, EFL_CANVAS_OBJECT_CLASS));
|
sb = efl_debug_name_override(efl_super(eo_obj, EFL_CANVAS_OBJECT_CLASS), sb);
|
||||||
if (obj->cur->visible)
|
if (obj->cur->visible)
|
||||||
{
|
{
|
||||||
return eina_slstr_printf("%s%s%s:(%d,%d %dx%d)", base, norend, clip,
|
eina_strbuf_append_printf(sb, "%s%s:(%d,%d %dx%d)", norend, clip,
|
||||||
obj->cur->geometry.x, obj->cur->geometry.y,
|
obj->cur->geometry.x, obj->cur->geometry.y,
|
||||||
obj->cur->geometry.w, obj->cur->geometry.h);
|
obj->cur->geometry.w, obj->cur->geometry.h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return eina_slstr_printf("%s:hidden%s%s", base, norend, clip);
|
eina_strbuf_append_printf(sb, ":hidden%s%s", norend, clip);
|
||||||
}
|
}
|
||||||
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -647,13 +647,12 @@ _efl_canvas_group_efl_object_destructor(Eo *eo_obj, Evas_Smart_Data *o)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static Eina_Strbuf *
|
||||||
_efl_canvas_group_efl_object_debug_name_override_get(Eo *eo_obj, Evas_Smart_Data *o)
|
_efl_canvas_group_efl_object_debug_name_override(Eo *eo_obj, Evas_Smart_Data *o, Eina_Strbuf *sb)
|
||||||
{
|
{
|
||||||
const char *base;
|
sb = efl_debug_name_override(efl_super(eo_obj, MY_CLASS), sb);
|
||||||
|
eina_strbuf_append_printf(sb, ":children=%d", eina_inlist_count(o->contained));
|
||||||
base = efl_debug_name_get(efl_super(eo_obj, MY_CLASS));
|
return sb;
|
||||||
return eina_slstr_printf("%s:children=%d", base, eina_inlist_count(o->contained));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
Loading…
Reference in New Issue