docs: Improve documentation on cache-related classes

Also, code comments and typos.
This commit is contained in:
Xavi Artigas 2019-10-28 16:05:08 +01:00
parent 547f8767a9
commit 368db272fd
3 changed files with 20 additions and 8 deletions

View File

@ -1,13 +1,24 @@
interface @beta Efl.Cached.Item
{
[[Efl Cached Item interface]]
[[Interface for objects which can be cached in memory.
Since memory is a limited resource, it is interesting to know how much of it an object
requires. This interface provides a read-only property for objects to report their
memory consumption.
Keep in mind that this should not only take into account by the object structure
itself, but any dynamic memory it might allocate.
This is used by @Efl.Ui.Caching_Factory, for example, to keep track of the total
amount of memory used by the objects the factory creates.
]]
methods {
@property memory_size {
[[The memory size associated with an object.]]
[[The amount of memory currently used by this object.]]
get {
}
values {
consumed: uint; [[Bytes of memory consumed by this object.]]
consumed: uint; [[Bytes of memory.]]
}
}
}

View File

@ -438,8 +438,8 @@ _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED)
Efl_Ui_Caching_Factory_Data *pd = data;
Efl_Gfx_Entity *entity;
// Application is going into background, let's free ressource
// Possible improvement would be to delay that by a few second.
// Application is going into background, let's free resources.
// Possible improvement would be to delay that by a few seconds.
EINA_LIST_FREE(pd->cache, entity)
efl_del(entity);

View File

@ -1,3 +1,5 @@
parse efl_app;
class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
{
[[Efl UI Factory that provides object caching.
@ -6,14 +8,13 @@ class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
defined.
This factory will rely on its parent class @Efl.Ui.Widget_Factory for creating the subset of class that match the
@Efl.Ui.Widget interface.
The factory will automatically empties the cache when the application goes into pause.
The factory will automatically empty the cache when the application goes into the background
(@[Efl.App.pause] event).
Creating objects is costly and time consuming, keeping a few on hand for when you next will need them helps a lot.
This is what this factory caching infrastructure provides. It will create the object from the class defined on it
and set the parent and the model as needed for all created items. The View has to release the Item using the
release function of the Factory interface for all of this to work properly.
The cache might decide to flush itself when the application event pause is triggered.
]]
methods {
@property memory_limit {