summaryrefslogtreecommitdiff
path: root/legacy/efreet/src/lib/Efreet_Mime.h
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2009-03-03 07:20:21 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2009-03-03 07:20:21 +0000
commit200c92f82ab4e8fb82647c671714222ef4d0e58e (patch)
treed34ccd7ff19fb60ce1b40319e46c38fb69898a63 /legacy/efreet/src/lib/Efreet_Mime.h
parent5a8ce91119f928d112f41ec36331ccb8a0f09832 (diff)
efreet mime types icon cache.
This cache is very simple and should work fine when system does not change, it keeps a direct association of mime-types and found icons, remembering theme and icon size. Search is very fast since it uses stringshared strings and thus direct pointer comparison in hash search. We could optimize it even more if we assumed stringshared strings to come in, so no need to eina_stringshare_add() (which is a hash per se), using just eina_stringshare_ref(). Cache population is limited to compile-time value and just values older than a given threshold are deleted. I do not keep a LRU explicit list, so you might have some old but unused items always alive. I don't find this too bad, sure it will consume more memory, but will not hurt performance. We can change this to purge all expired items by not checking for number of items to remove, removing all that match. Next I plan to find out a good way to cache and speed up file->mime discovery. I plan to do auto-generated state-machine to match extensions, so you don't need to check the same extension character more than once. Example: Input: bla.edc Extensions: edc edj eps png bmp It would first try to match against 'e', 'p' and 'b'. It will match 'e' and then check for 'd' (edc or edj) or 'p' (eps). It will match 'd' and then check for 'c' or 'j'. This will reduce number of comparisons considerably. As I'm running out of time (4am, not much time left on this month), I could use some help here. SVN revision: 39343
Diffstat (limited to 'legacy/efreet/src/lib/Efreet_Mime.h')
-rw-r--r--legacy/efreet/src/lib/Efreet_Mime.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/legacy/efreet/src/lib/Efreet_Mime.h b/legacy/efreet/src/lib/Efreet_Mime.h
index 229a604..8578f5b 100644
--- a/legacy/efreet/src/lib/Efreet_Mime.h
+++ b/legacy/efreet/src/lib/Efreet_Mime.h
@@ -52,6 +52,9 @@ EAPI const char *efreet_mime_fallback_type_get(const char *file);
52EAPI char *efreet_mime_type_icon_get(const char *mime, const char *theme, 52EAPI char *efreet_mime_type_icon_get(const char *mime, const char *theme,
53 unsigned int size); 53 unsigned int size);
54 54
55EAPI void efreet_mime_type_cache_clear(void);
56EAPI void efreet_mime_type_cache_flush(void);
57
55/** 58/**
56 * @} 59 * @}
57 */ 60 */