Efl.Ui.Button_Legacy: Prevent duplicate signal emit of contents
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 12 May 2020 15:20:15 +0000 (11:20 -0400)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 12 May 2020 21:52:15 +0000 (06:52 +0900)
Summary:
When call elm_button_add, theme_apply of layout is called and
_efl_ui_button_legacy_efl_ui_widget_theme_apply is called.
Then it calls the signal emit for the icon.
In the button theme, the default of the icon is hidden,
so this call is unnecessary.

Test Plan:
Evas_Object *bt;
clock_t start, finish;
start = clock();
bt = elm_button_add(win);
finish = clock();
printf("duration : %f\n", (double)(finish-start)/CLOCKS_PER_SEC);

Evas_Object *bt;
clock_t start, finish;
double sum= 0 ;
double avg = 0;
double cnt = 1000;

for(int i =0 ; i<(int)cnt; i++)
  {
     start = clock();
     bt = elm_button_add(win);
     finish = clock();
     sum += (double)(finish-start)/CLOCKS_PER_SEC;
  }
avg = sum / cnt ;
printf("button avg : %f %f\n",avg, sum);

[before]
button avg : 0.000215

[after]
button avg : 0.000138

Reviewers: Hermet, YOhoho, Jaehyun_Cho, zmike

Reviewed By: zmike

Subscribers: zmike, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11810

src/lib/elementary/efl_ui_button.c

index 1783fe37327164aa70807d60d0b53e2dec9fd667..215033dc2e78df298b5ae8ce6df9ea5145ed1961 100644 (file)
@@ -445,7 +445,7 @@ _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
 
    int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS));
    if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
-   _icon_signal_emit(obj);
+   if (efl_finalized_get(obj)) _icon_signal_emit(obj);
 
 #ifdef TIZEN_VECTOR_UX
    tizen_vg_button_set(obj);