From e7b8238d34e24aae82f1214fb928877327728dae Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 22 Nov 2018 17:11:54 -0800 Subject: [PATCH] ecore: add an helper on Efl.Loop_Consumer to build resolved and rejected future more easily. This make all object that inherit from Efl.Loop_Consumer have an easy ability to create a future from their link to a loop provider. This way there is no need to further lookup for a scheduler. This can by applied after the patch series from T7471. Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D7337 --- src/lib/ecore/efl_loop_consumer.c | 14 ++++++++++++++ src/lib/ecore/efl_loop_consumer.eo | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/lib/ecore/efl_loop_consumer.c b/src/lib/ecore/efl_loop_consumer.c index 795b5fc..29e94ed 100644 --- a/src/lib/ecore/efl_loop_consumer.c +++ b/src/lib/ecore/efl_loop_consumer.c @@ -36,4 +36,18 @@ _efl_loop_consumer_efl_object_parent_set(Eo *obj, Efl_Loop_Consumer_Data *pd EIN efl_parent_set(efl_super(obj, EFL_LOOP_CONSUMER_CLASS), parent); } +static Eina_Future * +_efl_loop_consumer_future_resolved(Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED, + Eina_Value result) +{ + return eina_future_resolved(efl_loop_future_scheduler_get(obj), result); +} + +static Eina_Future * +_efl_loop_consumer_future_rejected(Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED, + Eina_Error error) +{ + return eina_future_rejected(efl_loop_future_scheduler_get(obj), error); +} + #include "efl_loop_consumer.eo.c" diff --git a/src/lib/ecore/efl_loop_consumer.eo b/src/lib/ecore/efl_loop_consumer.eo index e486567..4d7484e 100644 --- a/src/lib/ecore/efl_loop_consumer.eo +++ b/src/lib/ecore/efl_loop_consumer.eo @@ -14,6 +14,18 @@ class Efl.Loop_Consumer (Efl.Object) loop: Efl.Loop; [[Efl loop]] } } + future_resolved { + params { + result: any_value; + } + return: future; + } + future_rejected { + params { + error: Eina.Error; + } + return: future; + } } implements { Efl.Object.parent { set; } -- 2.7.4