summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2/evas_cs2_client.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-08-20 13:09:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:14 +0900
commitdf31807329ca500eb579d538abe9f21208426934 (patch)
treecb7aed6287d8f37929658290c239cf012c87059e /src/lib/evas/cserve2/evas_cs2_client.c
parent467b1b17395cf712ee4ec1ac4a3cef710370ed6d (diff)
evas/cserve2: Client-side scanning of Font Entries
Diffstat (limited to 'src/lib/evas/cserve2/evas_cs2_client.c')
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 47ede9bf68..5721d0bd69 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -54,6 +54,7 @@ static const File_Data *_shared_file_data_get_by_id(unsigned int id);
54static const Shm_Object *_shared_index_item_get_by_id(Shared_Index *si, int elemsize, unsigned int id); 54static const Shm_Object *_shared_index_item_get_by_id(Shared_Index *si, int elemsize, unsigned int id);
55static const File_Data *_shared_image_entry_file_data_find(Image_Entry *ie); 55static const File_Data *_shared_image_entry_file_data_find(Image_Entry *ie);
56static const Image_Data *_shared_image_entry_image_data_find(Image_Entry *ie); 56static const Image_Data *_shared_image_entry_image_data_find(Image_Entry *ie);
57static const Font_Data *_shared_font_entry_data_find(Font_Entry *fe);
57 58
58#ifndef UNIX_PATH_MAX 59#ifndef UNIX_PATH_MAX
59#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path) 60#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path)
@@ -1171,6 +1172,8 @@ _font_entry_free(Font_Entry *fe)
1171 if (fe->fash[i]) 1172 if (fe->fash[i])
1172 fash_gl_free(fe->fash[i]); 1173 fash_gl_free(fe->fash[i]);
1173 1174
1175 eina_hash_del_by_key(_index.fonts.entries_by_hkey, fe->hkey);
1176 free(fe->hkey);
1174 eina_stringshare_del(fe->source); 1177 eina_stringshare_del(fe->source);
1175 eina_stringshare_del(fe->name); 1178 eina_stringshare_del(fe->name);
1176 eina_hash_foreach(fe->glyphs_maps, _glyphs_maps_foreach_free, NULL); 1179 eina_hash_foreach(fe->glyphs_maps, _glyphs_maps_foreach_free, NULL);
@@ -1235,7 +1238,8 @@ _font_load_server_send(Font_Entry *fe, Message_Type type)
1235} 1238}
1236 1239
1237Font_Entry * 1240Font_Entry *
1238evas_cserve2_font_load(const char *source, const char *name, int size, int dpi, Font_Rend_Flags wanted_rend) 1241evas_cserve2_font_load(const char *source, const char *name, int size, int dpi,
1242 Font_Rend_Flags wanted_rend)
1239{ 1243{
1240 Font_Entry *fe; 1244 Font_Entry *fe;
1241 1245
@@ -1260,12 +1264,36 @@ evas_cserve2_font_load(const char *source, const char *name, int size, int dpi,
1260 eina_clist_init(&fe->glyphs_queue); 1264 eina_clist_init(&fe->glyphs_queue);
1261 eina_clist_init(&fe->glyphs_used); 1265 eina_clist_init(&fe->glyphs_used);
1262 1266
1267 if (asprintf(&fe->hkey, "%s:%s/%u:%u:%u", fe->name, fe->source,
1268 fe->size, fe->dpi, (unsigned int) fe->wanted_rend) == -1)
1269 fe->hkey = NULL;
1270
1263 return fe; 1271 return fe;
1264} 1272}
1265 1273
1266int 1274int
1267evas_cserve2_font_load_wait(Font_Entry *fe) 1275evas_cserve2_font_load_wait(Font_Entry *fe)
1268{ 1276{
1277#if USE_SHARED_INDEX
1278 const Font_Data *fd;
1279 Eina_Bool failed;
1280 unsigned int rid, rrid;
1281
1282 rid = fe->rid;
1283 rrid = _server_dispatch(&failed);
1284 if ((rid == rrid) && !fe->failed)
1285 return CSERVE2_NONE;
1286
1287 fd = _shared_font_entry_data_find(fe);
1288 if (fd)
1289 {
1290 INF("Bypassing socket wait (rid %d)", fe->rid);
1291 fe->failed = EINA_FALSE;
1292 fe->rid = 0;
1293 return CSERVE2_NONE;
1294 }
1295#endif
1296
1269 if (!_server_dispatch_until(fe->rid)) 1297 if (!_server_dispatch_until(fe->rid))
1270 return CSERVE2_GENERIC; 1298 return CSERVE2_GENERIC;
1271 1299
@@ -1762,7 +1790,9 @@ _server_index_list_set(Msg_Base *data, int size)
1762 1790
1763 1791
1764 // 4. Font indexes 1792 // 4. Font indexes
1765 // TODO 1793
1794 eina_strlcpy(_index.fonts.path, msg->fonts_index_path, SHARED_BUFFER_PATH_MAX);
1795 _shared_index_remap_check(&_index.fonts, sizeof(Font_Data));
1766 1796
1767 return 0; 1797 return 0;
1768} 1798}
@@ -1826,7 +1856,7 @@ _shared_image_entry_file_data_find(Image_Entry *ie)
1826 if (!_index.strings_index.header || !_index.strings_entries.data) 1856 if (!_index.strings_index.header || !_index.strings_entries.data)
1827 return NULL; 1857 return NULL;
1828 1858
1829 if (!_index.files.header || !_index.files.entries.fdata) 1859 if (!_index.files.header || !_index.files.entries.filedata)
1830 return NULL; 1860 return NULL;
1831 1861
1832 // Direct access 1862 // Direct access
@@ -1851,7 +1881,7 @@ _shared_image_entry_file_data_find(Image_Entry *ie)
1851 const File_Data *fd; 1881 const File_Data *fd;
1852 char fd_hkey[PATH_MAX]; 1882 char fd_hkey[PATH_MAX];
1853 1883
1854 fd = &(_index.files.entries.fdata[k]); 1884 fd = &(_index.files.entries.filedata[k]);
1855 if (!fd->id) break; 1885 if (!fd->id) break;
1856 if (!fd->refcount) continue; 1886 if (!fd->refcount) continue;
1857 1887