summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_loop.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-21 16:34:05 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-21 17:55:03 +0900
commit04a01c13af3b212224b94097ed39f3cc6ad1fd31 (patch)
tree99e800fe1bf3b765b7867c9f58251ba751e0ed0d /src/lib/ecore/efl_loop.c
parent481853e1edbba2536f0189335f564e6133644f84 (diff)
ecore/efl loop. remove internal ecore_timer legacy api usage for eflloop
efl.loop was still using legacy ecore_timer_* calls inside. of course this is a big no-no if we are to allow multiple loops, so clean this up and convert them to efl.loop.timers.
Diffstat (limited to '')
-rw-r--r--src/lib/ecore/efl_loop.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index 79509703b2..6cf133f981 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -19,7 +19,7 @@ typedef struct _Efl_Internal_Promise Efl_Internal_Promise;
19struct _Efl_Loop_Promise_Simple_Data 19struct _Efl_Loop_Promise_Simple_Data
20{ 20{
21 union { 21 union {
22 Ecore_Timer *timer; 22 Efl_Loop_Timer *timer;
23 Ecore_Idler *idler; 23 Ecore_Idler *idler;
24 }; 24 };
25 Eina_Promise *promise; 25 Eina_Promise *promise;
@@ -265,7 +265,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event)
265 --pd->pollers.high; 265 --pd->pollers.high;
266 if (!pd->pollers.high) 266 if (!pd->pollers.high)
267 { 267 {
268 ecore_timer_del(pd->poll_high); 268 efl_del(pd->poll_high);
269 pd->poll_high = NULL; 269 pd->poll_high = NULL;
270 } 270 }
271 } 271 }
@@ -274,7 +274,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event)
274 --pd->pollers.medium; 274 --pd->pollers.medium;
275 if (!pd->pollers.medium) 275 if (!pd->pollers.medium)
276 { 276 {
277 ecore_timer_del(pd->poll_medium); 277 efl_del(pd->poll_medium);
278 pd->poll_medium = NULL; 278 pd->poll_medium = NULL;
279 } 279 }
280 } 280 }
@@ -283,7 +283,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event)
283 --pd->pollers.low; 283 --pd->pollers.low;
284 if (!pd->pollers.low) 284 if (!pd->pollers.low)
285 { 285 {
286 ecore_timer_del(pd->poll_low); 286 efl_del(pd->poll_low);
287 pd->poll_low = NULL; 287 pd->poll_low = NULL;
288 } 288 }
289 } 289 }
@@ -504,21 +504,24 @@ static void
504_efl_loop_timeout_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED) 504_efl_loop_timeout_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED)
505{ 505{
506 Efl_Loop_Promise_Simple_Data *d = data; 506 Efl_Loop_Promise_Simple_Data *d = data;
507 ecore_timer_del(d->timer); 507 efl_del(d->timer);
508 d->timer = NULL;
508 efl_loop_promise_simple_data_mp_free(d); 509 efl_loop_promise_simple_data_mp_free(d);
509} 510}
510 511
511static Eina_Bool 512static void
512_efl_loop_timeout_done(void *data) 513_efl_loop_timeout_done(void *data, const Efl_Event *event)
513{ 514{
514 Efl_Loop_Promise_Simple_Data *d = data; 515 Efl_Loop_Promise_Simple_Data *d = data;
516
515 eina_promise_resolve(d->promise, EINA_VALUE_EMPTY); 517 eina_promise_resolve(d->promise, EINA_VALUE_EMPTY);
518 d->timer = NULL;
516 efl_loop_promise_simple_data_mp_free(d); 519 efl_loop_promise_simple_data_mp_free(d);
517 return EINA_FALSE; 520 efl_del(event->object);
518} 521}
519 522
520static Eina_Future * 523static Eina_Future *
521_efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double time) 524_efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double tim)
522{ 525{
523 Efl_Loop_Promise_Simple_Data *d; 526 Efl_Loop_Promise_Simple_Data *d;
524 Eina_Promise *p; 527 Eina_Promise *p;
@@ -526,7 +529,11 @@ _efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double time)
526 d = efl_loop_promise_simple_data_calloc(1); 529 d = efl_loop_promise_simple_data_calloc(1);
527 EINA_SAFETY_ON_NULL_RETURN_VAL(d, NULL); 530 EINA_SAFETY_ON_NULL_RETURN_VAL(d, NULL);
528 531
529 d->timer = ecore_timer_add(time, _efl_loop_timeout_done, d); 532 d->timer = efl_add(EFL_LOOP_TIMER_CLASS, obj,
533 efl_loop_timer_interval_set(efl_added, tim),
534 efl_event_callback_add(efl_added,
535 EFL_LOOP_TIMER_EVENT_TICK,
536 _efl_loop_timeout_done, d));
530 EINA_SAFETY_ON_NULL_GOTO(d->timer, timer_error); 537 EINA_SAFETY_ON_NULL_GOTO(d->timer, timer_error);
531 538
532 p = eina_promise_new(efl_loop_future_scheduler_get(obj), 539 p = eina_promise_new(efl_loop_future_scheduler_get(obj),