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 <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7337
This commit is contained in:
Cedric BAIL 2018-11-22 17:11:54 -08:00 committed by Christopher Michael
parent 11be2ae234
commit bf82792a22
2 changed files with 26 additions and 0 deletions

View File

@ -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"

View File

@ -14,6 +14,18 @@ class Efl.Loop_Consumer (Efl.Object)
loop: Efl.Loop; [[Efl loop]]
}
}
future_resolved {
params {
result: any_value;
}
return: future<any_value>;
}
future_rejected {
params {
error: Eina.Error;
}
return: future<Eina.Error>;
}
}
implements {
Efl.Object.parent { set; }