forked from enlightenment/efl
eet: help the kernel to actually load the eet file in memory more efficiently.
When you open a theme, it is very likely that most of the data in it will be needed at some point, that's why it is a good idea to tell it in advance to the kernel so it could load them if it has some spare ressource. We can't just blindly turn EINA_FILE_WILLNEED on any file or a wrong eet file would be loaded in memory when we don't need it. So we shall keep the sequential load until we are sure that the file is correct and then explicitely tell the kernel that the rest of the data should be loaded in ram.
This commit is contained in:
parent
570ce667f3
commit
1a3c9d68d0
|
@ -1043,6 +1043,16 @@ eet_internal_read2(Eet_File *ef)
|
|||
#endif /* ifdef HAVE_SIGNATURE */
|
||||
}
|
||||
|
||||
/* At this stage we have a valid eet file, let's tell the system we are likely to need most of its data */
|
||||
if (ef->readfp && ef->ed)
|
||||
{
|
||||
unsigned long int offset;
|
||||
|
||||
offset = (unsigned char*) ef->ed->start - (unsigned char*) ef->data;
|
||||
eina_file_map_populate(ef->readfp, EINA_FILE_WILLNEED, ef->data,
|
||||
offset, ef->data_size - offset);
|
||||
}
|
||||
|
||||
return ef;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue