summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-07-11 14:59:05 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-17 21:57:55 +0200
commit0aba6030bd0783796dadc3651d231980be4cab52 (patch)
tree72168a76b4bffc0e434d7bce9cdfb37f29bc0ca2 /src/lib/ecore
parent0b949d0e7a092bf8e66f77832778b0be48a0fcfc (diff)
ecore: rely on efl_provider_{un,}register to do the job of efl_loop_{un,}register.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9294
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/ecore_private.h1
-rw-r--r--src/lib/ecore/efl_loop.c33
-rw-r--r--src/lib/ecore/efl_loop.eo1
3 files changed, 6 insertions, 29 deletions
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index 9bd3c3eb0e..b66b50915d 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -116,7 +116,6 @@ struct _Efl_Loop_Future_Scheduler
116struct _Efl_Loop_Data 116struct _Efl_Loop_Data
117{ 117{
118 double loop_time; 118 double loop_time;
119 Eina_Hash *providers;
120 119
121 Efl_Loop_Future_Scheduler future_scheduler; 120 Efl_Loop_Future_Scheduler future_scheduler;
122 121
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index 7a61cabdd7..a21aeeae01 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -87,19 +87,6 @@ efl_exit(int exit_code)
87 efl_loop_quit(efl_main_loop_get(), v); 87 efl_loop_quit(efl_main_loop_get(), v);
88} 88}
89 89
90EOLIAN static Efl_Object *
91_efl_loop_efl_object_provider_find(const Eo *obj, Efl_Loop_Data *pd, const Efl_Object *klass)
92{
93 Efl_Object *r;
94
95 if (klass == EFL_LOOP_CLASS) return (Efl_Object *) obj;
96
97 r = eina_hash_find(pd->providers, &klass);
98 if (r) return r;
99
100 return efl_provider_find(efl_super(obj, EFL_LOOP_CLASS), klass);
101}
102
103EAPI int 90EAPI int
104efl_loop_exit_code_process(Eina_Value *value) 91efl_loop_exit_code_process(Eina_Value *value)
105{ 92{
@@ -286,7 +273,6 @@ _efl_loop_efl_object_constructor(Eo *obj, Efl_Loop_Data *pd)
286 efl_event_callback_array_add(obj, event_catcher_watch(), pd); 273 efl_event_callback_array_add(obj, event_catcher_watch(), pd);
287 274
288 pd->loop_time = ecore_time_get(); 275 pd->loop_time = ecore_time_get();
289 pd->providers = eina_hash_pointer_new(EINA_FREE_CB(efl_unref));
290 pd->epoll_fd = -1; 276 pd->epoll_fd = -1;
291 pd->timer_fd = -1; 277 pd->timer_fd = -1;
292 pd->future_message_handler = efl_add(EFL_LOOP_MESSAGE_FUTURE_HANDLER_CLASS, obj); 278 pd->future_message_handler = efl_add(EFL_LOOP_MESSAGE_FUTURE_HANDLER_CLASS, obj);
@@ -302,10 +288,6 @@ _efl_loop_efl_object_invalidate(Eo *obj, Efl_Loop_Data *pd)
302 288
303 _ecore_main_content_clear(obj, pd); 289 _ecore_main_content_clear(obj, pd);
304 290
305 // Even if we are just refcounting provider, efl_provider_find won't reach them after invalidate
306 eina_hash_free(pd->providers);
307 pd->providers = NULL;
308
309 pd->poll_low = NULL; 291 pd->poll_low = NULL;
310 pd->poll_medium = NULL; 292 pd->poll_medium = NULL;
311 pd->poll_high = NULL; 293 pd->poll_high = NULL;
@@ -517,20 +499,17 @@ timer_error:
517} 499}
518 500
519static Eina_Bool 501static Eina_Bool
520_efl_loop_register(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd, const Efl_Class *klass, const Efl_Object *provider) 502_efl_loop_register(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED,
503 const Efl_Class *klass, const Efl_Object *provider)
521{ 504{
522 // The passed object does not provide that said class. 505 return efl_provider_register(obj, klass, provider);
523 if (!efl_isa(provider, klass)) return EINA_FALSE;
524
525 // Note: I would prefer to use efl_xref here, but I can't figure a nice way to
526 // call efl_xunref on hash destruction.
527 return eina_hash_add(pd->providers, &klass, efl_ref(provider));
528} 506}
529 507
530static Eina_Bool 508static Eina_Bool
531_efl_loop_unregister(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd, const Efl_Class *klass, const Efl_Object *provider) 509_efl_loop_unregister(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED,
510 const Efl_Class *klass, const Efl_Object *provider)
532{ 511{
533 return eina_hash_del(pd->providers, &klass, provider); 512 return efl_provider_unregister(obj, klass, provider);
534} 513}
535 514
536void 515void
diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo
index 7e1bc107ae..eca974bd59 100644
--- a/src/lib/ecore/efl_loop.eo
+++ b/src/lib/ecore/efl_loop.eo
@@ -133,7 +133,6 @@ abstract Efl.Loop extends Efl.Task
133 Efl.Object.constructor; 133 Efl.Object.constructor;
134 Efl.Object.invalidate; 134 Efl.Object.invalidate;
135 Efl.Object.destructor; 135 Efl.Object.destructor;
136 Efl.Object.provider_find;
137 Efl.Task.run; 136 Efl.Task.run;
138 Efl.Task.end; 137 Efl.Task.end;
139 } 138 }